questionFrontendId int64 1 3.51k | questionTitle stringlengths 3 79 | TitleSlug stringlengths 3 79 | content stringlengths 431 25.4k ⌀ | difficulty stringclasses 3
values | totalAccepted stringlengths 2 6 | totalSubmission stringlengths 2 6 | totalAcceptedRaw int64 124 16.8M | totalSubmissionRaw int64 285 30.3M | acRate stringlengths 4 5 | similarQuestions stringlengths 2 714 | mysqlSchemas stringclasses 295
values | category stringclasses 6
values | codeDefinition stringlengths 122 24.9k ⌀ | sampleTestCase stringlengths 1 4.33k | metaData stringlengths 37 3.13k | envInfo stringclasses 26
values | topicTags stringlengths 2 153 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,408 | Design SQL | design-sql | null | Medium | 12.8K | 17.9K | 12,822 | 17,894 | 71.7% | [] | [] | Algorithms | null | ["SQL","ins","sel","ins","exp","rmv","sel","exp"]
[[["one","two","three"],[2,3,1]],["two",["first","second","third"]],["two",1,3],["two",["fourth","fifth","sixth"]],["two"],["two",1],["two",2,2],["two"]] | {
"classname": "SQL",
"constructor": {
"params": [
{
"type": "list<string>",
"name": "names"
},
{
"name": "columns",
"type": "list<integer>"
}
]
},
"methods": [
{
"params": [
{
"type": "string",
"name": "name"
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Design'] |
2,409 | Count Days Spent Together | count-days-spent-together | <p>Alice and Bob are traveling to Rome for separate business meetings.</p>
<p>You are given 4 strings <code>arriveAlice</code>, <code>leaveAlice</code>, <code>arriveBob</code>, and <code>leaveBob</code>. Alice will be in the city from the dates <code>arriveAlice</code> to <code>leaveAlice</code> (<strong>inclusive</st... | Easy | 26.9K | 58.1K | 26,866 | 58,100 | 46.2% | ['number-of-days-between-two-dates', 'minimum-number-of-operations-to-convert-time'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countDaysTogether(string arriveAlice, string leaveAlice, string arriveBob, string leaveBob) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countDaysTogether(String arriveAlic... | "08-15"
"08-18"
"08-16"
"08-19" | {
"name": "countDaysTogether",
"params": [
{
"name": "arriveAlice",
"type": "string"
},
{
"type": "string",
"name": "leaveAlice"
},
{
"type": "string",
"name": "arriveBob"
},
{
"type": "string",
"name": "leaveBob"
}
],
"return": {
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'String'] |
2,410 | Maximum Matching of Players With Trainers | maximum-matching-of-players-with-trainers | <p>You are given a <strong>0-indexed</strong> integer array <code>players</code>, where <code>players[i]</code> represents the <strong>ability</strong> of the <code>i<sup>th</sup></code> player. You are also given a <strong>0-indexed</strong> integer array <code>trainers</code>, where <code>trainers[j]</code> represent... | Medium | 49.7K | 74.8K | 49,717 | 74,803 | 66.5% | ['most-profit-assigning-work', 'long-pressed-name', 'interval-list-intersections', 'largest-merge-of-two-strings', 'maximum-number-of-tasks-you-can-assign', 'successful-pairs-of-spells-and-potions', 'the-latest-time-to-catch-a-bus', 'maximize-greatness-of-an-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int matchPlayersAndTrainers(vector<int>& players, vector<int>& trainers) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int matchPlayersAndTrainers(int[] players, int[] trainers) {\n... | [4,7,9]
[8,2,5,8] | {
"name": "matchPlayersAndTrainers",
"params": [
{
"name": "players",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "trainers"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Greedy', 'Sorting'] |
2,411 | Smallest Subarrays With Maximum Bitwise OR | smallest-subarrays-with-maximum-bitwise-or | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> of length <code>n</code>, consisting of non-negative integers. For each index <code>i</code> from <code>0</code> to <code>n - 1</code>, you must determine the size of the <strong>minimum sized</strong> non-empty subarray of <code>nums</code> starting... | Medium | 15K | 33.5K | 15,038 | 33,493 | 44.9% | ['merge-k-sorted-lists', 'bitwise-ors-of-subarrays', 'longest-subarray-with-maximum-bitwise-and'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> smallestSubarrays(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] smallestSubarrays(int[] nums) {\n \n }\n}"}, {"value": "python", "text... | [1,0,2,1,3] | {
"name": "smallestSubarrays",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Bit Manipulation', 'Sliding Window'] |
2,412 | Minimum Money Required Before Transactions | minimum-money-required-before-transactions | <p>You are given a <strong>0-indexed</strong> 2D integer array <code><font face="monospace">transactions</font></code>, where <code>transactions[i] = [cost<sub>i</sub>, cashback<sub>i</sub>]</code>.</p>
<p>The array describes transactions, where each transaction must be completed exactly once in <strong>some order</st... | Hard | 12K | 29.2K | 11,952 | 29,202 | 40.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumMoney(vector<vector<int>>& transactions) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumMoney(int[][] transactions) {\n \n }\n}"}, {"value": "p... | [[2,1],[5,0],[4,2]] | {
"name": "minimumMoney",
"params": [
{
"name": "transactions",
"type": "integer[][]"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Sorting'] |
2,413 | Smallest Even Multiple | smallest-even-multiple | Given a <strong>positive</strong> integer <code>n</code>, return <em>the smallest positive integer that is a multiple of <strong>both</strong> </em><code>2</code><em> and </em><code>n</code>.
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> n = 5
<strong>Output:</strong> 1... | Easy | 225.7K | 256.3K | 225,676 | 256,338 | 88.0% | ['greatest-common-divisor-of-strings', 'three-divisors', 'find-greatest-common-divisor-of-array', 'convert-the-temperature', 'minimum-cuts-to-divide-a-circle'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int smallestEvenMultiple(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int smallestEvenMultiple(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "default... | 5 | {
"name": "smallestEvenMultiple",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Number Theory'] |
2,414 | Length of the Longest Alphabetical Continuous Substring | length-of-the-longest-alphabetical-continuous-substring | <p>An <strong>alphabetical continuous string</strong> is a string consisting of consecutive letters in the alphabet. In other words, it is any substring of the string <code>"abcdefghijklmnopqrstuvwxyz"</code>.</p>
<ul>
<li>For example, <code>"abc"</code> is an alphabetical continuous string, while... | Medium | 54K | 91.3K | 53,976 | 91,305 | 59.1% | ['longest-consecutive-sequence', 'arithmetic-slices', 'max-consecutive-ones', 'maximum-number-of-vowels-in-a-substring-of-given-length', 'number-of-zero-filled-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestContinuousSubstring(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestContinuousSubstring(String s) {\n \n }\n}"}, {"value": "python", "text": ... | "abacaba" | {
"name": "longestContinuousSubstring",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String'] |
2,415 | Reverse Odd Levels of Binary Tree | reverse-odd-levels-of-binary-tree | <p>Given the <code>root</code> of a <strong>perfect</strong> binary tree, reverse the node values at each <strong>odd</strong> level of the tree.</p>
<ul>
<li>For example, suppose the node values at level 3 are <code>[2,1,3,4,7,11,29,18]</code>, then it should become <code>[18,29,11,7,4,3,1,2]</code>.</li>
</ul>
<p>... | Medium | 164.6K | 190.1K | 164,624 | 190,052 | 86.6% | ['invert-binary-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [2,3,5,8,13,21,34] | {
"name": "reverseOddLevels",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "TreeNode"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
2,416 | Sum of Prefix Scores of Strings | sum-of-prefix-scores-of-strings | <p>You are given an array <code>words</code> of size <code>n</code> consisting of <strong>non-empty</strong> strings.</p>
<p>We define the <strong>score</strong> of a string <code>term</code> as the <strong>number</strong> of strings <code>words[i]</code> such that <code>term</code> is a <strong>prefix</strong> of <co... | Hard | 115.7K | 190.7K | 115,723 | 190,682 | 60.7% | ['design-add-and-search-words-data-structure', 'maximum-xor-of-two-numbers-in-an-array', 'map-sum-pairs'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> sumPrefixScores(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] sumPrefixScores(String[] words) {\n \n }\n}"}, {"value": "python", "... | ["abc","ab","bc","b"] | {
"name": "sumPrefixScores",
"params": [
{
"type": "string[]",
"name": "words"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Trie', 'Counting'] |
2,417 | Closest Fair Integer | closest-fair-integer | null | Medium | 1.3K | 2.9K | 1,291 | 2,864 | 45.1% | [] | [] | Algorithms | null | 2 | {
"name": "closestFair",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Enumeration'] |
2,418 | Sort the People | sort-the-people | <p>You are given an array of strings <code>names</code>, and an array <code>heights</code> that consists of <strong>distinct</strong> positive integers. Both arrays are of length <code>n</code>.</p>
<p>For each index <code>i</code>, <code>names[i]</code> and <code>heights[i]</code> denote the name and height of the <c... | Easy | 338.3K | 398.9K | 338,274 | 398,890 | 84.8% | ['sort-array-by-increasing-frequency', 'sort-the-students-by-their-kth-score'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> sortPeople(vector<string>& names, vector<int>& heights) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String[] sortPeople(String[] names, int[] heights) {\n \n... | ["Mary","John","Emma"]
[180,165,170] | {
"name": "sortPeople",
"params": [
{
"type": "string[]",
"name": "names"
},
{
"type": "integer[]",
"name": "heights"
}
],
"return": {
"type": "string[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Sorting'] |
2,419 | Longest Subarray With Maximum Bitwise AND | longest-subarray-with-maximum-bitwise-and | <p>You are given an integer array <code>nums</code> of size <code>n</code>.</p>
<p>Consider a <strong>non-empty</strong> subarray from <code>nums</code> that has the <strong>maximum</strong> possible <strong>bitwise AND</strong>.</p>
<ul>
<li>In other words, let <code>k</code> be the maximum value of the bitwise AND... | Medium | 154.8K | 250.6K | 154,806 | 250,559 | 61.8% | ['number-of-different-integers-in-a-string', 'remove-colored-pieces-if-both-neighbors-are-the-same-color', 'count-number-of-maximum-bitwise-or-subsets', 'smallest-subarrays-with-maximum-bitwise-or'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestSubarray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestSubarray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | [1,2,3,3,2,2] | {
"name": "longestSubarray",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Bit Manipulation', 'Brainteaser'] |
2,420 | Find All Good Indices | find-all-good-indices | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> of size <code>n</code> and a positive integer <code>k</code>.</p>
<p>We call an index <code>i</code> in the range <code>k <= i < n - k</code> <strong>good</strong> if the following conditions are satisfied:</p>
<ul>
<li>The <code>k</... | Medium | 27.8K | 70.2K | 27,761 | 70,160 | 39.6% | ['find-good-days-to-rob-the-bank', 'abbreviating-the-product-of-a-range', 'count-the-number-of-k-big-indices'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> goodIndices(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> goodIndices(int[] nums, int k) {\n \n }\n}"}, {"value": "pyth... | [2,1,1,1,3,4,1]
2 | {
"name": "goodIndices",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "list<integer>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Prefix Sum'] |
2,421 | Number of Good Paths | number-of-good-paths | <p>There is a tree (i.e. a connected, undirected graph with no cycles) consisting of <code>n</code> nodes numbered from <code>0</code> to <code>n - 1</code> and exactly <code>n - 1</code> edges.</p>
<p>You are given a <strong>0-indexed</strong> integer array <code>vals</code> of length <code>n</code> where <code>vals[... | Hard | 59.9K | 107.1K | 59,912 | 107,104 | 55.9% | ['checking-existence-of-edge-length-limited-paths', 'checking-existence-of-edge-length-limited-paths-ii', 'longest-nice-substring', 'count-good-triplets-in-an-array', 'count-pairs-of-similar-strings'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfGoodPaths(vector<int>& vals, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfGoodPaths(int[] vals, int[][] edges) {\n \n ... | [1,3,2,1,3]
[[0,1],[0,2],[2,3],[2,4]] | {
"name": "numberOfGoodPaths",
"params": [
{
"type": "integer[]",
"name": "vals"
},
{
"type": "integer[][]",
"name": "edges"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Tree', 'Union Find', 'Graph', 'Sorting'] |
2,422 | Merge Operations to Turn Array Into a Palindrome | merge-operations-to-turn-array-into-a-palindrome | null | Medium | 17.7K | 25.6K | 17,656 | 25,585 | 69.0% | [] | [] | Algorithms | null | [4,3,2,1,2,3,1] | {
"name": "minimumOperations",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Greedy'] |
2,423 | Remove Letter To Equalize Frequency | remove-letter-to-equalize-frequency | <p>You are given a <strong>0-indexed</strong> string <code>word</code>, consisting of lowercase English letters. You need to select <strong>one</strong> index and <strong>remove</strong> the letter at that index from <code>word</code> so that the <strong>frequency</strong> of every letter present in <code>word</code> i... | Easy | 61K | 338.1K | 60,997 | 338,086 | 18.0% | ['maximum-equal-frequency', 'minimum-deletions-to-make-character-frequencies-unique'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool equalFrequency(string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean equalFrequency(String word) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | "abcc" | {
"name": "equalFrequency",
"params": [
{
"name": "word",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Counting'] |
2,424 | Longest Uploaded Prefix | longest-uploaded-prefix | <p>You are given a stream of <code>n</code> videos, each represented by a <strong>distinct</strong> number from <code>1</code> to <code>n</code> that you need to "upload" to a server. You need to implement a data structure that calculates the length of the <strong>longest uploaded prefix</strong> at various p... | Medium | 24.5K | 43.6K | 24,532 | 43,572 | 56.3% | ['design-an-ordered-stream'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class LUPrefix {\npublic:\n LUPrefix(int n) {\n \n }\n \n void upload(int video) {\n \n }\n \n int longest() {\n \n }\n};\n\n/**\n * Your LUPrefix object will be instantiated and called as such:\n * LUPrefix* obj = new LUPrefi... | ["LUPrefix","upload","longest","upload","longest","upload","longest"]
[[4],[3],[],[1],[],[2],[]] | {
"classname": "LUPrefix",
"constructor": {
"params": [
{
"type": "integer",
"name": "n"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "video"
}
],
"name": "upload",
"return": {
"type": "... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Binary Search', 'Union Find', 'Design', 'Binary Indexed Tree', 'Segment Tree', 'Heap (Priority Queue)', 'Ordered Set'] |
2,425 | Bitwise XOR of All Pairings | bitwise-xor-of-all-pairings | <p>You are given two <strong>0-indexed</strong> arrays, <code>nums1</code> and <code>nums2</code>, consisting of non-negative integers. Let there be another array, <code>nums3</code>, which contains the bitwise XOR of <strong>all pairings</strong> of integers between <code>nums1</code> and <code>nums2</code> (every int... | Medium | 145.8K | 217.6K | 145,845 | 217,554 | 67.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int xorAllNums(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int xorAllNums(int[] nums1, int[] nums2) {\n \n }\n}"}, {"value": "pyt... | [2,1,3]
[10,2,5,0] | {
"name": "xorAllNums",
"params": [
{
"name": "nums1",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "nums2"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Bit Manipulation', 'Brainteaser'] |
2,426 | Number of Pairs Satisfying Inequality | number-of-pairs-satisfying-inequality | <p>You are given two <strong>0-indexed</strong> integer arrays <code>nums1</code> and <code>nums2</code>, each of size <code>n</code>, and an integer <code>diff</code>. Find the number of <strong>pairs</strong> <code>(i, j)</code> such that:</p>
<ul>
<li><code>0 <= i < j <= n - 1</code> <strong>and</strong><... | Hard | 15.8K | 35K | 15,777 | 35,048 | 45.0% | ['k-diff-pairs-in-an-array', 'count-nice-pairs-in-an-array', 'count-number-of-bad-pairs', 'maximum-balanced-subsequence-sum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long numberOfPairs(vector<int>& nums1, vector<int>& nums2, int diff) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long numberOfPairs(int[] nums1, int[] nums2, int diff) {\n ... | [3,2,5]
[2,2,1]
1 | {
"name": "numberOfPairs",
"params": [
{
"name": "nums1",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "nums2"
},
{
"type": "integer",
"name": "diff"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Divide and Conquer', 'Binary Indexed Tree', 'Segment Tree', 'Merge Sort', 'Ordered Set'] |
2,427 | Number of Common Factors | number-of-common-factors | <p>Given two positive integers <code>a</code> and <code>b</code>, return <em>the number of <strong>common</strong> factors of </em><code>a</code><em> and </em><code>b</code>.</p>
<p>An integer <code>x</code> is a <strong>common factor</strong> of <code>a</code> and <code>b</code> if <code>x</code> divides both <code>a... | Easy | 115.4K | 145.4K | 115,440 | 145,401 | 79.4% | ['count-primes'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int commonFactors(int a, int b) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int commonFactors(int a, int b) {\n \n }\n}"}, {"value": "python", "text": "Python", "default... | 12
6 | {
"name": "commonFactors",
"params": [
{
"name": "a",
"type": "integer"
},
{
"type": "integer",
"name": "b"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Enumeration', 'Number Theory'] |
2,428 | Maximum Sum of an Hourglass | maximum-sum-of-an-hourglass | <p>You are given an <code>m x n</code> integer matrix <code>grid</code>.</p>
<p>We define an <strong>hourglass</strong> as a part of the matrix with the following form:</p>
<img alt="" src="https://assets.leetcode.com/uploads/2022/08/21/img.jpg" style="width: 243px; height: 243px;" />
<p>Return <em>the <strong>maximum... | Medium | 46.2K | 61K | 46,188 | 60,956 | 75.8% | ['matrix-block-sum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSum(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSum(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | [[6,2,1,3],[4,2,1,5],[9,2,8,7],[4,1,2,9]] | {
"name": "maxSum",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Matrix', 'Prefix Sum'] |
2,429 | Minimize XOR | minimize-xor | <p>Given two positive integers <code>num1</code> and <code>num2</code>, find the positive integer <code>x</code> such that:</p>
<ul>
<li><code>x</code> has the same number of set bits as <code>num2</code>, and</li>
<li>The value <code>x XOR num1</code> is <strong>minimal</strong>.</li>
</ul>
<p>Note that <code>XOR<... | Medium | 134.1K | 214.7K | 134,062 | 214,712 | 62.4% | ['maximum-xor-of-two-numbers-in-an-array', 'maximum-xor-with-an-element-from-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimizeXor(int num1, int num2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimizeXor(int num1, int num2) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | 3
5 | {
"name": "minimizeXor",
"params": [
{
"name": "num1",
"type": "integer"
},
{
"type": "integer",
"name": "num2"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Greedy', 'Bit Manipulation'] |
2,430 | Maximum Deletions on a String | maximum-deletions-on-a-string | <p>You are given a string <code>s</code> consisting of only lowercase English letters. In one operation, you can:</p>
<ul>
<li>Delete <strong>the entire string</strong> <code>s</code>, or</li>
<li>Delete the <strong>first</strong> <code>i</code> letters of <code>s</code> if the first <code>i</code> letters of <code>... | Hard | 15.5K | 45K | 15,464 | 45,005 | 34.4% | ['shortest-palindrome', 'longest-happy-prefix', 'remove-all-occurrences-of-a-substring'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int deleteString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int deleteString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cl... | "abcabcdabc" | {
"name": "deleteString",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming', 'Rolling Hash', 'String Matching', 'Hash Function'] |
2,431 | Maximize Total Tastiness of Purchased Fruits | maximize-total-tastiness-of-purchased-fruits | null | Medium | 3.4K | 5.3K | 3,414 | 5,301 | 64.4% | [] | [] | Algorithms | null | [10,20,20]
[5,8,8]
20
1 | {
"name": "maxTastiness",
"params": [
{
"name": "price",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "tastiness"
},
{
"type": "integer",
"name": "maxAmount"
},
{
"type": "integer",
"name": "maxCoupons"
}
],
"return": {
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming'] |
2,432 | The Employee That Worked on the Longest Task | the-employee-that-worked-on-the-longest-task | <p>There are <code>n</code> employees, each with a unique id from <code>0</code> to <code>n - 1</code>.</p>
<p>You are given a 2D integer array <code>logs</code> where <code>logs[i] = [id<sub>i</sub>, leaveTime<sub>i</sub>]</code> where:</p>
<ul>
<li><code>id<sub>i</sub></code> is the id of the employee that worked ... | Easy | 39.2K | 77.9K | 39,242 | 77,862 | 50.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int hardestWorker(int n, vector<vector<int>>& logs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int hardestWorker(int n, int[][] logs) {\n \n }\n}"}, {"value": "python",... | 10
[[0,3],[2,5],[0,9],[1,15]] | {
"name": "hardestWorker",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "logs"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array'] |
2,433 | Find The Original Array of Prefix Xor | find-the-original-array-of-prefix-xor | <p>You are given an <strong>integer</strong> array <code>pref</code> of size <code>n</code>. Find and return <em>the array </em><code>arr</code><em> of size </em><code>n</code><em> that satisfies</em>:</p>
<ul>
<li><code>pref[i] = arr[0] ^ arr[1] ^ ... ^ arr[i]</code>.</li>
</ul>
<p>Note that <code>^</code> denotes ... | Medium | 165.7K | 188.2K | 165,719 | 188,172 | 88.1% | ['single-number-iii', 'count-triplets-that-can-form-two-arrays-of-equal-xor', 'decode-xored-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findArray(vector<int>& pref) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findArray(int[] pref) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [5,2,0,3,1] | {
"name": "findArray",
"params": [
{
"name": "pref",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Bit Manipulation'] |
2,434 | Using a Robot to Print the Lexicographically Smallest String | using-a-robot-to-print-the-lexicographically-smallest-string | <p>You are given a string <code>s</code> and a robot that currently holds an empty string <code>t</code>. Apply one of the following operations until <code>s</code> and <code>t</code> <strong>are both empty</strong>:</p>
<ul>
<li>Remove the <strong>first</strong> character of a string <code>s</code> and give it to th... | Medium | 22.2K | 53.6K | 22,176 | 53,571 | 41.4% | ['find-permutation'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string robotWithString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String robotWithString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau... | "zza" | {
"name": "robotWithString",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Stack', 'Greedy'] |
2,435 | Paths in Matrix Whose Sum Is Divisible by K | paths-in-matrix-whose-sum-is-divisible-by-k | <p>You are given a <strong>0-indexed</strong> <code>m x n</code> integer matrix <code>grid</code> and an integer <code>k</code>. You are currently at position <code>(0, 0)</code> and you want to reach position <code>(m - 1, n - 1)</code> moving only <strong>down</strong> or <strong>right</strong>.</p>
<p>Return<em> th... | Hard | 27.1K | 61.8K | 27,096 | 61,775 | 43.9% | ['unique-paths', 'unique-paths-ii', 'minimum-path-sum', 'dungeon-game', 'cherry-pickup', 'shortest-path-in-binary-matrix', 'minimum-cost-homecoming-of-a-robot-in-a-grid', 'check-if-there-is-a-path-with-equal-number-of-0s-and-1s'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfPaths(vector<vector<int>>& grid, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfPaths(int[][] grid, int k) {\n \n }\n}"}, {"value": "python",... | [[5,2,4],[3,0,5],[0,7,2]]
3 | {
"name": "numberOfPaths",
"params": [
{
"name": "grid",
"type": "integer[][]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Matrix'] |
2,436 | Minimum Split Into Subarrays With GCD Greater Than One | minimum-split-into-subarrays-with-gcd-greater-than-one | null | Medium | 2.6K | 3.7K | 2,609 | 3,729 | 70.0% | ['minimum-subarrays-in-a-valid-split'] | [] | Algorithms | null | [12,6,3,14,8] | {
"name": "minimumSplits",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Dynamic Programming', 'Greedy', 'Number Theory'] |
2,437 | Number of Valid Clock Times | number-of-valid-clock-times | <p>You are given a string of length <code>5</code> called <code>time</code>, representing the current time on a digital clock in the format <code>"hh:mm"</code>. The <strong>earliest</strong> possible time is <code>"00:00"</code> and the <strong>latest</strong> possible time is <code>"23:59&quo... | Easy | 35.1K | 74.3K | 35,123 | 74,263 | 47.3% | ['largest-time-for-given-digits', 'latest-time-by-replacing-hidden-digits'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countTime(string time) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countTime(String time) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cl... | "?5:00" | {
"name": "countTime",
"params": [
{
"name": "time",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Enumeration'] |
2,438 | Range Product Queries of Powers | range-product-queries-of-powers | <p>Given a positive integer <code>n</code>, there exists a <strong>0-indexed</strong> array called <code>powers</code>, composed of the <strong>minimum</strong> number of powers of <code>2</code> that sum to <code>n</code>. The array is sorted in <strong>non-decreasing</strong> order, and there is <strong>only one</str... | Medium | 18.4K | 44.1K | 18,375 | 44,124 | 41.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> productQueries(int n, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] productQueries(int n, int[][] queries) {\n \n }\n}"}, {... | 15
[[0,1],[2,2],[0,3]] | {
"name": "productQueries",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "queries"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Bit Manipulation', 'Prefix Sum'] |
2,439 | Minimize Maximum of Array | minimize-maximum-of-array | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> comprising of <code>n</code> non-negative integers.</p>
<p>In one operation, you must:</p>
<ul>
<li>Choose an integer <code>i</code> such that <code>1 <= i < n</code> and <code>nums[i] > 0</code>.</li>
<li>Decrease <code>nums[i]</code> b... | Medium | 89.8K | 193.6K | 89,850 | 193,563 | 46.4% | ['maximum-candies-allocated-to-k-children', 'minimum-speed-to-arrive-on-time', 'minimum-time-to-complete-trips'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimizeArrayValue(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimizeArrayValue(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [3,7,1,6] | {
"name": "minimizeArrayValue",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Dynamic Programming', 'Greedy', 'Prefix Sum'] |
2,440 | Create Components With Same Value | create-components-with-same-value | <p>There is an undirected tree with <code>n</code> nodes labeled from <code>0</code> to <code>n - 1</code>.</p>
<p>You are given a <strong>0-indexed</strong> integer array <code><font face="monospace">nums</font></code> of length <code>n</code> where <code>nums[i]</code> represents the value of the <code>i<sup>th</sup... | Hard | 8.7K | 16.7K | 8,703 | 16,726 | 52.0% | ['equal-tree-partition', 'maximum-number-of-k-divisible-components'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int componentValue(vector<int>& nums, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int componentValue(int[] nums, int[][] edges) {\n \n }\n}"}... | [6,2,2,2,6]
[[0,1],[1,2],[1,3],[3,4]] | {
"name": "componentValue",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer[][]",
"name": "edges"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Tree', 'Depth-First Search', 'Enumeration'] |
2,441 | Largest Positive Integer That Exists With Its Negative | largest-positive-integer-that-exists-with-its-negative | <p>Given an integer array <code>nums</code> that <strong>does not contain</strong> any zeros, find <strong>the largest positive</strong> integer <code>k</code> such that <code>-k</code> also exists in the array.</p>
<p>Return <em>the positive integer </em><code>k</code>. If there is no such integer, return <code>-1</c... | Easy | 243.4K | 325.8K | 243,388 | 325,814 | 74.7% | ['two-sum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMaxK(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMaxK(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ... | [-1,2,-3,3] | {
"name": "findMaxK",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Two Pointers', 'Sorting'] |
2,442 | Count Number of Distinct Integers After Reverse Operations | count-number-of-distinct-integers-after-reverse-operations | <p>You are given an array <code>nums</code> consisting of <strong>positive</strong> integers.</p>
<p>You have to take each integer in the array, <strong>reverse its digits</strong>, and add it to the end of the array. You should apply this operation to the original integers in <code>nums</code>.</p>
<p>Return <em>the... | Medium | 80K | 100K | 80,013 | 100,033 | 80.0% | ['reverse-integer'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countDistinctIntegers(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countDistinctIntegers(int[] nums) {\n \n }\n}"}, {"value": "python", "text":... | [1,13,10,12,31] | {
"name": "countDistinctIntegers",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Math', 'Counting'] |
2,443 | Sum of Number and Its Reverse | sum-of-number-and-its-reverse | <p>Given a <strong>non-negative</strong> integer <code>num</code>, return <code>true</code><em> if </em><code>num</code><em> can be expressed as the sum of any <strong>non-negative</strong> integer and its reverse, or </em><code>false</code><em> otherwise.</em></p>
<p> </p>
<p><strong class="example">Example 1:</... | Medium | 40.6K | 84.6K | 40,620 | 84,621 | 48.0% | ['sum-of-numbers-with-units-digit-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool sumOfNumberAndReverse(int num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean sumOfNumberAndReverse(int num) {\n \n }\n}"}, {"value": "python", "text": "Python... | 443 | {
"name": "sumOfNumberAndReverse",
"params": [
{
"name": "num",
"type": "integer"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Enumeration'] |
2,444 | Count Subarrays With Fixed Bounds | count-subarrays-with-fixed-bounds | <p>You are given an integer array <code>nums</code> and two integers <code>minK</code> and <code>maxK</code>.</p>
<p>A <strong>fixed-bound subarray</strong> of <code>nums</code> is a subarray that satisfies the following conditions:</p>
<ul>
<li>The <strong>minimum</strong> value in the subarray is equal to <code>mi... | Hard | 152.7K | 225.6K | 152,679 | 225,586 | 67.7% | ['count-number-of-nice-subarrays', 'longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit', 'find-the-number-of-subarrays-where-boundary-elements-are-maximum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countSubarrays(vector<int>& nums, int minK, int maxK) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countSubarrays(int[] nums, int minK, int maxK) {\n \n }\... | [1,3,5,2,7,5]
1
5 | {
"name": "countSubarrays",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "minK"
},
{
"type": "integer",
"name": "maxK"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Queue', 'Sliding Window', 'Monotonic Queue'] |
2,445 | Number of Nodes With Value One | number-of-nodes-with-value-one | null | Medium | 2.4K | 3.7K | 2,432 | 3,708 | 65.6% | [] | [] | Algorithms | null | 5
[1,2,5] | {
"name": "numberOfNodes",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[]",
"name": "queries"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
2,446 | Determine if Two Events Have Conflict | determine-if-two-events-have-conflict | <p>You are given two arrays of strings that represent two inclusive events that happened <strong>on the same day</strong>, <code>event1</code> and <code>event2</code>, where:</p>
<ul>
<li><code>event1 = [startTime<sub>1</sub>, endTime<sub>1</sub>]</code> and</li>
<li><code>event2 = [startTime<sub>2</sub>, endTime<su... | Easy | 55.1K | 105.6K | 55,056 | 105,584 | 52.1% | ['merge-intervals', 'non-overlapping-intervals', 'my-calendar-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool haveConflict(vector<string>& event1, vector<string>& event2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean haveConflict(String[] event1, String[] event2) {\n \n ... | ["01:15","02:00"]
["02:00","03:00"] | {
"name": "haveConflict",
"params": [
{
"name": "event1",
"type": "string[]"
},
{
"type": "string[]",
"name": "event2"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String'] |
2,447 | Number of Subarrays With GCD Equal to K | number-of-subarrays-with-gcd-equal-to-k | <p>Given an integer array <code>nums</code> and an integer <code>k</code>, return <em>the number of <strong>subarrays</strong> of </em><code>nums</code><em> where the greatest common divisor of the subarray's elements is </em><code>k</code>.</p>
<p>A <strong>subarray</strong> is a contiguous non-empty sequence of ... | Medium | 29.5K | 58K | 29,464 | 57,962 | 50.8% | ['find-greatest-common-divisor-of-array', 'number-of-subarrays-with-lcm-equal-to-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int subarrayGCD(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int subarrayGCD(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [9,3,1,2,6,3]
3 | {
"name": "subarrayGCD",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Number Theory'] |
2,448 | Minimum Cost to Make Array Equal | minimum-cost-to-make-array-equal | <p>You are given two <strong>0-indexed</strong> arrays <code>nums</code> and <code>cost</code> consisting each of <code>n</code> <strong>positive</strong> integers.</p>
<p>You can do the following operation <strong>any</strong> number of times:</p>
<ul>
<li>Increase or decrease <strong>any</strong> element of the ar... | Hard | 71K | 153.7K | 70,974 | 153,694 | 46.2% | ['minimum-moves-to-equal-array-elements-ii', 'maximum-product-of-the-length-of-two-palindromic-substrings', 'minimum-amount-of-time-to-fill-cups', 'minimum-operations-to-make-all-array-elements-equal', 'minimum-cost-to-make-array-equalindromic'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minCost(vector<int>& nums, vector<int>& cost) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minCost(int[] nums, int[] cost) {\n \n }\n}"}, {"value": "python... | [1,3,5,2]
[2,3,1,14] | {
"name": "minCost",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "cost"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Greedy', 'Sorting', 'Prefix Sum'] |
2,449 | Minimum Number of Operations to Make Arrays Similar | minimum-number-of-operations-to-make-arrays-similar | <p>You are given two positive integer arrays <code>nums</code> and <code>target</code>, of the same length.</p>
<p>In one operation, you can choose any two <strong>distinct</strong> indices <code>i</code> and <code>j</code> where <code>0 <= i, j < nums.length</code> and:</p>
<ul>
<li>set <code>nums[i] = nums[i... | Hard | 14.7K | 24.4K | 14,670 | 24,366 | 60.2% | ['minimum-operations-to-make-array-equal', 'minimum-operations-to-make-array-equal-ii', 'rearranging-fruits'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long makeSimilar(vector<int>& nums, vector<int>& target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long makeSimilar(int[] nums, int[] target) {\n \n }\n}"}, {"val... | [8,12,6]
[2,14,10] | {
"name": "makeSimilar",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "target"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Sorting'] |
2,450 | Number of Distinct Binary Strings After Applying Operations | number-of-distinct-binary-strings-after-applying-operations | null | Medium | 1.2K | 1.9K | 1,227 | 1,934 | 63.4% | ['minimum-number-of-k-consecutive-bit-flips'] | [] | Algorithms | null | "1001"
3 | {
"name": "countDistinctStrings",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'String'] |
2,451 | Odd String Difference | odd-string-difference | <p>You are given an array of equal-length strings <code>words</code>. Assume that the length of each string is <code>n</code>.</p>
<p>Each string <code>words[i]</code> can be converted into a <strong>difference integer array</strong> <code>difference[i]</code> of length <code>n - 1</code> where <code>difference[i][j] ... | Easy | 37.2K | 61.2K | 37,243 | 61,242 | 60.8% | ['minimum-rounds-to-complete-all-tasks'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string oddString(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String oddString(String[] words) {\n \n }\n}"}, {"value": "python", "text": "Python",... | ["adc","wzy","abc"] | {
"name": "oddString",
"params": [
{
"name": "words",
"type": "string[]"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String'] |
2,452 | Words Within Two Edits of Dictionary | words-within-two-edits-of-dictionary | <p>You are given two string arrays, <code>queries</code> and <code>dictionary</code>. All words in each array comprise of lowercase English letters and have the same length.</p>
<p>In one <strong>edit</strong> you can take a word from <code>queries</code>, and change any letter in it to any other letter. Find all word... | Medium | 25.7K | 42K | 25,702 | 42,011 | 61.2% | ['word-ladder'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> twoEditWords(vector<string>& queries, vector<string>& dictionary) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> twoEditWords(String[] queries, String[] d... | ["word","note","ants","wood"]
["wood","joke","moat"] | {
"name": "twoEditWords",
"params": [
{
"name": "queries",
"type": "string[]"
},
{
"type": "string[]",
"name": "dictionary"
}
],
"return": {
"type": "list<string>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Trie'] |
2,453 | Destroy Sequential Targets | destroy-sequential-targets | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> consisting of positive integers, representing targets on a number line. You are also given an integer <code>space</code>.</p>
<p>You have a machine which can destroy targets. <strong>Seeding</strong> the machine with some <code>nums[i]</code> allows... | Medium | 20.3K | 50.3K | 20,316 | 50,347 | 40.4% | ['arithmetic-slices-ii-subsequence', 'pairs-of-songs-with-total-durations-divisible-by-60', 'longest-arithmetic-subsequence', 'longest-arithmetic-subsequence-of-given-difference'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int destroyTargets(vector<int>& nums, int space) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int destroyTargets(int[] nums, int space) {\n \n }\n}"}, {"value": "python",... | [3,7,8,1,1,5]
2 | {
"name": "destroyTargets",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "space"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Counting'] |
2,454 | Next Greater Element IV | next-greater-element-iv | <p>You are given a <strong>0-indexed</strong> array of non-negative integers <code>nums</code>. For each integer in <code>nums</code>, you must find its respective <strong>second greater</strong> integer.</p>
<p>The <strong>second greater</strong> integer of <code>nums[i]</code> is <code>nums[j]</code> such that:</p>
... | Hard | 13.8K | 34.7K | 13,795 | 34,747 | 39.7% | ['next-greater-element-i', 'replace-elements-with-greatest-element-on-right-side', 'apply-operations-to-maximize-score'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> secondGreaterElement(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] secondGreaterElement(int[] nums) {\n \n }\n}"}, {"value": "python",... | [2,4,0,9,6] | {
"name": "secondGreaterElement",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Stack', 'Sorting', 'Heap (Priority Queue)', 'Monotonic Stack'] |
2,455 | Average Value of Even Numbers That Are Divisible by Three | average-value-of-even-numbers-that-are-divisible-by-three | <p>Given an integer array <code>nums</code> of <strong>positive</strong> integers, return <em>the average value of all even integers that are divisible by</em> <code>3</code><i>.</i></p>
<p>Note that the <strong>average</strong> of <code>n</code> elements is the <strong>sum</strong> of the <code>n</code> elements divi... | Easy | 72.8K | 119.1K | 72,813 | 119,078 | 61.1% | ['binary-prefix-divisible-by-5'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int averageValue(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int averageValue(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | [1,3,6,10,12,15] | {
"name": "averageValue",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math'] |
2,456 | Most Popular Video Creator | most-popular-video-creator | <p>You are given two string arrays <code>creators</code> and <code>ids</code>, and an integer array <code>views</code>, all of length <code>n</code>. The <code>i<sup>th</sup></code> video on a platform was created by <code>creators[i]</code>, has an id of <code>ids[i]</code>, and has <code>views[i]</code> views.</p>
<... | Medium | 25.4K | 57.4K | 25,426 | 57,367 | 44.3% | ['design-video-sharing-platform', 'design-a-food-rating-system'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<string>> mostPopularCreator(vector<string>& creators, vector<string>& ids, vector<int>& views) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<String>> mostPop... | ["alice","bob","alice","chris"]
["one","two","three","four"]
[5,10,5,4] | {
"name": "mostPopularCreator",
"params": [
{
"name": "creators",
"type": "string[]"
},
{
"type": "string[]",
"name": "ids"
},
{
"type": "integer[]",
"name": "views"
}
],
"return": {
"type": "list<list<string>>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Sorting', 'Heap (Priority Queue)'] |
2,457 | Minimum Addition to Make Integer Beautiful | minimum-addition-to-make-integer-beautiful | <p>You are given two positive integers <code>n</code> and <code>target</code>.</p>
<p>An integer is considered <strong>beautiful</strong> if the sum of its digits is less than or equal to <code>target</code>.</p>
<p>Return the <em>minimum <strong>non-negative</strong> integer </em><code>x</code><em> such that </em><c... | Medium | 22.2K | 58.7K | 22,202 | 58,667 | 37.8% | ['happy-number'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long makeIntegerBeautiful(long long n, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long makeIntegerBeautiful(long n, int target) {\n \n }\n}"}, {"value"... | 16
6 | {
"name": "makeIntegerBeautiful",
"params": [
{
"name": "n",
"type": "long"
},
{
"type": "integer",
"name": "target"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Greedy'] |
2,458 | Height of Binary Tree After Subtree Removal Queries | height-of-binary-tree-after-subtree-removal-queries | <p>You are given the <code>root</code> of a <strong>binary tree</strong> with <code>n</code> nodes. Each node is assigned a unique value from <code>1</code> to <code>n</code>. You are also given an array <code>queries</code> of size <code>m</code>.</p>
<p>You have to perform <code>m</code> <strong>independent</strong>... | Hard | 101K | 183.8K | 100,958 | 183,796 | 54.9% | ['maximum-depth-of-binary-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,3,4,2,null,6,5,null,null,null,null,null,7]
[4] | {
"name": "treeQueries",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"type": "integer[]",
"name": "queries"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
2,459 | Sort Array by Moving Items to Empty Space | sort-array-by-moving-items-to-empty-space | null | Hard | 2.4K | 5.5K | 2,448 | 5,499 | 44.5% | ['course-schedule-ii', 'strange-printer-ii', 'create-sorted-array-through-instructions'] | [] | Algorithms | null | [4,2,0,3,1] | {
"name": "sortArray",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Sorting'] |
2,460 | Apply Operations to an Array | apply-operations-to-an-array | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> of size <code>n</code> consisting of <strong>non-negative</strong> integers.</p>
<p>You need to apply <code>n - 1</code> operations to this array where, in the <code>i<sup>th</sup></code> operation (<strong>0-indexed</strong>), you will apply the fo... | Easy | 235.7K | 314.8K | 235,718 | 314,798 | 74.9% | ['remove-duplicates-from-sorted-array', 'move-zeroes'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> applyOperations(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] applyOperations(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "... | [1,2,2,1,1,0] | {
"name": "applyOperations",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Simulation'] |
2,461 | Maximum Sum of Distinct Subarrays With Length K | maximum-sum-of-distinct-subarrays-with-length-k | <p>You are given an integer array <code>nums</code> and an integer <code>k</code>. Find the maximum subarray sum of all the subarrays of <code>nums</code> that meet the following conditions:</p>
<ul>
<li>The length of the subarray is <code>k</code>, and</li>
<li>All the elements of the subarray are <strong>distinct<... | Medium | 201.7K | 472.6K | 201,681 | 472,603 | 42.7% | ['max-consecutive-ones-iii', 'longest-nice-subarray', 'optimal-partition-of-string', 'count-the-number-of-good-subarrays', 'maximum-good-subarray-sum', 'find-the-power-of-k-size-subarrays-i', 'find-the-power-of-k-size-subarrays-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumSubarraySum(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumSubarraySum(int[] nums, int k) {\n \n }\n}"}, {"value": "p... | [1,5,4,2,9,9,9]
3 | {
"name": "maximumSubarraySum",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sliding Window'] |
2,462 | Total Cost to Hire K Workers | total-cost-to-hire-k-workers | <p>You are given a <strong>0-indexed</strong> integer array <code>costs</code> where <code>costs[i]</code> is the cost of hiring the <code>i<sup>th</sup></code> worker.</p>
<p>You are also given two integers <code>k</code> and <code>candidates</code>. We want to hire exactly <code>k</code> workers according to the fol... | Medium | 133.5K | 310.8K | 133,468 | 310,787 | 42.9% | ['meeting-rooms-ii', 'time-to-cross-a-bridge'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long totalCost(vector<int>& costs, int k, int candidates) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long totalCost(int[] costs, int k, int candidates) {\n \n }\n}... | [17,12,10,2,7,2,11,20,8]
3
4 | {
"name": "totalCost",
"params": [
{
"name": "costs",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
},
{
"type": "integer",
"name": "candidates"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Heap (Priority Queue)', 'Simulation'] |
2,463 | Minimum Total Distance Traveled | minimum-total-distance-traveled | <p>There are some robots and factories on the X-axis. You are given an integer array <code>robot</code> where <code>robot[i]</code> is the position of the <code>i<sup>th</sup></code> robot. You are also given a 2D integer array <code>factory</code> where <code>factory[j] = [position<sub>j</sub>, limit<sub>j</sub>]</cod... | Hard | 73.5K | 124.5K | 73,500 | 124,469 | 59.1% | ['capacity-to-ship-packages-within-d-days', 'number-of-ways-to-earn-points'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumTotalDistance(vector<int>& robot, vector<vector<int>>& factory) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumTotalDistance(List<Integer> robot, int[][]... | [0,4,6]
[[2,2],[6,2]] | {
"name": "minimumTotalDistance",
"params": [
{
"name": "robot",
"type": "list<integer>"
},
{
"type": "integer[][]",
"name": "factory"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Sorting'] |
2,464 | Minimum Subarrays in a Valid Split | minimum-subarrays-in-a-valid-split | null | Medium | 1.4K | 2.5K | 1,377 | 2,532 | 54.4% | ['minimum-split-into-subarrays-with-gcd-greater-than-one'] | [] | Algorithms | null | [2,6,3,4,3] | {
"name": "validSubarraySplit",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Dynamic Programming', 'Number Theory'] |
2,465 | Number of Distinct Averages | number-of-distinct-averages | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> of <strong>even</strong> length.</p>
<p>As long as <code>nums</code> is <strong>not</strong> empty, you must repetitively:</p>
<ul>
<li>Find the minimum number in <code>nums</code> and remove it.</li>
<li>Find the maximum number in <code>... | Easy | 59.7K | 102.3K | 59,674 | 102,253 | 58.4% | ['two-sum', 'finding-pairs-with-a-certain-sum', 'minimum-average-of-smallest-and-largest-elements'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int distinctAverages(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int distinctAverages(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [4,1,4,0,3,5] | {
"name": "distinctAverages",
"params": [
{
"type": "integer[]",
"name": "nums"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Two Pointers', 'Sorting'] |
2,466 | Count Ways To Build Good Strings | count-ways-to-build-good-strings | <p>Given the integers <code>zero</code>, <code>one</code>, <code>low</code>, and <code>high</code>, we can construct a string by starting with an empty string, and then at each step perform either of the following:</p>
<ul>
<li>Append the character <code>'0'</code> <code>zero</code> times.</li>
<li>Append th... | Medium | 168.3K | 284K | 168,280 | 283,998 | 59.3% | ['climbing-stairs'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countGoodStrings(int low, int high, int zero, int one) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countGoodStrings(int low, int high, int zero, int one) {\n \n ... | 3
3
1
1 | {
"name": "countGoodStrings",
"params": [
{
"name": "low",
"type": "integer"
},
{
"type": "integer",
"name": "high"
},
{
"type": "integer",
"name": "zero"
},
{
"type": "integer",
"name": "one"
}
],
"return": {
"type": "integer"
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming'] |
2,467 | Most Profitable Path in a Tree | most-profitable-path-in-a-tree | <p>There is an undirected tree with <code>n</code> nodes labeled from <code>0</code> to <code>n - 1</code>, rooted at node <code>0</code>. You are given a 2D integer array <code>edges</code> of length <code>n - 1</code> where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates that there is an edge between... | Medium | 100.6K | 148.4K | 100,599 | 148,393 | 67.8% | ['snakes-and-ladders', 'time-taken-to-mark-all-nodes'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int mostProfitablePath(vector<vector<int>>& edges, int bob, vector<int>& amount) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int mostProfitablePath(int[][] edges, int bob, int[] a... | [[0,1],[1,2],[1,3],[3,4]]
3
[-2,4,2,-4,6] | {
"name": "mostProfitablePath",
"params": [
{
"name": "edges",
"type": "integer[][]"
},
{
"type": "integer",
"name": "bob"
},
{
"type": "integer[]",
"name": "amount"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Graph'] |
2,468 | Split Message Based on Limit | split-message-based-on-limit | <p>You are given a string, <code>message</code>, and a positive integer, <code>limit</code>.</p>
<p>You must <strong>split</strong> <code>message</code> into one or more <strong>parts</strong> based on <code>limit</code>. Each resulting part should have the suffix <code>"<a/b>"</code>, where <code>&quo... | Hard | 16.6K | 38.6K | 16,603 | 38,633 | 43.0% | ['text-justification', 'search-a-2d-matrix', 'sentence-screen-fitting'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> splitMessage(string message, int limit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String[] splitMessage(String message, int limit) {\n \n }\n}"}, {"valu... | "this is really a very awesome message"
9 | {
"name": "splitMessage",
"params": [
{
"name": "message",
"type": "string"
},
{
"type": "integer",
"name": "limit"
}
],
"return": {
"type": "string[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Binary Search', 'Enumeration'] |
2,469 | Convert the Temperature | convert-the-temperature | <p>You are given a non-negative floating point number rounded to two decimal places <code>celsius</code>, that denotes the <strong>temperature in Celsius</strong>.</p>
<p>You should convert Celsius into <strong>Kelvin</strong> and <strong>Fahrenheit</strong> and return it as an array <code>ans = [kelvin, fahrenheit]</... | Easy | 240.3K | 266.8K | 240,272 | 266,802 | 90.1% | ['smallest-even-multiple'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<double> convertTemperature(double celsius) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double[] convertTemperature(double celsius) {\n \n }\n}"}, {"value": "pytho... | 36.50 | {
"name": "convertTemperature",
"params": [
{
"name": "celsius",
"type": "double"
}
],
"return": {
"type": "double[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math'] |
2,470 | Number of Subarrays With LCM Equal to K | number-of-subarrays-with-lcm-equal-to-k | <p>Given an integer array <code>nums</code> and an integer <code>k</code>, return <em>the number of <strong>subarrays</strong> of </em><code>nums</code><em> where the least common multiple of the subarray's elements is </em><code>k</code>.</p>
<p>A <strong>subarray</strong> is a contiguous non-empty sequence of el... | Medium | 24.8K | 62.7K | 24,827 | 62,682 | 39.6% | ['number-of-subarrays-with-gcd-equal-to-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int subarrayLCM(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int subarrayLCM(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [3,6,2,7,1]
6 | {
"name": "subarrayLCM",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Number Theory'] |
2,471 | Minimum Number of Operations to Sort a Binary Tree by Level | minimum-number-of-operations-to-sort-a-binary-tree-by-level | <p>You are given the <code>root</code> of a binary tree with <strong>unique values</strong>.</p>
<p>In one operation, you can choose any two nodes <strong>at the same level</strong> and swap their values.</p>
<p>Return <em>the minimum number of operations needed to make the values at each level sorted in a <strong>st... | Medium | 106.3K | 143.1K | 106,262 | 143,060 | 74.3% | ['binary-tree-level-order-traversal', 'longest-cycle-in-a-graph'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,4,3,7,6,8,5,null,null,null,null,9,null,10] | {
"name": "minimumOperations",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Breadth-First Search', 'Binary Tree'] |
2,472 | Maximum Number of Non-overlapping Palindrome Substrings | maximum-number-of-non-overlapping-palindrome-substrings | <p>You are given a string <code>s</code> and a <strong>positive</strong> integer <code>k</code>.</p>
<p>Select a set of <strong>non-overlapping</strong> substrings from the string <code>s</code> that satisfy the following conditions:</p>
<ul>
<li>The <strong>length</strong> of each substring is <strong>at least</str... | Hard | 19K | 46K | 18,990 | 46,005 | 41.3% | ['longest-palindromic-substring', 'palindrome-partitioning', 'palindrome-partitioning-ii', 'palindrome-partitioning-iii', 'maximum-number-of-non-overlapping-substrings', 'palindrome-partitioning-iv'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxPalindromes(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxPalindromes(String s, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | "abaccdbbd"
3 | {
"name": "maxPalindromes",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String', 'Dynamic Programming', 'Greedy'] |
2,473 | Minimum Cost to Buy Apples | minimum-cost-to-buy-apples | null | Medium | 6.8K | 10.1K | 6,773 | 10,081 | 67.2% | [] | [] | Algorithms | null | 4
[[1,2,4],[2,3,2],[2,4,5],[3,4,1],[1,3,4]]
[56,42,102,301]
2 | {
"name": "minCost",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "roads"
},
{
"type": "integer[]",
"name": "appleCost"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "long[]"
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Graph', 'Heap (Priority Queue)', 'Shortest Path'] |
2,474 | Customers With Strictly Increasing Purchases | customers-with-strictly-increasing-purchases | null | Hard | 4.5K | 9.3K | 4,482 | 9,347 | 48.0% | ['report-contiguous-dates', 'find-the-start-and-end-number-of-continuous-ranges'] | ['Create table If Not Exists Orders (order_id int, customer_id int, order_date date, price int)', 'Truncate table Orders', "insert into Orders (order_id, customer_id, order_date, price) values ('1', '1', '2019-07-01', '1100')", "insert into Orders (order_id, customer_id, order_date, price) values ('2', '1', '2019-11-01... | Database | null | {"headers": {"Orders": ["order_id", "customer_id", "order_date", "price"]}, "rows": {"Orders": [[1, 1, "2019-07-01", 1100], [2, 1, "2019-11-01", 1200], [3, 1, "2020-05-26", 3000], [4, 1, "2021-08-31", 3100], [5, 1, "2022-12-07", 4700], [6, 2, "2015-01-01", 700], [7, 2, "2017-11-07", 1000], [8, 3, "2017-01-01", 900], [9... | {"mysql": ["Create table If Not Exists Orders (order_id int, customer_id int, order_date date, price int)"], "mssql": ["Create table Orders (order_id int, customer_id int, order_date date, price int)"], "oraclesql": ["Create table Orders (order_id int, customer_id int, order_date date, price int)", "ALTER SESSION SET n... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
2,475 | Number of Unequal Triplets in Array | number-of-unequal-triplets-in-array | <p>You are given a <strong>0-indexed</strong> array of positive integers <code>nums</code>. Find the number of triplets <code>(i, j, k)</code> that meet the following conditions:</p>
<ul>
<li><code>0 <= i < j < k < nums.length</code></li>
<li><code>nums[i]</code>, <code>nums[j]</code>, and <code>nums[k]<... | Easy | 50.6K | 70.2K | 50,568 | 70,174 | 72.1% | ['count-good-triplets', 'count-square-sum-triples', 'number-of-arithmetic-triplets'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int unequalTriplets(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int unequalTriplets(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | [4,4,2,4,3] | {
"name": "unequalTriplets",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sorting'] |
2,476 | Closest Nodes Queries in a Binary Search Tree | closest-nodes-queries-in-a-binary-search-tree | <p>You are given the <code>root</code> of a <strong>binary search tree </strong>and an array <code>queries</code> of size <code>n</code> consisting of positive integers.</p>
<p>Find a <strong>2D</strong> array <code>answer</code> of size <code>n</code> where <code>answer[i] = [min<sub>i</sub>, max<sub>i</sub>]</code>:... | Medium | 29.9K | 70.8K | 29,868 | 70,826 | 42.2% | ['closest-binary-search-tree-value', 'closest-binary-search-tree-value-ii', 'search-in-a-binary-search-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [6,2,13,1,4,9,15,null,null,null,null,null,null,14]
[2,5,16] | {
"name": "closestNodes",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"type": "list<integer>",
"name": "queries"
}
],
"return": {
"type": "list<list<integer>>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Tree', 'Depth-First Search', 'Binary Search Tree', 'Binary Tree'] |
2,477 | Minimum Fuel Cost to Report to the Capital | minimum-fuel-cost-to-report-to-the-capital | <p>There is a tree (i.e., a connected, undirected graph with no cycles) structure country network consisting of <code>n</code> cities numbered from <code>0</code> to <code>n - 1</code> and exactly <code>n - 1</code> roads. The capital city is city <code>0</code>. You are given a 2D integer array <code>roads</code> wher... | Medium | 78.1K | 121.6K | 78,107 | 121,632 | 64.2% | ['binary-tree-postorder-traversal'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumFuelCost(vector<vector<int>>& roads, int seats) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumFuelCost(int[][] roads, int seats) {\n \n }\n}"}... | [[0,1],[0,2],[0,3]]
5 | {
"name": "minimumFuelCost",
"params": [
{
"name": "roads",
"type": "integer[][]"
},
{
"type": "integer",
"name": "seats"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Graph'] |
2,478 | Number of Beautiful Partitions | number-of-beautiful-partitions | <p>You are given a string <code>s</code> that consists of the digits <code>'1'</code> to <code>'9'</code> and two integers <code>k</code> and <code>minLength</code>.</p>
<p>A partition of <code>s</code> is called <strong>beautiful</strong> if:</p>
<ul>
<li><code>s</code> is partitioned into <code>k</... | Hard | 11.9K | 37K | 11,864 | 37,038 | 32.0% | ['restore-the-array', 'number-of-ways-to-separate-numbers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int beautifulPartitions(string s, int k, int minLength) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int beautifulPartitions(String s, int k, int minLength) {\n \n }\n}"}... | "23542185131"
3
2 | {
"name": "beautifulPartitions",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "integer",
"name": "k"
},
{
"type": "integer",
"name": "minLength"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
2,479 | Maximum XOR of Two Non-Overlapping Subtrees | maximum-xor-of-two-non-overlapping-subtrees | null | Hard | 806 | 1.6K | 806 | 1,630 | 49.4% | [] | [] | Algorithms | null | 6
[[0,1],[0,2],[1,3],[1,4],[2,5]]
[2,8,3,6,2,5] | {
"name": "maxXor",
"params": [
{
"type": "integer",
"name": "n"
},
{
"type": "integer[][]",
"name": "edges"
},
{
"type": "integer[]",
"name": "values"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Graph', 'Trie'] |
2,480 | Form a Chemical Bond | form-a-chemical-bond | null | Easy | 6K | 7.6K | 5,986 | 7,621 | 78.5% | [] | ["Create table If Not Exists Elements (symbol varchar(2), type ENUM('Metal','Nonmetal','Noble'), electrons int)", 'Truncate table Elements', "insert into Elements (symbol, type, electrons) values ('He', 'Noble', '0')", "insert into Elements (symbol, type, electrons) values ('Na', 'Metal', '1')", "insert into Elements (... | Database | null | {"headers": {"Elements": ["symbol", "type", "electrons"]}, "rows": {"Elements": [["He", "Noble", 0], ["Na", "Metal", 1], ["Ca", "Metal", 2], ["La", "Metal", 3], ["Cl", "Nonmetal", 1], ["O", "Nonmetal", 2], ["N", "Nonmetal", 3]]}} | {"mysql": ["Create table If Not Exists Elements (symbol varchar(2), type ENUM('Metal','Nonmetal','Noble'), electrons int)"], "mssql": ["Create table Elements (symbol varchar(2), type varchar(8) not null check(type in ('Metal','Nonmetal','Noble')), electrons int)\n"], "oraclesql": ["Create table Elements (symbol varchar... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
2,481 | Minimum Cuts to Divide a Circle | minimum-cuts-to-divide-a-circle | <p>A <strong>valid cut</strong> in a circle can be:</p>
<ul>
<li>A cut that is represented by a straight line that touches two points on the edge of the circle and passes through its center, or</li>
<li>A cut that is represented by a straight line that touches one point on the edge of the circle and its center.</li>... | Easy | 51K | 92.8K | 50,961 | 92,816 | 54.9% | ['smallest-even-multiple', 'count-total-number-of-colored-cells'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfCuts(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfCuts(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So... | 4 | {
"name": "numberOfCuts",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Geometry'] |
2,482 | Difference Between Ones and Zeros in Row and Column | difference-between-ones-and-zeros-in-row-and-column | <p>You are given a <strong>0-indexed</strong> <code>m x n</code> binary matrix <code>grid</code>.</p>
<p>A <strong>0-indexed</strong> <code>m x n</code> difference matrix <code>diff</code> is created with the following procedure:</p>
<ul>
<li>Let the number of ones in the <code>i<sup>th</sup></code> row be <code>one... | Medium | 134.8K | 159.9K | 134,787 | 159,944 | 84.3% | ['01-matrix', 'special-positions-in-a-binary-matrix', 'remove-all-ones-with-row-and-column-flips', 'first-completely-painted-row-or-column'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> onesMinusZeros(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] onesMinusZeros(int[][] grid) {\n \n }\n}"}, {"value": "... | [[0,1,1],[1,0,1],[0,0,1]] | {
"name": "onesMinusZeros",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "integer[][]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Matrix', 'Simulation'] |
2,483 | Minimum Penalty for a Shop | minimum-penalty-for-a-shop | <p>You are given the customer visit log of a shop represented by a <strong>0-indexed</strong> string <code>customers</code> consisting only of characters <code>'N'</code> and <code>'Y'</code>:</p>
<ul>
<li>if the <code>i<sup>th</sup></code> character is <code>'Y'</code>, it means that customer... | Medium | 122.1K | 180.8K | 122,125 | 180,786 | 67.6% | ['grid-game', 'minimum-amount-of-damage-dealt-to-bob'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int bestClosingTime(string customers) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int bestClosingTime(String customers) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | "YYNY" | {
"name": "bestClosingTime",
"params": [
{
"name": "customers",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Prefix Sum'] |
2,484 | Count Palindromic Subsequences | count-palindromic-subsequences | <p>Given a string of digits <code>s</code>, return <em>the number of <strong>palindromic subsequences</strong> of</em> <code>s</code><em> having length </em><code>5</code>. Since the answer may be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
<p><strong>Note:</strong></p>
<ul>
<l... | Hard | 14.4K | 37.1K | 14,440 | 37,109 | 38.9% | ['arithmetic-slices-ii-subsequence', 'count-different-palindromic-subsequences', 'unique-length-3-palindromic-subsequences'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countPalindromes(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countPalindromes(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo... | "103301" | {
"name": "countPalindromes",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
2,485 | Find the Pivot Integer | find-the-pivot-integer | <p>Given a positive integer <code>n</code>, find the <strong>pivot integer</strong> <code>x</code> such that:</p>
<ul>
<li>The sum of all elements between <code>1</code> and <code>x</code> inclusively equals the sum of all elements between <code>x</code> and <code>n</code> inclusively.</li>
</ul>
<p>Return <em>the p... | Easy | 252.6K | 301.8K | 252,593 | 301,755 | 83.7% | ['bulb-switcher'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int pivotInteger(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int pivotInteger(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So... | 8 | {
"name": "pivotInteger",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Prefix Sum'] |
2,486 | Append Characters to String to Make Subsequence | append-characters-to-string-to-make-subsequence | <p>You are given two strings <code>s</code> and <code>t</code> consisting of only lowercase English letters.</p>
<p>Return <em>the minimum number of characters that need to be appended to the end of </em><code>s</code><em> so that </em><code>t</code><em> becomes a <strong>subsequence</strong> of </em><code>s</code>.</... | Medium | 200.3K | 274.5K | 200,304 | 274,526 | 73.0% | ['is-subsequence', 'minimum-operations-to-make-a-subsequence'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int appendCharacters(string s, string t) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int appendCharacters(String s, String t) {\n \n }\n}"}, {"value": "python", "text": ... | "coaching"
"coding" | {
"name": "appendCharacters",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "string",
"name": "t"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String', 'Greedy'] |
2,487 | Remove Nodes From Linked List | remove-nodes-from-linked-list | <p>You are given the <code>head</code> of a linked list.</p>
<p>Remove every node which has a node with a greater value anywhere to the right side of it.</p>
<p>Return <em>the </em><code>head</code><em> of the modified linked list.</em></p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt=""... | Medium | 223.3K | 300.8K | 223,330 | 300,792 | 74.2% | ['reverse-linked-list', 'delete-node-in-a-linked-list', 'next-greater-element-i', 'delete-nodes-from-linked-list-present-in-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [5,2,13,3,8] | {
"name": "removeNodes",
"params": [
{
"name": "head",
"type": "ListNode"
}
],
"return": {
"type": "ListNode"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Stack', 'Recursion', 'Monotonic Stack'] |
2,489 | Number of Substrings With Fixed Ratio | number-of-substrings-with-fixed-ratio | null | Medium | 1.4K | 2.5K | 1,364 | 2,459 | 55.5% | ['count-binary-substrings'] | [] | Algorithms | null | "0110011"
1
2 | {
"name": "fixedRatio",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "integer",
"name": "num1"
},
{
"type": "integer",
"name": "num2"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'Math', 'String', 'Prefix Sum'] |
2,490 | Circular Sentence | circular-sentence | <p>A <strong>sentence</strong> is a list of words that are separated by a<strong> single</strong> space with no leading or trailing spaces.</p>
<ul>
<li>For example, <code>"Hello World"</code>, <code>"HELLO"</code>, <code>"hello world hello world"</code> are all sentences.</li>
</ul>
<p... | Easy | 178.9K | 253.9K | 178,936 | 253,884 | 70.5% | ['defuse-the-bomb'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isCircularSentence(string sentence) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isCircularSentence(String sentence) {\n \n }\n}"}, {"value": "python", "text... | "leetcode exercises sound delightful" | {
"name": "isCircularSentence",
"params": [
{
"name": "sentence",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String'] |
2,491 | Divide Players Into Teams of Equal Skill | divide-players-into-teams-of-equal-skill | <p>You are given a positive integer array <code>skill</code> of <strong>even</strong> length <code>n</code> where <code>skill[i]</code> denotes the skill of the <code>i<sup>th</sup></code> player. Divide the players into <code>n / 2</code> teams of size <code>2</code> such that the total skill of each team is <strong>e... | Medium | 187.2K | 271.5K | 187,175 | 271,462 | 69.0% | ['minimum-moves-to-equal-array-elements', 'max-number-of-k-sum-pairs'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long dividePlayers(vector<int>& skill) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long dividePlayers(int[] skill) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | [3,2,5,1,3,4] | {
"name": "dividePlayers",
"params": [
{
"name": "skill",
"type": "integer[]"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Two Pointers', 'Sorting'] |
2,492 | Minimum Score of a Path Between Two Cities | minimum-score-of-a-path-between-two-cities | <p>You are given a positive integer <code>n</code> representing <code>n</code> cities numbered from <code>1</code> to <code>n</code>. You are also given a <strong>2D</strong> array <code>roads</code> where <code>roads[i] = [a<sub>i</sub>, b<sub>i</sub>, distance<sub>i</sub>]</code> indicates that there is a <strong>bid... | Medium | 95.6K | 165.7K | 95,565 | 165,706 | 57.7% | ['checking-existence-of-edge-length-limited-paths', 'checking-existence-of-edge-length-limited-paths-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minScore(int n, vector<vector<int>>& roads) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minScore(int n, int[][] roads) {\n \n }\n}"}, {"value": "python", "text":... | 4
[[1,2,9],[2,3,6],[2,4,5],[1,4,7]] | {
"name": "minScore",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "roads"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Depth-First Search', 'Breadth-First Search', 'Union Find', 'Graph'] |
2,493 | Divide Nodes Into the Maximum Number of Groups | divide-nodes-into-the-maximum-number-of-groups | <p>You are given a positive integer <code>n</code> representing the number of nodes in an <strong>undirected</strong> graph. The nodes are labeled from <code>1</code> to <code>n</code>.</p>
<p>You are also given a 2D integer array <code>edges</code>, where <code>edges[i] = [a<sub>i, </sub>b<sub>i</sub>]</code> indicat... | Hard | 81.4K | 120.6K | 81,430 | 120,629 | 67.5% | ['binary-tree-level-order-traversal', 'is-graph-bipartite', 'shortest-cycle-in-a-graph'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int magnificentSets(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int magnificentSets(int n, int[][] edges) {\n \n }\n}"}, {"value": "py... | 6
[[1,2],[1,4],[1,5],[2,6],[2,3],[4,6]] | {
"name": "magnificentSets",
"params": [
{
"type": "integer",
"name": "n"
},
{
"type": "integer[][]",
"name": "edges"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Depth-First Search', 'Breadth-First Search', 'Union Find', 'Graph'] |
2,494 | Merge Overlapping Events in the Same Hall | merge-overlapping-events-in-the-same-hall | null | Hard | 2.4K | 7K | 2,431 | 7,047 | 34.5% | [] | ['Create table If Not Exists HallEvents (hall_id int, start_day date, end_day date)', 'Truncate table HallEvents', "insert into HallEvents (hall_id, start_day, end_day) values ('1', '2023-01-13', '2023-01-14')", "insert into HallEvents (hall_id, start_day, end_day) values ('1', '2023-01-14', '2023-01-17')", "insert int... | Database | null | {"headers": {"HallEvents": ["hall_id", "start_day", "end_day"]}, "rows": {"HallEvents": [[1, "2023-01-13", "2023-01-14"], [1, "2023-01-14", "2023-01-17"], [1, "2023-01-18", "2023-01-25"], [2, "2022-12-09", "2022-12-23"], [2, "2022-12-13", "2022-12-17"], [3, "2022-12-01", "2023-01-30"]]}} | {"mysql": ["Create table If Not Exists HallEvents (hall_id int, start_day date, end_day date)"], "mssql": ["Create table HallEvents (hall_id int, start_day date, end_day date)"], "oraclesql": ["Create table HallEvents (hall_id int, start_day date, end_day date)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD'"], "data... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | ['Database'] |
2,495 | Number of Subarrays Having Even Product | number-of-subarrays-having-even-product | null | Medium | 2.2K | 3.7K | 2,228 | 3,651 | 61.0% | [] | [] | Algorithms | null | [9,6,7,13] | {
"name": "evenProduct",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Dynamic Programming'] |
2,496 | Maximum Value of a String in an Array | maximum-value-of-a-string-in-an-array | <p>The <strong>value</strong> of an alphanumeric string can be defined as:</p>
<ul>
<li>The <strong>numeric</strong> representation of the string in base <code>10</code>, if it comprises of digits <strong>only</strong>.</li>
<li>The <strong>length</strong> of the string, otherwise.</li>
</ul>
<p>Given an array <cod... | Easy | 55.2K | 75.4K | 55,236 | 75,403 | 73.3% | ['maximum-subarray'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumValue(vector<string>& strs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumValue(String[] strs) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | ["alic3","bob","3","4","00000"] | {
"name": "maximumValue",
"params": [
{
"name": "strs",
"type": "string[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String'] |
2,497 | Maximum Star Sum of a Graph | maximum-star-sum-of-a-graph | <p>There is an undirected graph consisting of <code>n</code> nodes numbered from <code>0</code> to <code>n - 1</code>. You are given a <strong>0-indexed</strong> integer array <code>vals</code> of length <code>n</code> where <code>vals[i]</code> denotes the value of the <code>i<sup>th</sup></code> node.</p>
<p>You are... | Medium | 25.4K | 62.7K | 25,437 | 62,666 | 40.6% | ['number-of-ways-to-reconstruct-a-tree', 'find-center-of-star-graph'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxStarSum(vector<int>& vals, vector<vector<int>>& edges, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxStarSum(int[] vals, int[][] edges, int k) {\n \n ... | [1,2,3,4,10,-10,-20]
[[0,1],[1,2],[1,3],[3,4],[3,5],[3,6]]
2 | {
"name": "maxStarSum",
"params": [
{
"name": "vals",
"type": "integer[]"
},
{
"type": "integer[][]",
"name": "edges"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Graph', 'Sorting', 'Heap (Priority Queue)'] |
2,498 | Frog Jump II | frog-jump-ii | <p>You are given a <strong>0-indexed</strong> integer array <code>stones</code> sorted in <strong>strictly increasing order</strong> representing the positions of stones in a river.</p>
<p>A frog, initially on the first stone, wants to travel to the last stone and then return to the first stone. However, it can jump t... | Medium | 27.2K | 43.8K | 27,215 | 43,848 | 62.1% | ['climbing-stairs', 'koko-eating-bananas'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxJump(vector<int>& stones) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxJump(int[] stones) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode"... | [0,2,5,6,7] | {
"name": "maxJump",
"params": [
{
"name": "stones",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Greedy'] |
2,499 | Minimum Total Cost to Make Arrays Unequal | minimum-total-cost-to-make-arrays-unequal | <p>You are given two <strong>0-indexed</strong> integer arrays <code>nums1</code> and <code>nums2</code>, of equal length <code>n</code>.</p>
<p>In one operation, you can swap the values of any two indices of <code>nums1</code>. The <strong>cost</strong> of this operation is the <strong>sum</strong> of the indices.</p... | Hard | 5.3K | 13.1K | 5,290 | 13,056 | 40.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumTotalCost(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumTotalCost(int[] nums1, int[] nums2) {\n \n }\n... | [1,2,3,4,5]
[1,2,3,4,5] | {
"name": "minimumTotalCost",
"params": [
{
"name": "nums1",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "nums2"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Greedy', 'Counting'] |
2,500 | Delete Greatest Value in Each Row | delete-greatest-value-in-each-row | <p>You are given an <code>m x n</code> matrix <code>grid</code> consisting of positive integers.</p>
<p>Perform the following operation until <code>grid</code> becomes empty:</p>
<ul>
<li>Delete the element with the greatest value from each row. If multiple such elements exist, delete any of them.</li>
<li>Add the ... | Easy | 76.9K | 97.6K | 76,899 | 97,595 | 78.8% | ['equal-row-and-column-pairs'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int deleteGreatestValue(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int deleteGreatestValue(int[][] grid) {\n \n }\n}"}, {"value": "python", "... | [[1,2,4],[3,3,1]] | {
"name": "deleteGreatestValue",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Sorting', 'Heap (Priority Queue)', 'Matrix', 'Simulation'] |
2,501 | Longest Square Streak in an Array | longest-square-streak-in-an-array | <p>You are given an integer array <code>nums</code>. A subsequence of <code>nums</code> is called a <strong>square streak</strong> if:</p>
<ul>
<li>The length of the subsequence is at least <code>2</code>, and</li>
<li><strong>after</strong> sorting the subsequence, each element (except the first element) is the <st... | Medium | 151.3K | 285.1K | 151,265 | 285,109 | 53.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestSquareStreak(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestSquareStreak(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Py... | [4,3,6,16,8,2] | {
"name": "longestSquareStreak",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Binary Search', 'Dynamic Programming', 'Sorting'] |
2,502 | Design Memory Allocator | design-memory-allocator | <p>You are given an integer <code>n</code> representing the size of a <strong>0-indexed</strong> memory array. All memory units are initially free.</p>
<p>You have a memory allocator with the following functionalities:</p>
<ol>
<li><strong>Allocate </strong>a block of <code>size</code> consecutive free memory units ... | Medium | 24.4K | 46K | 24,379 | 45,975 | 53.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Allocator {\npublic:\n Allocator(int n) {\n \n }\n \n int allocate(int size, int mID) {\n \n }\n \n int freeMemory(int mID) {\n \n }\n};\n\n/**\n * Your Allocator object will be instantiated and called as such:\n * Alloc... | ["Allocator","allocate","allocate","allocate","freeMemory","allocate","allocate","allocate","freeMemory","allocate","freeMemory"]
[[10],[1,1],[1,2],[1,3],[2],[3,4],[1,1],[1,1],[1],[10,2],[7]] | {
"classname": "Allocator",
"constructor": {
"params": [
{
"type": "integer",
"name": "n"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "size"
},
{
"type": "integer",
"name": "mID"
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Design', 'Simulation'] |
2,503 | Maximum Number of Points From Grid Queries | maximum-number-of-points-from-grid-queries | <p>You are given an <code>m x n</code> integer matrix <code>grid</code> and an array <code>queries</code> of size <code>k</code>.</p>
<p>Find an array <code>answer</code> of size <code>k</code> such that for each integer <code>queries[i]</code> you start in the <strong>top left</strong> cell of the matrix and repeat t... | Hard | 91.7K | 153.8K | 91,696 | 153,804 | 59.6% | ['trapping-rain-water-ii', 'escape-the-spreading-fire'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> maxPoints(vector<vector<int>>& grid, vector<int>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] maxPoints(int[][] grid, int[] queries) {\n \n }\... | [[1,2,3],[2,5,7],[3,5,1]]
[5,6,2] | {
"name": "maxPoints",
"params": [
{
"name": "grid",
"type": "integer[][]"
},
{
"type": "integer[]",
"name": "queries"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Breadth-First Search', 'Union Find', 'Sorting', 'Heap (Priority Queue)', 'Matrix'] |
2,504 | Concatenate the Name and the Profession | concatenate-the-name-and-the-profession | null | Easy | 5.7K | 7.3K | 5,717 | 7,272 | 78.6% | [] | ["Create table If Not Exists Person (person_id int, name varchar(30), profession ENUM('Doctor','Singer','Actor','Player','Engineer','Lawyer'))", 'Truncate table Person', "insert into Person (person_id, name, profession) values ('1', 'Alex', 'Singer')", "insert into Person (person_id, name, profession) values ('3', 'Ali... | Database | null | {"headers": {"Person": ["person_id", "name", "profession"]}, "rows": {"Person": [[1, "Alex", "Singer"], [3, "Alice", "Actor"], [2, "Bob", "Player"], [4, "Messi", "Doctor"], [6, "Tyson", "Engineer"], [5, "Meir", "Lawyer"]]}} | {"mysql": ["Create table If Not Exists Person (person_id int, name varchar(30), profession ENUM('Doctor','Singer','Actor','Player','Engineer','Lawyer'))"], "mssql": ["Create table Person (person_id int, name varchar(30), profession varchar(8) not null check(profession in ('Doctor','Singer','Actor','Player','Engineer','... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
2,505 | Bitwise OR of All Subsequence Sums | bitwise-or-of-all-subsequence-sums | null | Medium | 4.1K | 6.3K | 4,116 | 6,338 | 64.9% | ['bitwise-ors-of-subarrays'] | [] | Algorithms | null | [2,1,0,3] | {
"name": "subsequenceSumOr",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Bit Manipulation', 'Brainteaser'] |
2,506 | Count Pairs Of Similar Strings | count-pairs-of-similar-strings | <p>You are given a <strong>0-indexed</strong> string array <code>words</code>.</p>
<p>Two strings are <strong>similar</strong> if they consist of the same characters.</p>
<ul>
<li>For example, <code>"abca"</code> and <code>"cba"</code> are similar since both consist of characters <code>'a'... | Easy | 60.3K | 83.6K | 60,331 | 83,579 | 72.2% | ['sort-characters-by-frequency', 'count-the-number-of-consistent-strings', 'number-of-good-paths'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int similarPairs(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int similarPairs(String[] words) {\n \n }\n}"}, {"value": "python", "text": "Python",... | ["aba","aabb","abcd","bac","aabc"] | {
"name": "similarPairs",
"params": [
{
"name": "words",
"type": "string[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Bit Manipulation', 'Counting'] |
2,507 | Smallest Value After Replacing With Sum of Prime Factors | smallest-value-after-replacing-with-sum-of-prime-factors | <p>You are given a positive integer <code>n</code>.</p>
<p>Continuously replace <code>n</code> with the sum of its <strong>prime factors</strong>.</p>
<ul>
<li>Note that if a prime factor divides <code>n</code> multiple times, it should be included in the sum as many times as it divides <code>n</code>.</li>
</ul>
<... | Medium | 27.1K | 55.3K | 27,074 | 55,293 | 49.0% | ['happy-number', '2-keys-keyboard', 'count-ways-to-make-array-with-product', 'distinct-prime-factors-of-product-of-array', 'minimum-division-operations-to-make-array-non-decreasing'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int smallestValue(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int smallestValue(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class ... | 15 | {
"name": "smallestValue",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Simulation', 'Number Theory'] |
2,508 | Add Edges to Make Degrees of All Nodes Even | add-edges-to-make-degrees-of-all-nodes-even | <p>There is an <strong>undirected</strong> graph consisting of <code>n</code> nodes numbered from <code>1</code> to <code>n</code>. You are given the integer <code>n</code> and a <strong>2D</strong> array <code>edges</code> where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates that there is an edge bet... | Hard | 16.6K | 49.7K | 16,552 | 49,722 | 33.3% | ['minimum-degree-of-a-connected-trio-in-a-graph'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isPossible(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isPossible(int n, List<List<Integer>> edges) {\n \n }\n}"}, {"valu... | 5
[[1,2],[2,3],[3,4],[4,2],[1,4],[2,5]] | {
"name": "isPossible",
"params": [
{
"type": "integer",
"name": "n"
},
{
"type": "list<list<integer>>",
"name": "edges"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'Graph'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.