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,609 | Find the Longest Balanced Substring of a Binary String | find-the-longest-balanced-substring-of-a-binary-string | <p>You are given a binary string <code>s</code> consisting only of zeroes and ones.</p>
<p>A substring of <code>s</code> is considered balanced if<strong> all zeroes are before ones</strong> and the number of zeroes is equal to the number of ones inside the substring. Notice that the empty substring is considered a ba... | Easy | 34.9K | 77.1K | 34,889 | 77,110 | 45.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findTheLongestBalancedSubstring(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findTheLongestBalancedSubstring(String s) {\n \n }\n}"}, {"value": "python"... | "01000111" | {
"name": "findTheLongestBalancedSubstring",
"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,610 | Convert an Array Into a 2D Array With Conditions | convert-an-array-into-a-2d-array-with-conditions | <p>You are given an integer array <code>nums</code>. You need to create a 2D array from <code>nums</code> satisfying the following conditions:</p>
<ul>
<li>The 2D array should contain <strong>only</strong> the elements of the array <code>nums</code>.</li>
<li>Each row in the 2D array contains <strong>distinct</stron... | Medium | 212.2K | 246K | 212,241 | 245,976 | 86.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> findMatrix(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> findMatrix(int[] nums) {\n \n }\n}"}, {"value": "python... | [1,3,4,1,2,3,1] | {
"name": "findMatrix",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"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', 'Hash Table'] |
2,611 | Mice and Cheese | mice-and-cheese | <p>There are two mice and <code>n</code> different types of cheese, each type of cheese should be eaten by exactly one mouse.</p>
<p>A point of the cheese with index <code>i</code> (<strong>0-indexed</strong>) is:</p>
<ul>
<li><code>reward1[i]</code> if the first mouse eats it.</li>
<li><code>reward2[i]</code> if t... | Medium | 31.8K | 67.8K | 31,832 | 67,811 | 46.9% | ['house-robber'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int miceAndCheese(vector<int>& reward1, vector<int>& reward2, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int miceAndCheese(int[] reward1, int[] reward2, int k) {\n ... | [1,1,3,4]
[4,4,1,1]
2 | {
"name": "miceAndCheese",
"params": [
{
"type": "integer[]",
"name": "reward1"
},
{
"type": "integer[]",
"name": "reward2"
},
{
"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', 'Sorting', 'Heap (Priority Queue)'] |
2,612 | Minimum Reverse Operations | minimum-reverse-operations | <p>You are given an integer <code>n</code> and an integer <code>p</code> representing an array <code>arr</code> of length <code>n</code> where all elements are set to 0's, except position <code>p</code> which is set to 1. You are also given an integer array <code>banned</code> containing restricted positions. Perfo... | Hard | 5.8K | 36.1K | 5,791 | 36,117 | 16.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> minReverseOperations(int n, int p, vector<int>& banned, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] minReverseOperations(int n, int p, int[] banned, int k... | 4
0
[1,2]
4 | {
"name": "minReverseOperations",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer",
"name": "p"
},
{
"type": "integer[]",
"name": "banned"
},
{
"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', 'Breadth-First Search', 'Ordered Set'] |
2,613 | Beautiful Pairs | beautiful-pairs | null | Hard | 652 | 1.6K | 652 | 1,619 | 40.3% | [] | [] | Algorithms | null | [1,2,3,2,4]
[2,3,1,2,3] | {
"name": "beautifulPair",
"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', 'Math', 'Divide and Conquer', 'Geometry', 'Sorting', 'Ordered Set'] |
2,614 | Prime In Diagonal | prime-in-diagonal | <p>You are given a 0-indexed two-dimensional integer array <code>nums</code>.</p>
<p>Return <em>the largest <strong>prime</strong> number that lies on at least one of the <b>diagonals</b> of </em><code>nums</code>. In case, no prime is present on any of the diagonals, return<em> 0.</em></p>
<p>Note that:</p>
<ul>
<... | Easy | 56.5K | 157.7K | 56,537 | 157,702 | 35.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int diagonalPrime(vector<vector<int>>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int diagonalPrime(int[][] nums) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [[1,2,3],[5,6,7],[9,10,11]] | {
"name": "diagonalPrime",
"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', 'Matrix', 'Number Theory'] |
2,615 | Sum of Distances | sum-of-distances | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>. There exists an array <code>arr</code> of length <code>nums.length</code>, where <code>arr[i]</code> is the sum of <code>|i - j|</code> over all <code>j</code> such that <code>nums[j] == nums[i]</code> and <code>j != i</code>. If there is no... | Medium | 23.6K | 76.3K | 23,647 | 76,337 | 31.0% | ['remove-duplicates-from-sorted-array', 'find-all-duplicates-in-an-array', 'minimum-operations-to-make-all-array-elements-equal'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<long long> distance(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long[] distance(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python"... | [1,3,1,1,2] | {
"name": "distance",
"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', 'Hash Table', 'Prefix Sum'] |
2,616 | Minimize the Maximum Difference of Pairs | minimize-the-maximum-difference-of-pairs | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and an integer <code>p</code>. Find <code>p</code> pairs of indices of <code>nums</code> such that the <strong>maximum</strong> difference amongst all the pairs is <strong>minimized</strong>. Also, ensure no index appears more than once among... | Medium | 78K | 178.7K | 78,014 | 178,651 | 43.7% | ['minimum-absolute-difference', 'minimum-difference-between-largest-and-smallest-value-in-three-moves'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimizeMax(vector<int>& nums, int p) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimizeMax(int[] nums, int p) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [10,1,2,7,1,3]
2 | {
"name": "minimizeMax",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "p"
}
],
"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,617 | Minimum Number of Visited Cells in a Grid | minimum-number-of-visited-cells-in-a-grid | <p>You are given a <strong>0-indexed</strong> <code>m x n</code> integer matrix <code>grid</code>. Your initial position is at the <strong>top-left</strong> cell <code>(0, 0)</code>.</p>
<p>Starting from the cell <code>(i, j)</code>, you can move to one of the following cells:</p>
<ul>
<li>Cells <code>(i, k)</code> ... | Hard | 10K | 44.3K | 9,978 | 44,325 | 22.5% | ['jump-game-ii', 'jump-game'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumVisitedCells(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumVisitedCells(int[][] grid) {\n \n }\n}"}, {"value": "python", "... | [[3,4,2,1],[4,2,3,1],[2,1,0,0],[2,4,0,0]] | {
"name": "minimumVisitedCells",
"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', 'Dynamic Programming', 'Stack', 'Breadth-First Search', 'Union Find', 'Heap (Priority Queue)', 'Matrix', 'Monotonic Stack'] |
2,618 | Check if Object Instance of Class | check-if-object-instance-of-class | <p>Write a function that checks if a given value is an instance of a given class or superclass. For this problem, an object is considered an instance of a given class if that object has access to that class's methods.</p>
<p>There are no constraints on the data types that can be passed to the function. F... | Medium | 28.6K | 102.3K | 28,571 | 102,348 | 27.9% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {*} obj\n * @param {*} classFunction\n * @return {boolean}\n */\nvar checkIfInstanceOf = function(obj, classFunction) {\n \n};\n\n/**\n * checkIfInstanceOf(new Date(), Date); // true\n */"}, {"value": "typescript", "text": "TypeScript", "d... | () => checkIfInstanceOf(new Date(), Date) | {
"name": "checkIfInstance",
"params": [
{
"name": "func",
"type": "string"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,619 | Array Prototype Last | array-prototype-last | <p>Write code that enhances all arrays such that you can call the <code>array.last()</code> method on any array and it will return the last element. If there are no elements in the array, it should return <code>-1</code>.</p>
<p>You may assume the array is the output of <code>JSON.parse</code>.</p>... | Easy | 180.4K | 242.3K | 180,387 | 242,280 | 74.5% | ['snail-traversal', 'array-upper-bound'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @return {null|boolean|number|string|Array|Object}\n */\nArray.prototype.last = function() {\n \n};\n\n/**\n * const arr = [1, 2, 3];\n * arr.last(); // 3\n */"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "interface Array<T> {\n... | [null, {}, 3] | {
"name": "foobar",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,620 | Counter | counter | <p>Given an integer <code>n</code>, return a <code>counter</code> function. This <code>counter</code> function initially returns <code>n</code> and then returns 1 more than the previous value every subsequent time it is called (<code>n</code>, <code>n + 1</code>, <code>n + 2</code>, etc).</p>
<p>&n... | Easy | 562.5K | 684.9K | 562,539 | 684,903 | 82.1% | ['memoize', 'function-composition', 'counter-ii'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {number} n\n * @return {Function} counter\n */\nvar createCounter = function(n) {\n \n return function() {\n \n };\n};\n\n/** \n * const counter = createCounter(10)\n * counter() // 10\n * counter() // 11\n * counter() // 12\n... | 10
["call","call","call"] | {
"name": "createCounter",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "string[]",
"name": "calls"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,621 | Sleep | sleep | <p>Given a positive integer <code>millis</code>, write an asynchronous function that sleeps for <code>millis</code> milliseconds. It can resolve any value.</p>
<p><strong>Note</strong> that <em>minor</em> deviation from <code>millis</code> in the actual sleep duration is acceptable.</p>
<p> </p>
<p><st... | Easy | 192.6K | 219.5K | 192,560 | 219,481 | 87.7% | ['promise-time-limit', 'promise-pool'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {number} millis\n * @return {Promise}\n */\nasync function sleep(millis) {\n \n}\n\n/** \n * let t = Date.now()\n * sleep(100).then(() => console.log(Date.now() - t)) // 100\n */"}, {"value": "typescript", "text": "TypeScript", "defaultCod... | 100 | {
"name": "foobar",
"params": [
{
"name": "millis",
"type": "integer"
}
],
"return": {
"type": "integer"
},
"manual": true,
"languages": [
"javascript",
"typescript"
]
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,622 | Cache With Time Limit | cache-with-time-limit | <p>Write a class that allows getting and setting key-value pairs, however a <strong>time until expiration</strong> is associated with each key.</p>
<p>The class has three public methods:</p>
<p><code>set(key, value, duration)</code>: accepts an integer <code>key</code>, an integer <... | Medium | 63.4K | 83.8K | 63,359 | 83,795 | 75.6% | ['debounce', 'promise-time-limit', 'promise-pool'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "var TimeLimitedCache = function() {\n \n};\n\n/** \n * @param {number} key\n * @param {number} value\n * @param {number} duration time until expiration in ms\n * @return {boolean} if un-expired key already existed\n */\nTimeLimitedCache.prototype.set = f... | ["TimeLimitedCache", "set", "get", "count", "get"]
[[], [1, 42, 100], [1], [], [1]]
[0, 0, 50, 50, 150] | {
"name": "foobar",
"params": [
{
"name": "actions",
"type": "string[]"
},
{
"type": "integer[]",
"name": "values"
},
{
"type": "integer[]",
"name": "timeDelays"
}
],
"return": {
"type": "integer"
},
"languages": [
"typescript",
"javasc... | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,623 | Memoize | memoize | <p>Given a function <code>fn</code>, return a <strong>memoized</strong> version of that function.</p>
<p>A <strong>memoized </strong>function is a function that will never be called twice with the same inputs. Instead it will return a cached value.</p>
<p>You can assume there are <s... | Medium | 143.7K | 227.3K | 143,705 | 227,302 | 63.2% | ['counter', 'curry', 'function-composition', 'memoize-ii'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Function} fn\n * @return {Function}\n */\nfunction memoize(fn) {\n \n return function(...args) {\n \n }\n}\n\n\n/** \n * let callCount = 0;\n * const memoizedFn = memoize(function (a, b) {\n *\t callCount += 1;\n * return a... | "sum"
["call","call","getCallCount","call","getCallCount"]
[[2,2],[2,2],[],[1,2],[]] | {
"name": "foobar",
"params": [
{
"name": "fnName",
"type": "string"
},
{
"type": "string[]",
"name": "actions"
},
{
"type": "integer[][]",
"name": "values"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"... | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,624 | Snail Traversal | snail-traversal | <p>Write code that enhances all arrays such that you can call the <code>snail(rowsCount, colsCount)</code> method that transforms the 1D array into a 2D array organised in the pattern known as <strong>snail traversal order</strong>. Invalid input values should output an empty array. If <code>rowsCou... | Medium | 13.8K | 20.6K | 13,772 | 20,566 | 67.0% | ['array-prototype-last', 'group-by', 'array-upper-bound'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {number} rowsCount\n * @param {number} colsCount\n * @return {Array<Array<number>>}\n */\nArray.prototype.snail = function(rowsCount, colsCount) {\n \n}\n\n/**\n * const arr = [1,2,3,4];\n * arr.snail(1,4); // [[1,2,3,4]]\n */"}, {"value":... | [19, 10, 3, 7, 9, 8, 5, 2, 1, 17, 16, 14, 12, 18, 6, 13, 11, 20, 4, 15]
5
4 | {
"name": "foobar",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "rowsCount"
},
{
"type": "integer",
"name": "colsCount"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript... | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,625 | Flatten Deeply Nested Array | flatten-deeply-nested-array | <p>Given a <strong>multi-dimensional</strong> array <code>arr</code> and a depth <code>n</code>, return a <strong>flattened</strong> version of that array.</p>
<p>A <strong>multi-dimensional</strong> array is a recursive data structure that contains integers or other <strong>mul... | Medium | 61.2K | 95.4K | 61,222 | 95,439 | 64.1% | ['json-deep-equal', 'convert-object-to-json-string', 'nested-array-generator'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Array} arr\n * @param {number} depth\n * @return {Array}\n */\nvar flat = function (arr, n) {\n \n};"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "type MultiDimensionalArray = (number | MultiDimensionalArray)[];\n\nvar ... | [1,2,3,[4,5,6],[7,8,[9,10,11],12],[13,14,15]]
0 | {
"name": "foobar",
"params": [
{
"name": "arr",
"type": "integer[]"
},
{
"type": "integer",
"name": "n"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,626 | Array Reduce Transformation | array-reduce-transformation | <p>Given an integer array <code>nums</code>, a reducer function <code>fn</code>, and an initial value <code>init</code>, return the final result obtained by executing the <code>fn</code> function on each element of the array, sequentially, passing in the return value from the calculation on the preceding element.</p>
... | Easy | 231.1K | 270.7K | 231,099 | 270,734 | 85.4% | ['group-by', 'filter-elements-from-array', 'apply-transform-over-each-element-in-array'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {number[]} nums\n * @param {Function} fn\n * @param {number} init\n * @return {number}\n */\nvar reduce = function(nums, fn, init) {\n \n};"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "type Fn = (accum: number, curr: nu... | [1,2,3,4]
function sum(accum, curr) { return accum + curr; }
0 | {
"name": "reduce",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "string",
"name": "fn"
},
{
"type": "integer",
"name": "init"
}
],
"return": {
"type": "integer"
},
"manual": true,
"languages": [
"javascript",
"types... | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,627 | Debounce | debounce | <p>Given a function <code>fn</code> and a time in milliseconds <code>t</code>, return a <strong>debounced</strong> version of that function.</p>
<p>A <strong>debounced</strong> function is a function whose execution is delayed by <code>t</code> milliseconds and whose e... | Medium | 70K | 76.3K | 70,023 | 76,322 | 91.7% | ['promise-time-limit', 'cache-with-time-limit', 'throttle'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Function} fn\n * @param {number} t milliseconds\n * @return {Function}\n */\nvar debounce = function(fn, t) {\n \n return function(...args) {\n \n }\n};\n\n/**\n * const log = debounce(console.log, 100);\n * log('Hello'); // ... | 50
[{"t":50,"inputs":[1]},{"t":75,"inputs":[2]}] | {
"name": "debounce",
"params": [
{
"name": "t",
"type": "integer"
},
{
"type": "string",
"name": "fn"
}
],
"return": {
"type": "string"
},
"manual": true,
"languages": [
"javascript",
"typescript"
]
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,628 | JSON Deep Equal | json-deep-equal | null | Medium | 13.9K | 35.6K | 13,910 | 35,569 | 39.1% | ['convert-object-to-json-string', 'flatten-deeply-nested-array', 'array-of-objects-to-matrix', 'differences-between-two-objects'] | [] | JavaScript | null | {"x":1,"y":2}
{"x":1,"y":2} | {
"name": "areDeeplyEqual",
"params": [
{
"type": "string",
"name": "o1"
},
{
"type": "string",
"name": "o2"
}
],
"return": {
"type": "boolean"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,629 | Function Composition | function-composition | <p>Given an array of functions <code>[f<span style="font-size: 10.8333px;">1</span>, f<sub>2</sub>, f<sub>3</sub>, ..., f<sub>n</sub>]</code>, return a new function <code>fn</code> that is the <strong>function composition</strong> of the array of functions.</p>
<p>The <strong>functio... | Easy | 194.4K | 223.5K | 194,352 | 223,539 | 86.9% | ['memoize', 'counter'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Function[]} functions\n * @return {Function}\n */\nvar compose = function(functions) {\n \n return function(x) {\n \n }\n};\n\n/**\n * const fn = compose([x => x + 1, x => 2 * x])\n * fn(4) // 9\n */"}, {"value": "typescript"... | [x => x + 1, x => x * x, x => 2 * x]
4 | {
"name": "compose",
"params": [
{
"name": "functions",
"type": "string"
},
{
"type": "integer",
"name": "x"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,630 | Memoize II | memoize-ii | <p>Given a function <code>fn</code>, return a <strong>memoized</strong> version of that function.</p>
<p>A <strong>memoized </strong>function is a function that will never be called twice with the same inputs. Instead it will return a cached value.</p>
<p><code>fn</code> c... | Hard | 7K | 21.6K | 6,958 | 21,605 | 32.2% | ['memoize', 'curry'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Function} fn\n * @return {Function}\n */\nfunction memoize(fn) {\n \n return function() {\n \n }\n}\n\n\n/** \n * let callCount = 0;\n * const memoizedFn = memoize(function (a, b) {\n *\t callCount += 1;\n * return a + b;\n... | () => [[2,2],[2,2],[1,2]]
function (a, b) { return a + b; } | {
"name": "memoize",
"params": [
{
"name": "getInputs",
"type": "string"
},
{
"type": "string",
"name": "fn"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,631 | Group By | group-by | <p>Write code that enhances all arrays such that you can call the <code>array.groupBy(fn)</code> method on any array and it will return a <strong>grouped</strong> version of the array.</p>
<p>A <strong>grouped</strong> array is an object where each key is the output of <code>fn(arr[i])</c... | Medium | 61.3K | 75.6K | 61,282 | 75,605 | 81.1% | ['filter-elements-from-array', 'apply-transform-over-each-element-in-array', 'snail-traversal', 'array-reduce-transformation', 'array-upper-bound'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Function} fn\n * @return {Object}\n */\nArray.prototype.groupBy = function(fn) {\n \n};\n\n/**\n * [1,2,3].groupBy(String) // {\"1\":[1],\"2\":[2],\"3\":[3]}\n */"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "interface ... | [{"id":"1"},{"id":"1"},{"id":"2"}]
function (item) { return item.id; } | {
"name": "groupBy",
"params": [
{
"name": "array",
"type": "string"
},
{
"type": "string",
"name": "fn"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,632 | Curry | curry | null | Medium | 17.8K | 19.9K | 17,770 | 19,886 | 89.4% | ['memoize', 'memoize-ii'] | [] | JavaScript | null | function sum(a, b, c) { return a + b + c; }
[[1],[2],[3]] | {
"name": "curry",
"params": [
{
"name": "fn",
"type": "string"
},
{
"type": "integer[][]",
"name": "inputs"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,633 | Convert Object to JSON String | convert-object-to-json-string | null | Medium | 12.9K | 16.6K | 12,934 | 16,616 | 77.8% | ['json-deep-equal', 'flatten-deeply-nested-array', 'array-of-objects-to-matrix', 'differences-between-two-objects'] | [] | JavaScript | null | {"y":1,"x":2} | {
"name": "jsonStringify",
"params": [
{
"name": "object",
"type": "string"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,634 | Filter Elements from Array | filter-elements-from-array | <p>Given an integer array <code>arr</code> and a filtering function <code>fn</code>, return a filtered array <code>filteredArr</code>.</p>
<p>The <code>fn</code> function takes one or two arguments:</p>
<ul>
<li><code>arr[i]</code> - number from the <code>arr</code></li>
<li><code>i</code> - index of... | Easy | 247.7K | 290K | 247,656 | 289,987 | 85.4% | ['group-by', 'apply-transform-over-each-element-in-array', 'array-reduce-transformation'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {number[]} arr\n * @param {Function} fn\n * @return {number[]}\n */\nvar filter = function(arr, fn) {\n \n};"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "type Fn = (n: number, i: number) => any\n\nfunction filter(arr: n... | function greaterThan10(n) { return n > 10; }
[0,10,20,30] | {
"name": "filter",
"params": [
{
"name": "fn",
"type": "string"
},
{
"type": "integer[]",
"name": "arr"
}
],
"return": {
"type": "integer[]"
},
"manual": true,
"languages": [
"javascript",
"typescript"
]
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,635 | Apply Transform Over Each Element in Array | apply-transform-over-each-element-in-array | <p>Given an integer array <code>arr</code> and a mapping function <code>fn</code>, return a new array with a transformation applied to each element.</p>
<p>The returned array should be created such that <code>returnedArray[i] = fn(arr[i], i)</code>.</p>
<p>Please solve it without the built-in... | Easy | 274.4K | 318.8K | 274,366 | 318,807 | 86.1% | ['group-by', 'filter-elements-from-array', 'array-reduce-transformation'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {number[]} arr\n * @param {Function} fn\n * @return {number[]}\n */\nvar map = function(arr, fn) {\n \n};"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "function map(arr: number[], fn: (n: number, i: number) => number): n... | function plusone(n) { return n + 1; }
[1,2,3] | {
"name": "map",
"params": [
{
"name": "fn",
"type": "string"
},
{
"type": "integer[]",
"name": "arr"
}
],
"return": {
"type": "integer[]"
},
"manual": true,
"languages": [
"javascript",
"typescript"
]
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,636 | Promise Pool | promise-pool | null | Medium | 13.8K | 17.3K | 13,791 | 17,264 | 79.9% | ['sleep', 'promise-time-limit', 'cache-with-time-limit', 'throttle'] | [] | JavaScript | null | [() => new Promise(res => setTimeout(res, 300)), () => new Promise(res => setTimeout(res, 400)), () => new Promise(res => setTimeout(res, 200))]
2 | {
"name": "promisePool",
"params": [
{
"name": "functions",
"type": "string"
},
{
"type": "integer",
"name": "n"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,637 | Promise Time Limit | promise-time-limit | <p>Given an asynchronous function <code>fn</code> and a time <code>t</code> in milliseconds, return a new <strong>time limited</strong> version of the input function. <code>fn</code> takes arguments provided to the <strong>time limited </strong>function.</p>
<p>The <strong>... | Medium | 77.1K | 93.3K | 77,127 | 93,345 | 82.6% | ['sleep', 'debounce', 'promise-pool', 'cache-with-time-limit', 'throttle'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Function} fn\n * @param {number} t\n * @return {Function}\n */\nvar timeLimit = function(fn, t) {\n \n return async function(...args) {\n \n }\n};\n\n/**\n * const limited = timeLimit((t) => new Promise(res => setTimeout(res,... | async (n) => { await new Promise(res => setTimeout(res, 100)); return n * n; }
[5]
50 | {
"name": "timeLimit",
"params": [
{
"name": "fn",
"type": "string"
},
{
"type": "string",
"name": "inputs"
},
{
"type": "integer",
"name": "t"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manua... | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,638 | Count the Number of K-Free Subsets | count-the-number-of-k-free-subsets | null | Medium | 4.8K | 10.3K | 4,800 | 10,304 | 46.6% | [] | [] | Algorithms | null | [5,4,6]
1 | {
"name": "countTheNumOfKFreeSubsets",
"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', 'Math', 'Dynamic Programming', 'Sorting', 'Combinatorics'] |
2,639 | Find the Width of Columns of a Grid | find-the-width-of-columns-of-a-grid | <p>You are given a <strong>0-indexed</strong> <code>m x n</code> integer matrix <code>grid</code>. The width of a column is the maximum <strong>length </strong>of its integers.</p>
<ul>
<li>For example, if <code>grid = [[-10], [3], [12]]</code>, the width of the only column is <code>3</code> since <code>-10</code> is... | Easy | 33.1K | 47.9K | 33,072 | 47,947 | 69.0% | ['next-greater-numerically-balanced-number'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findColumnWidth(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findColumnWidth(int[][] grid) {\n \n }\n}"}, {"value": "python",... | [[1],[22],[333]] | {
"name": "findColumnWidth",
"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'] |
2,640 | Find the Score of All Prefixes of an Array | find-the-score-of-all-prefixes-of-an-array | <p>We define the <strong>conversion array</strong> <code>conver</code> of an array <code>arr</code> as follows:</p>
<ul>
<li><code>conver[i] = arr[i] + max(arr[0..i])</code> where <code>max(arr[0..i])</code> is the maximum value of <code>arr[j]</code> over <code>0 <= j <= i</code>.</li>
</ul>
<p>We also define... | Medium | 37.9K | 52.8K | 37,911 | 52,791 | 71.8% | ['most-beautiful-item-for-each-query'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<long long> findPrefixScore(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long[] findPrefixScore(int[] nums) {\n \n }\n}"}, {"value": "python", "t... | [2,3,7,5,10] | {
"name": "findPrefixScore",
"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', 'Prefix Sum'] |
2,641 | Cousins in Binary Tree II | cousins-in-binary-tree-ii | <p>Given the <code>root</code> of a binary tree, replace the value of each node in the tree with the <strong>sum of all its cousins' values</strong>.</p>
<p>Two nodes of a binary tree are <strong>cousins</strong> if they have the same depth with different parents.</p>
<p>Return <em>the </em><code>root</code><em> ... | Medium | 119.2K | 158.2K | 119,237 | 158,184 | 75.4% | ['cousins-in-binary-tree', 'maximum-level-sum-of-a-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... | [5,4,9,1,10,null,7] | {
"name": "replaceValueInTree",
"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... | ['Hash Table', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
2,642 | Design Graph With Shortest Path Calculator | design-graph-with-shortest-path-calculator | <p>There is a <strong>directed weighted</strong> graph that consists of <code>n</code> nodes numbered from <code>0</code> to <code>n - 1</code>. The edges of the graph are initially represented by the given array <code>edges</code> where <code>edges[i] = [from<sub>i</sub>, to<sub>i</sub>, edgeCost<sub>i</sub>]</code> m... | Hard | 71.9K | 102K | 71,899 | 101,961 | 70.5% | ['number-of-restricted-paths-from-first-to-last-node', 'closest-node-to-path-in-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Graph {\npublic:\n Graph(int n, vector<vector<int>>& edges) {\n \n }\n \n void addEdge(vector<int> edge) {\n \n }\n \n int shortestPath(int node1, int node2) {\n \n }\n};\n\n/**\n * Your Graph object will be instantiated... | ["Graph","shortestPath","shortestPath","addEdge","shortestPath"]
[[4,[[0,2,5],[0,1,2],[1,2,1],[3,0,3]]],[3,2],[0,3],[[1,3,4]],[0,3]] | {
"classname": "Graph",
"constructor": {
"params": [
{
"type": "integer",
"name": "n"
},
{
"name": "edges",
"type": "integer[][]"
}
]
},
"methods": [
{
"params": [
{
"type": "integer[]",
"name": "edge"
... | {"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... | ['Graph', 'Design', 'Heap (Priority Queue)', 'Shortest Path'] |
2,643 | Row With Maximum Ones | row-with-maximum-ones | <p>Given a <code>m x n</code> binary matrix <code>mat</code>, find the <strong>0-indexed</strong> position of the row that contains the <strong>maximum</strong> count of <strong>ones,</strong> and the number of ones in that row.</p>
<p>In case there are multiple rows that have the maximum count of ones, the row with t... | Easy | 83K | 111.1K | 82,994 | 111,054 | 74.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> rowAndMaximumOnes(vector<vector<int>>& mat) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] rowAndMaximumOnes(int[][] mat) {\n \n }\n}"}, {"value": "python... | [[0,1],[1,0]] | {
"name": "rowAndMaximumOnes",
"params": [
{
"type": "integer[][]",
"name": "mat"
}
],
"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'] |
2,644 | Find the Maximum Divisibility Score | find-the-maximum-divisibility-score | <p>You are given two integer arrays <code>nums</code> and <code>divisors</code>.</p>
<p>The <strong>divisibility score</strong> of <code>divisors[i]</code> is the number of indices <code>j</code> such that <code>nums[j]</code> is divisible by <code>divisors[i]</code>.</p>
<p>Return the integer <code>divisors[i]</code... | Easy | 36.2K | 72.1K | 36,175 | 72,051 | 50.2% | ['binary-prefix-divisible-by-5'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxDivScore(vector<int>& nums, vector<int>& divisors) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxDivScore(int[] nums, int[] divisors) {\n \n }\n}"}, {"value"... | [2,9,15,50]
[5,3,7,2] | {
"name": "maxDivScore",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "divisors"
}
],
"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,645 | Minimum Additions to Make Valid String | minimum-additions-to-make-valid-string | <p>Given a string <code>word</code> to which you can insert letters "a", "b" or "c" anywhere and any number of times, return <em>the minimum number of letters that must be inserted so that <code>word</code> becomes <strong>valid</strong>.</em></p>
<p>A string is called <strong>valid </str... | Medium | 33.6K | 67K | 33,556 | 67,002 | 50.1% | ['merge-strings-alternately'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int addMinimum(string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int addMinimum(String word) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "... | "b" | {
"name": "addMinimum",
"params": [
{
"name": "word",
"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', 'Stack', 'Greedy'] |
2,646 | Minimize the Total Price of the Trips | minimize-the-total-price-of-the-trips | <p>There exists an undirected and unrooted tree with <code>n</code> nodes indexed from <code>0</code> to <code>n - 1</code>. You are given the integer <code>n</code> and 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 ... | Hard | 11.4K | 25K | 11,408 | 24,990 | 45.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumTotalPrice(int n, vector<vector<int>>& edges, vector<int>& price, vector<vector<int>>& trips) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumTotalPrice(int n, i... | 4
[[0,1],[1,2],[1,3]]
[2,2,10,6]
[[0,3],[2,1],[2,3]] | {
"name": "minimumTotalPrice",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "edges"
},
{
"type": "integer[]",
"name": "price"
},
{
"type": "integer[][]",
"name": "trips"
}
],
"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... | ['Array', 'Dynamic Programming', 'Tree', 'Depth-First Search', 'Graph'] |
2,647 | Color the Triangle Red | color-the-triangle-red | null | Hard | 398 | 673 | 398 | 673 | 59.1% | [] | [] | Algorithms | null | 3 | {
"name": "colorRed",
"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... | ['Array', 'Math'] |
2,648 | Generate Fibonacci Sequence | generate-fibonacci-sequence | <p>Write a generator function that returns a generator object which yields the <strong>fibonacci sequence</strong>.</p>
<p>The <strong>fibonacci sequence</strong> is defined by the relation <code>X<sub>n</sub> = X<sub>n-1</sub> + X<sub>n-2</sub></code>.</p>
<p>The first few numbers of th... | Easy | 36.9K | 44.1K | 36,888 | 44,130 | 83.6% | ['nested-array-generator', 'design-cancellable-function'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @return {Generator<number>}\n */\nvar fibGenerator = function*() {\n \n};\n\n/**\n * const gen = fibGenerator();\n * gen.next().value; // 0\n * gen.next().value; // 1\n */"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "function*... | 5 | {
"name": "fibGenerator",
"params": [
{
"name": "callCount",
"type": "string"
}
],
"return": {
"type": "integer[]"
},
"languages": [
"typescript",
"javascript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,649 | Nested Array Generator | nested-array-generator | <p>Given a <strong>multi-dimensional array</strong> of integers, return a generator object which yields integers in the same order as <strong>inorder traversal</strong>.</p>
<p>A <strong>multi-dimensional array</strong> is a recursive data structure that contains both integers and other&n... | Medium | 15K | 18.8K | 15,003 | 18,833 | 79.7% | ['flatten-deeply-nested-array', 'generate-fibonacci-sequence', 'design-cancellable-function'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Array} arr\n * @return {Generator}\n */\nvar inorderTraversal = function*(arr) {\n \n};\n\n/**\n * const gen = inorderTraversal([1, [2, 3]]);\n * gen.next().value; // 1\n * gen.next().value; // 2\n * gen.next().value; // 3\n */"}, {"value... | [[[6]],[1,3],[]] | {
"name": "inorderTraveral",
"params": [
{
"name": "arr",
"type": "string"
}
],
"return": {
"type": "integer[]"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,650 | Design Cancellable Function | design-cancellable-function | <p>Sometimes you have a long running task, and you may wish to cancel it before it completes. To help with this goal, write a function <code>cancellable</code> that accepts a generator object and returns an array of two values: a <strong>cancel function</strong> and a <strong>promise</strong>.</p>
<p>You may assu... | Hard | 3K | 5.8K | 2,970 | 5,782 | 51.4% | ['generate-fibonacci-sequence', 'nested-array-generator'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Generator} generator\n * @return {[Function, Promise]}\n */\nvar cancellable = function(generator) {\n \n};\n\n/**\n * function* tasks() {\n * const val = yield new Promise(resolve => resolve(2 + 2));\n * yield new Promise(resolve => ... | function*() { return 42; }
{"cancelledAt":100} | {
"name": "cancellable",
"params": [
{
"name": "generator",
"type": "string"
},
{
"type": "integer",
"name": "cancelledAT"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,651 | Calculate Delayed Arrival Time | calculate-delayed-arrival-time | <p>You are given a positive integer <code>arrivalTime</code> denoting the arrival time of a train in hours, and another positive integer <code>delayedTime</code> denoting the amount of delay in hours.</p>
<p>Return <em>the time when the train will arrive at the station.</em></p>
<p>Note that the time in this problem ... | Easy | 69.3K | 90K | 69,297 | 90,045 | 77.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findDelayedArrivalTime(int arrivalTime, int delayedTime) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findDelayedArrivalTime(int arrivalTime, int delayedTime) {\n \n... | 15
5 | {
"name": "findDelayedArrivalTime",
"params": [
{
"name": "arrivalTime",
"type": "integer"
},
{
"type": "integer",
"name": "delayedTime"
}
],
"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'] |
2,652 | Sum Multiples | sum-multiples | <p>Given a positive integer <code>n</code>, find the sum of all integers in the range <code>[1, n]</code> <strong>inclusive</strong> that are divisible by <code>3</code>, <code>5</code>, or <code>7</code>.</p>
<p>Return <em>an integer denoting the sum of all numbers in the given range satisfying the constraint.</... | Easy | 140.5K | 165.2K | 140,451 | 165,199 | 85.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumOfMultiples(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumOfMultiples(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "clas... | 7 | {
"name": "sumOfMultiples",
"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'] |
2,654 | Minimum Number of Operations to Make All Array Elements Equal to 1 | minimum-number-of-operations-to-make-all-array-elements-equal-to-1 | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> consisiting of <strong>positive</strong> integers. You can do the following operation on the array <strong>any</strong> number of times:</p>
<ul>
<li>Select an index <code>i</code> such that <code>0 <= i < n - 1</code> and replace either... | Medium | 14K | 41.9K | 14,018 | 41,866 | 33.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa... | [2,6,3,4] | {
"name": "minOperations",
"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', 'Number Theory'] |
2,655 | Find Maximal Uncovered Ranges | find-maximal-uncovered-ranges | null | Medium | 1.7K | 3.5K | 1,691 | 3,478 | 48.6% | ['missing-ranges', 'summary-ranges', 'check-if-all-the-integers-in-a-range-are-covered'] | [] | Algorithms | null | 10
[[3,5],[7,8]] | {
"name": "findMaximalUncoveredRanges",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "ranges"
}
],
"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'] |
2,656 | Maximum Sum With Exactly K Elements | maximum-sum-with-exactly-k-elements | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and an integer <code>k</code>. Your task is to perform the following operation <strong>exactly</strong> <code>k</code> times in order to maximize your score:</p>
<ol>
<li>Select an element <code>m</code> from <code>nums</code>.</li>
<li>Re... | Easy | 89K | 111.9K | 89,049 | 111,852 | 79.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximizeSum(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximizeSum(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [1,2,3,4,5]
3 | {
"name": "maximizeSum",
"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', 'Greedy'] |
2,657 | Find the Prefix Common Array of Two Arrays | find-the-prefix-common-array-of-two-arrays | <p>You are given two <strong>0-indexed </strong>integer<strong> </strong>permutations <code>A</code> and <code>B</code> of length <code>n</code>.</p>
<p>A <strong>prefix common array</strong> of <code>A</code> and <code>B</code> is an array <code>C</code> such that <code>C[i]</code> is equal to the count of numbers th... | Medium | 214.3K | 246.2K | 214,314 | 246,162 | 87.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findThePrefixCommonArray(vector<int>& A, vector<int>& B) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findThePrefixCommonArray(int[] A, int[] B) {\n \n ... | [1,3,2,4]
[3,1,2,4] | {
"name": "findThePrefixCommonArray",
"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... | ['Array', 'Hash Table', 'Bit Manipulation'] |
2,658 | Maximum Number of Fish in a Grid | maximum-number-of-fish-in-a-grid | <p>You are given a <strong>0-indexed</strong> 2D matrix <code>grid</code> of size <code>m x n</code>, where <code>(r, c)</code> represents:</p>
<ul>
<li>A <strong>land</strong> cell if <code>grid[r][c] = 0</code>, or</li>
<li>A <strong>water</strong> cell containing <code>grid[r][c]</code> fish, if <code>grid[r][c] ... | Medium | 147.2K | 208.9K | 147,162 | 208,852 | 70.5% | ['number-of-islands', 'max-area-of-island'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMaxFish(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMaxFish(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [[0,2,1,0],[4,0,0,3],[1,0,0,4],[0,3,2,0]] | {
"name": "findMaxFish",
"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', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix'] |
2,659 | Make Array Empty | make-array-empty | <p>You are given an integer array <code>nums</code> containing <strong>distinct</strong> numbers, and you can perform the following operations <strong>until the array is empty</strong>:</p>
<ul>
<li>If the first element has the <strong>smallest</strong> value, remove it</li>
<li>Otherwise, put the first element at t... | Hard | 12.5K | 49.3K | 12,462 | 49,319 | 25.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countOperationsToEmptyArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countOperationsToEmptyArray(int[] nums) {\n \n }\n}"}, {"value"... | [3,4,-1] | {
"name": "countOperationsToEmptyArray",
"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', 'Binary Search', 'Greedy', 'Binary Indexed Tree', 'Segment Tree', 'Sorting', 'Ordered Set'] |
2,660 | Determine the Winner of a Bowling Game | determine-the-winner-of-a-bowling-game | <p>You are given two <strong>0-indexed</strong> integer arrays <code><font face="monospace">player1</font></code> and <code>player2</code>, representing the number of pins that player 1 and player 2 hit in a bowling game, respectively.</p>
<p>The bowling game consists of <code>n</code> turns, and the number of pins in... | Easy | 39.5K | 111.8K | 39,511 | 111,793 | 35.3% | ['high-five'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int isWinner(vector<int>& player1, vector<int>& player2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int isWinner(int[] player1, int[] player2) {\n \n }\n}"}, {"value": ... | [5,10,3,2]
[6,5,7,3] | {
"name": "isWinner",
"params": [
{
"name": "player1",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "player2"
}
],
"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', 'Simulation'] |
2,661 | First Completely Painted Row or Column | first-completely-painted-row-or-column | <p>You are given a <strong>0-indexed</strong> integer array <code>arr</code>, and an <code>m x n</code> integer <strong>matrix</strong> <code>mat</code>. <code>arr</code> and <code>mat</code> both contain <strong>all</strong> the integers in the range <code>[1, m * n]</code>.</p>
<p>Go through each index <code>i</code... | Medium | 152.4K | 238.3K | 152,436 | 238,324 | 64.0% | ['check-if-every-row-and-column-contains-all-numbers', 'difference-between-ones-and-zeros-in-row-and-column'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int firstCompleteIndex(vector<int>& arr, vector<vector<int>>& mat) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int firstCompleteIndex(int[] arr, int[][] mat) {\n \n }\n}... | [1,3,4,2]
[[1,4],[2,3]] | {
"name": "firstCompleteIndex",
"params": [
{
"name": "arr",
"type": "integer[]"
},
{
"type": "integer[][]",
"name": "mat"
}
],
"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', 'Matrix'] |
2,662 | Minimum Cost of a Path With Special Roads | minimum-cost-of-a-path-with-special-roads | <p>You are given an array <code>start</code> where <code>start = [startX, startY]</code> represents your initial position <code>(startX, startY)</code> in a 2D space. You are also given the array <code>target</code> where <code>target = [targetX, targetY]</code> represents your target position <code>(targetX, targetY)<... | Medium | 16K | 40K | 15,955 | 39,969 | 39.9% | ['minimum-path-sum', 'number-of-restricted-paths-from-first-to-last-node'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumCost(vector<int>& start, vector<int>& target, vector<vector<int>>& specialRoads) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumCost(int[] start, int[] target, ... | [1,1]
[4,5]
[[1,2,3,3,2],[3,4,4,5,1]] | {
"name": "minimumCost",
"params": [
{
"type": "integer[]",
"name": "start"
},
{
"type": "integer[]",
"name": "target"
},
{
"type": "integer[][]",
"name": "specialRoads"
}
],
"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', 'Graph', 'Heap (Priority Queue)', 'Shortest Path'] |
2,663 | Lexicographically Smallest Beautiful String | lexicographically-smallest-beautiful-string | <p>A string is <strong>beautiful</strong> if:</p>
<ul>
<li>It consists of the first <code>k</code> letters of the English lowercase alphabet.</li>
<li>It does not contain any substring of length <code>2</code> or more which is a palindrome.</li>
</ul>
<p>You are given a beautiful string <code>s</code> of length <co... | Hard | 9.5K | 24.5K | 9,538 | 24,506 | 38.9% | ['smallest-string-with-swaps', 'find-palindrome-with-fixed-length'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string smallestBeautifulString(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String smallestBeautifulString(String s, int k) {\n \n }\n}"}, {"value": "pyt... | "abcz"
26 | {
"name": "smallestBeautifulString",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "integer",
"name": "k"
}
],
"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', 'Greedy'] |
2,664 | The Knight’s Tour | the-knights-tour | null | Medium | 6.1K | 8.3K | 6,088 | 8,345 | 73.0% | [] | [] | Algorithms | null | 1
1
0
0 | {
"name": "tourOfKnight",
"params": [
{
"name": "m",
"type": "integer"
},
{
"type": "integer",
"name": "n"
},
{
"type": "integer",
"name": "r"
},
{
"type": "integer",
"name": "c"
}
],
"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', 'Backtracking', 'Matrix'] |
2,665 | Counter II | counter-ii | <p>Write a function <code>createCounter</code>. It should accept an initial integer <code>init</code>. It should return an object with three functions.</p>
<p>The three functions are:</p>
<ul>
<li><code>increment()</code> increases the current value by 1 and then returns it.</li>
<li><code>decre... | Easy | 306.6K | 378.6K | 306,639 | 378,581 | 81.0% | ['counter'] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {integer} init\n * @return { increment: Function, decrement: Function, reset: Function }\n */\nvar createCounter = function(init) {\n \n};\n\n/**\n * const counter = createCounter(5)\n * counter.increment(); // 6\n * counter.reset(); // 5\... | 5
["increment","reset","decrement"] | {
"name": "createCounter",
"params": [
{
"name": "init",
"type": "integer"
},
{
"type": "string[]",
"name": "calls"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,666 | Allow One Function Call | allow-one-function-call | <p>Given a function <code>fn</code>, return a new function that is identical to the original function except that it ensures <code>fn</code> is called at most once.</p>
<ul>
<li>The first time the returned function is called, it should return the same result as <code>fn</code>.</li>
<li>Every sub... | Easy | 155K | 179K | 154,983 | 178,989 | 86.6% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Function} fn\n * @return {Function}\n */\nvar once = function(fn) {\n \n return function(...args){\n \n }\n};\n\n/**\n * let fn = (a,b,c) => (a + b + c)\n * let onceFn = once(fn)\n *\n * onceFn(1,2,3); // 6\n * onceFn(2,3,6);... | (a,b,c) => (a + b + c)
[[1,2,3],[2,3,6]] | {
"name": "once",
"params": [
{
"name": "fn",
"type": "string"
},
{
"type": "string",
"name": "calls"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,667 | Create Hello World Function | create-hello-world-function | Write a function <code>createHelloWorld</code>. It should return a new function that always returns <code>"Hello World"</code>.
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> args = []
<strong>Output:</strong> "Hello World"
<strong>Expl... | Easy | 681.3K | 830.3K | 681,343 | 830,314 | 82.1% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @return {Function}\n */\nvar createHelloWorld = function() {\n \n return function(...args) {\n \n }\n};\n\n/**\n * const f = createHelloWorld();\n * f(); // \"Hello World\"\n */"}, {"value": "typescript", "text": "TypeScript", "defau... | [] | {
"name": "createHelloWorld",
"params": [
{
"name": "args",
"type": "string"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,668 | Find Latest Salaries | find-latest-salaries | null | Easy | 5.2K | 7K | 5,230 | 7,009 | 74.6% | [] | ['Create table If Not Exists Salary (emp_id int,firstname varchar(100),lastname varchar(100),salary int, department_id varchar(100))', 'Truncate table Salary', "insert into Salary (emp_id, firstname, lastname, salary, department_id) values ('1', 'Todd', 'Wilson', '110000', 'D1006')", "insert into Salary (emp_id, firstn... | Database | null | {"headers":{"Salary":["emp_id","firstname","lastname","salary","department_id"]},"rows":{"Salary":[[1,"Todd","Wilson",110000,"D1006"],[1,"Todd","Wilson",106119,"D1006"],[2,"Justin","Simon",128922,"D1005"],[2,"Justin","Simon",130000,"D1005"],[3,"Kelly","Rosario",42689,"D1002"],[4,"Patricia","Powell",162825,"D1004"],[4,"... | {"mysql": ["Create table If Not Exists Salary (emp_id int,firstname varchar(100),lastname varchar(100),salary int, department_id varchar(100))"], "mssql": ["Create table Salary (emp_id int,firstname varchar(100),lastname varchar(100),salary int, department_id varchar(100))"], "oraclesql": ["Create table Salary (emp_id... | {"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,669 | Count Artist Occurrences On Spotify Ranking List | count-artist-occurrences-on-spotify-ranking-list | null | Easy | 4.7K | 6.4K | 4,740 | 6,395 | 74.1% | [] | ['Create table If Not Exists Spotify (id int,track_name varchar(100),artist varchar(100))', 'Truncate table Spotify', "insert into Spotify (id, track_name, artist) values ('303651', 'Heart Won't Forget', 'Ed Sheeran')", "insert into Spotify (id, track_name, artist) values ('1046089', 'Shape of you', 'Sia')", "insert in... | Database | null | {"headers":{"Spotify":["id","track_name","artist"]},"rows":{"Spotify":[[303651,"Heart Won't Forget","Ed Sheeran"],[1046089,"Shape of you","Sia"],[33445,"I'm the one","DJ Khalid"],[811266,"Young Dumb & Broke","DJ Khalid"],[505727,"Happier","Ed Sheeran"]]}} | {"mysql": ["Create table If Not Exists Spotify (id int,track_name varchar(100),artist varchar(100))"], "mssql": ["Create table Spotify (id int,track_name varchar(100),artist varchar(100))"], "oraclesql": ["Create table Spotify (id int,track_name varchar(100),artist varchar(100))"], "database": true, "name": "count_occ... | {"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,670 | Find the Distinct Difference Array | find-the-distinct-difference-array | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> of length <code>n</code>.</p>
<p>The <strong>distinct difference</strong> array of <code>nums</code> is an array <code>diff</code> of length <code>n</code> such that <code>diff[i]</code> is equal to the number of distinct elements in the suffix <cod... | Easy | 45.1K | 59.4K | 45,071 | 59,432 | 75.8% | ['left-and-right-sum-differences'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> distinctDifferenceArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] distinctDifferenceArray(int[] nums) {\n \n }\n}"}, {"value": "py... | [1,2,3,4,5] | {
"name": "distinctDifferenceArray",
"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'] |
2,671 | Frequency Tracker | frequency-tracker | <p>Design a data structure that keeps track of the values in it and answers some queries regarding their frequencies.</p>
<p>Implement the <code>FrequencyTracker</code> class.</p>
<ul>
<li><code>FrequencyTracker()</code>: Initializes the <code>FrequencyTracker</code> object with an empty array initially.</li>
<li><... | Medium | 25.2K | 81.6K | 25,174 | 81,589 | 30.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class FrequencyTracker {\npublic:\n FrequencyTracker() {\n \n }\n \n void add(int number) {\n \n }\n \n void deleteOne(int number) {\n \n }\n \n bool hasFrequency(int frequency) {\n \n }\n};\n\n/**\n * Your Fre... | ["FrequencyTracker","add","add","hasFrequency"]
[[],[3],[3],[2]] | {
"classname": "FrequencyTracker",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "number"
}
],
"name": "add",
"return": {
"type": "void"
}
},
{
"params": [
{
... | {"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', 'Design'] |
2,672 | Number of Adjacent Elements With the Same Color | number-of-adjacent-elements-with-the-same-color | <p>You are given an integer <code>n</code> representing an array <code>colors</code> of length <code>n</code> where all elements are set to 0's meaning <strong>uncolored</strong>. You are also given a 2D integer array <code>queries</code> where <code>queries[i] = [index<sub>i</sub>, color<sub>i</sub>]</code>. For t... | Medium | 18K | 33K | 17,965 | 33,019 | 54.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> colorTheArray(int n, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] colorTheArray(int n, int[][] queries) {\n \n }\n}"}, {"v... | 4
[[0,2],[1,2],[3,1],[1,1],[2,1]] | {
"name": "colorTheArray",
"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'] |
2,673 | Make Costs of Paths Equal in a Binary Tree | make-costs-of-paths-equal-in-a-binary-tree | <p>You are given an integer <code>n</code> representing the number of nodes in a <strong>perfect binary tree</strong> consisting of nodes numbered from <code>1</code> to <code>n</code>. The root of the tree is node <code>1</code> and each node <code>i</code> in the tree has two children where the left child is the node... | Medium | 19.9K | 35.5K | 19,942 | 35,500 | 56.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minIncrements(int n, vector<int>& cost) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minIncrements(int n, int[] cost) {\n \n }\n}"}, {"value": "python", "text": "... | 7
[1,5,2,2,3,3,1] | {
"name": "minIncrements",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[]",
"name": "cost"
}
],
"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', 'Greedy', 'Tree', 'Binary Tree'] |
2,674 | Split a Circular Linked List | split-a-circular-linked-list | null | Medium | 2.4K | 3.1K | 2,378 | 3,118 | 76.3% | ['split-linked-list-in-parts'] | [] | Algorithms | null | [1,5,7] | {
"name": "splitCircularLinkedList",
"params": [
{
"name": "list",
"type": "ListNode"
}
],
"return": {
"type": "ListNode[]"
},
"manual": true,
"languages": [
"cpp",
"java",
"python",
"c",
"csharp",
"javascript",
"ruby",
"swift",
"golang",
"py... | {"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', 'Two Pointers'] |
2,675 | Array of Objects to Matrix | array-of-objects-to-matrix | null | Hard | 6.1K | 8.8K | 6,057 | 8,821 | 68.7% | ['json-deep-equal', 'convert-object-to-json-string'] | [] | JavaScript | null | [{"b":1,"a":2},{"b":3,"a":4}] | {
"name": "jsonToMatrix",
"params": [
{
"name": "arr",
"type": "string"
}
],
"return": {
"type": "string"
},
"languages": [
"typescript",
"javascript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,676 | Throttle | throttle | null | Medium | 10.4K | 12.5K | 10,442 | 12,547 | 83.2% | ['debounce', 'promise-time-limit', 'promise-pool'] | [] | JavaScript | null | 100
[{"t":20,"inputs":[1]}] | {
"name": "throttle",
"params": [
{
"name": "t",
"type": "integer"
},
{
"type": "string",
"name": "fn"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,677 | Chunk Array | chunk-array | <p>Given an array <code>arr</code> and a chunk size <code>size</code>, return a <strong>chunked</strong> array.</p>
<p>A <strong>chunked</strong> array contains the original elements in <code>arr</code>, but consists of subarrays each of length <code>size</code>. The length of t... | Easy | 89.2K | 105.6K | 89,195 | 105,619 | 84.4% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Array} arr\n * @param {number} size\n * @return {Array}\n */\nvar chunk = function(arr, size) {\n \n};\n"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "type JSONValue = null | boolean | number | string | JSONValue[] | { ... | [1,2,3,4,5]
1 | {
"name": "chunkify",
"params": [
{
"name": "arr",
"type": "string"
},
{
"type": "integer",
"name": "size"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,678 | Number of Senior Citizens | number-of-senior-citizens | <p>You are given a <strong>0-indexed</strong> array of strings <code>details</code>. Each element of <code>details</code> provides information about a given passenger compressed into a string of length <code>15</code>. The system is such that:</p>
<ul>
<li>The first ten characters consist of the phone number of passe... | Easy | 275.2K | 338.5K | 275,228 | 338,470 | 81.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSeniors(vector<string>& details) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSeniors(String[] details) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | ["7868190130M7522","5303914400F9211","9273338290F4010"] | {
"name": "countSeniors",
"params": [
{
"name": "details",
"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,679 | Sum in a Matrix | sum-in-a-matrix | <p>You are given a <strong>0-indexed</strong> 2D integer array <code>nums</code>. Initially, your score is <code>0</code>. Perform the following operations until the matrix becomes empty:</p>
<ol>
<li>From each row in the matrix, select the largest number and remove it. In the case of a tie, it does not matter which ... | Medium | 40.8K | 69.4K | 40,816 | 69,405 | 58.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int matrixSum(vector<vector<int>>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int matrixSum(int[][] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [[7,2,1],[6,4,2],[6,5,3],[3,2,1]] | {
"name": "matrixSum",
"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', 'Sorting', 'Heap (Priority Queue)', 'Matrix', 'Simulation'] |
2,680 | Maximum OR | maximum-or | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> of length <code>n</code> and an integer <code>k</code>. In an operation, you can choose an element and multiply it by <code>2</code>.</p>
<p>Return <em>the maximum possible value of </em><code>nums[0] | nums[1] | ... | nums[n - 1]</code> <em... | Medium | 16K | 39K | 15,976 | 39,026 | 40.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumOr(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumOr(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "P... | [12,9]
1 | {
"name": "maximumOr",
"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', 'Greedy', 'Bit Manipulation', 'Prefix Sum'] |
2,681 | Power of Heroes | power-of-heroes | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> representing the strength of some heroes. The<b> power</b> of a group of heroes is defined as follows:</p>
<ul>
<li>Let <code>i<sub>0</sub></code>, <code>i<sub>1</sub></code>, ... ,<code>i<sub>k</sub></code> be the indices of the heroes in ... | Hard | 10.7K | 36.5K | 10,693 | 36,453 | 29.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumOfPower(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumOfPower(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod... | [2,1,4] | {
"name": "sumOfPower",
"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', 'Sorting', 'Prefix Sum'] |
2,682 | Find the Losers of the Circular Game | find-the-losers-of-the-circular-game | <p>There are <code>n</code> friends that are playing a game. The friends are sitting in a circle and are numbered from <code>1</code> to <code>n</code> in <strong>clockwise order</strong>. More formally, moving clockwise from the <code>i<sup>th</sup></code> friend brings you to the <code>(i+1)<sup>th</sup></code> frien... | Easy | 30.8K | 63.2K | 30,766 | 63,205 | 48.7% | ['find-the-child-who-has-the-ball-after-k-seconds'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> circularGameLosers(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] circularGameLosers(int n, int k) {\n \n }\n}"}, {"value": "python", "text"... | 5
2 | {
"name": "circularGameLosers",
"params": [
{
"name": "n",
"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', 'Hash Table', 'Simulation'] |
2,683 | Neighboring Bitwise XOR | neighboring-bitwise-xor | <p>A <strong>0-indexed</strong> array <code>derived</code> with length <code>n</code> is derived by computing the <strong>bitwise XOR</strong> (⊕) of adjacent values in a <strong>binary array</strong> <code>original</code> of length <code>n</code>.</p>
<p>Specifically, for each index <code>i</code> in the r... | Medium | 157K | 196.9K | 156,969 | 196,860 | 79.7% | ['bitwise-or-of-adjacent-elements'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool doesValidArrayExist(vector<int>& derived) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean doesValidArrayExist(int[] derived) {\n \n }\n}"}, {"value": "python", ... | [1,1,0] | {
"name": "doesValidArrayExist",
"params": [
{
"name": "derived",
"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... | ['Array', 'Bit Manipulation'] |
2,684 | Maximum Number of Moves in a Grid | maximum-number-of-moves-in-a-grid | <p>You are given a <strong>0-indexed</strong> <code>m x n</code> matrix <code>grid</code> consisting of <strong>positive</strong> integers.</p>
<p>You can start at <strong>any</strong> cell in the first column of the matrix, and traverse the grid in the following way:</p>
<ul>
<li>From a cell <code>(row, col)</code>... | Medium | 128.1K | 217.7K | 128,136 | 217,723 | 58.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxMoves(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxMoves(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa... | [[2,4,3,5],[5,4,9,3],[3,4,2,11],[10,9,13,15]] | {
"name": "maxMoves",
"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', 'Dynamic Programming', 'Matrix'] |
2,685 | Count the Number of Complete Components | count-the-number-of-complete-components | <p>You are given an integer <code>n</code>. There is an <strong>undirected</strong> graph with <code>n</code> vertices, numbered from <code>0</code> to <code>n - 1</code>. You are given a 2D integer array <code>edges</code> where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> denotes that there exists an <stron... | Medium | 135.2K | 174.1K | 135,248 | 174,121 | 77.7% | ['number-of-connected-components-in-an-undirected-graph'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countCompleteComponents(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countCompleteComponents(int n, int[][] edges) {\n \n }\n}"... | 6
[[0,1],[0,2],[1,2],[3,4]] | {
"name": "countCompleteComponents",
"params": [
{
"name": "n",
"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... | ['Depth-First Search', 'Breadth-First Search', 'Union Find', 'Graph'] |
2,686 | Immediate Food Delivery III | immediate-food-delivery-iii | null | Medium | 4.5K | 6.5K | 4,469 | 6,452 | 69.3% | [] | ['Create table If Not Exists Delivery (delivery_id int, customer_id int, order_date date, customer_pref_delivery_date date)', 'Truncate table Delivery', "insert into Delivery (delivery_id, customer_id, order_date, customer_pref_delivery_date) values ('1', '1', '2019-08-01', '2019-08-02')", "insert into Delivery (delive... | Database | null | {"headers":{"Delivery":["delivery_id","customer_id","order_date","customer_pref_delivery_date"]},"rows":{"Delivery":[[1,1,"2019-08-01","2019-08-02"],[2,2,"2019-08-01","2019-08-01"],[3,1,"2019-08-01","2019-08-01"],[4,3,"2019-08-02","2019-08-13"],[5,3,"2019-08-02","2019-08-02"],[6,2,"2019-08-02","2019-08-02"],[7,4,"2019-... | {"mysql": ["Create table If Not Exists Delivery (delivery_id int, customer_id int, order_date date, customer_pref_delivery_date date)"], "mssql": ["Create table Delivery (delivery_id int, customer_id int, order_date date, customer_pref_delivery_date date)"], "oraclesql": ["Create table Delivery (delivery_id int, custom... | {"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,687 | Bikes Last Time Used | bikes-last-time-used | null | Easy | 5K | 6.2K | 5,006 | 6,160 | 81.3% | [] | ['Create table If Not Exists Bikes (ride_id int,bike_number varchar(100), start_time datetime,end_time datetime)', 'Truncate table Bikes', "insert into Bikes (ride_id, bike_number, start_time, end_time) values ('1', 'W00576', '2012-03-25 11:30:00', '2012-03-25 12:40:00')", "insert into Bikes (ride_id, bike_number, star... | Database | null | {"headers":{"Bikes":["ride_id","bike_number","start_time","end_time"]},"rows":{"Bikes":[[1,"W00576","2012-03-25 11:30:00","2012-03-25 12:40:00"],[2,"W00300","2012-03-25 10:30:00","2012-03-25 10:50:00"],[3,"W00455","2012-03-26 14:30:00","2012-03-26 17:40:00"],[4,"W00455","2012-03-25 12:30:00","2012-03-25 13:40:00"],[5,"... | {"mysql": ["Create table If Not Exists Bikes (ride_id int,bike_number varchar(100), start_time datetime,end_time datetime)"], "mssql": ["Create table Bikes (ride_id int,bike_number varchar(100), start_time datetime,end_time datetime)"], "oraclesql": ["Create table Bikes (ride_id int,bike_number varchar(100), start_ti... | {"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,688 | Find Active Users | find-active-users | null | Medium | 4.6K | 10.3K | 4,576 | 10,330 | 44.3% | [] | ['Create table If Not Exists Users (user_id int, item varchar(100),created_at date,amount int)', 'Truncate table Users', "insert into Users (user_id, item, created_at, amount) values ('5', 'Smart Crock Pot', '2021-09-18', '698882')", "insert into Users (user_id, item, created_at, amount) values ('6', 'Smart Lock', '202... | Database | null | {"headers":{"Users":["user_id","item","created_at","amount"]},"rows":{"Users":[[5,"Smart Crock Pot","2021-09-18",698882],[6,"Smart Lock","2021-09-14",11487],[6,"Smart Thermostat","2021-09-10",674762],[8,"Smart Light Strip","2021-09-29",630773],[4,"Smart Cat Feeder","2021-09-02",693545],[4,"Smart Bed","2021-09-13",17024... | {"mysql": ["Create table If Not Exists Users (user_id int, item varchar(100),created_at date,amount int)"], "mssql": ["Create table Users (user_id int, item varchar(100),created_at date,amount int)"], "oraclesql": ["Create table Users (user_id int, item varchar(100),created_at date,amount int)", "ALTER SESSION SET nls_... | {"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,689 | Extract Kth Character From The Rope Tree | extract-kth-character-from-the-rope-tree | null | Easy | 3.9K | 5.2K | 3,852 | 5,206 | 74.0% | [] | [] | Algorithms | null | [10,4,"abcpoe","g","rta"]
6 | {
"name": "getKthCharacter",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "character"
},
"languages": [
"cpp",
"java",
"python",
"c",
"csharp",
"javascript",
"swift",
... | {"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', 'Binary Tree'] |
2,690 | Infinite Method Object | infinite-method-object | null | Easy | 1.7K | 1.8K | 1,689 | 1,816 | 93.0% | ['immutability-helper', 'make-object-immutable'] | [] | JavaScript | null | "abc123" | {
"name": "createInfiniteObject",
"params": [
{
"type": "string",
"name": "method"
}
],
"return": {
"type": "string"
},
"manual": true,
"languages": [
"javascript",
"typescript"
]
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,691 | Immutability Helper | immutability-helper | null | Hard | 322 | 784 | 322 | 784 | 41.1% | ['infinite-method-object', 'make-object-immutable'] | [] | JavaScript | null | {"val":10}
[proxy => { proxy.val += 1; }, proxy => { proxy.val -= 1; }] | {
"name": "produce",
"params": [
{
"name": "obj",
"type": "string"
},
{
"type": "string",
"name": "mutator"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,692 | Make Object Immutable | make-object-immutable | null | Medium | 585 | 900 | 585 | 900 | 65.0% | ['infinite-method-object', 'immutability-helper'] | [] | JavaScript | null | {"x":5}
(obj) => { obj.x = 5; return obj.x; } | {
"name": "makeImmutable",
"params": [
{
"name": "obj",
"type": "string"
},
{
"type": "string",
"name": "fn"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,693 | Call Function with Custom Context | call-function-with-custom-context | <p>Enhance all functions to have the <code>callPolyfill</code> method. The method accepts an object <code>obj</code> as its first parameter and any number of additional arguments. The <code>obj</code> becomes the <code>this</code> context for the function. The additional argument... | Medium | 12.1K | 15.3K | 12,080 | 15,341 | 78.7% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Object} context\n * @param {Array} args\n * @return {null|boolean|number|string|Array|Object}\n */\nFunction.prototype.callPolyfill = function(context, ...args) {\n \n}\n\n/**\n * function increment() { this.count++; return this.count; }\... | function add(b) { return this.a + b; }
[{"a":5},7] | {
"name": "callPolyfill",
"params": [
{
"type": "string",
"name": "context"
},
{
"type": "string",
"name": "args"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,694 | Event Emitter | event-emitter | <p>Design an <code>EventEmitter</code> class. This interface is similar (but with some differences) to the one found in Node.js or the Event Target interface of the DOM. The <code>EventEmitter</code> should allow for subscribing to events and emitting them.</p>
<p>Your <code>EventEmitter</code> class should have ... | Medium | 35.9K | 48.3K | 35,933 | 48,303 | 74.4% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "class EventEmitter {\n \n /**\n * @param {string} eventName\n * @param {Function} callback\n * @return {Object}\n */\n subscribe(eventName, callback) {\n \n return {\n unsubscribe: () => {\n \... | ["EventEmitter", "emit", "subscribe", "subscribe", "emit"]
[[], ["firstEvent"], ["firstEvent", "function cb1() { return 5; }"], ["firstEvent", "function cb1() { return 6; }"], ["firstEvent"]] | {
"name": "EventEmitter",
"params": [
{
"type": "string[]",
"name": "actions"
},
{
"type": "character[][]",
"name": "values"
}
],
"return": {
"type": "void"
},
"languages": [
"typescript",
"javascript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,695 | Array Wrapper | array-wrapper | <p>Create a class <code>ArrayWrapper</code> that accepts an array of integers in its constructor. This class should have two features:</p>
<ul>
<li>When two instances of this class are added together with the <code>+</code> operator, the resulting value is the sum of all the elements in both ... | Easy | 56.3K | 63.2K | 56,318 | 63,198 | 89.1% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {number[]} nums\n * @return {void}\n */\nvar ArrayWrapper = function(nums) {\n \n};\n\n/**\n * @return {number}\n */\nArrayWrapper.prototype.valueOf = function() {\n \n}\n\n/**\n * @return {string}\n */\nArrayWrapper.prototype.toString ... | [[1,2],[3,4]]
"Add" | {
"name": "ArrayWrapper",
"params": [
{
"name": "nums",
"type": "integer[][]"
},
{
"type": "string",
"name": "operation"
}
],
"return": {
"type": "string"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,696 | Minimum String Length After Removing Substrings | minimum-string-length-after-removing-substrings | <p>You are given a string <code>s</code> consisting only of <strong>uppercase</strong> English letters.</p>
<p>You can apply some operations to this string where, in one operation, you can remove <strong>any</strong> occurrence of one of the substrings <code>"AB"</code> or <code>"CD"</code> from <c... | Easy | 226.5K | 294K | 226,528 | 293,966 | 77.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minLength(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minLength(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So... | "ABFCACDB" | {
"name": "minLength",
"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', 'Stack', 'Simulation'] |
2,697 | Lexicographically Smallest Palindrome | lexicographically-smallest-palindrome | <p>You are given a string <code node="[object Object]">s</code> consisting of <strong>lowercase English letters</strong>, and you are allowed to perform operations on it. In one operation, you can <strong>replace</strong> a character in <code node="[object Object]">s</code> with another lowercase English letter.</p>
<... | Easy | 66.1K | 83.8K | 66,136 | 83,783 | 78.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string makeSmallestPalindrome(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String makeSmallestPalindrome(String s) {\n \n }\n}"}, {"value": "python", "text": "P... | "egcfe" | {
"name": "makeSmallestPalindrome",
"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... | ['Two Pointers', 'String', 'Greedy'] |
2,698 | Find the Punishment Number of an Integer | find-the-punishment-number-of-an-integer | <p>Given a positive integer <code>n</code>, return <em>the <strong>punishment number</strong></em> of <code>n</code>.</p>
<p>The <strong>punishment number</strong> of <code>n</code> is defined as the sum of the squares of all integers <code>i</code> such that:</p>
<ul>
<li><code>1 <= i <= n</code></li>
<li>Th... | Medium | 142.4K | 174K | 142,407 | 173,995 | 81.8% | ['number-of-great-partitions'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int punishmentNumber(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int punishmentNumber(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "... | 10 | {
"name": "punishmentNumber",
"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', 'Backtracking'] |
2,699 | Modify Graph Edge Weights | modify-graph-edge-weights | <p>You are given an <strong>undirected weighted</strong> <strong>connected</strong> graph containing <code>n</code> nodes labeled from <code>0</code> to <code>n - 1</code>, and an integer array <code>edges</code> where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>, w<sub>i</sub>]</code> indicates that there is an edge... | Hard | 65.8K | 117.1K | 65,779 | 117,140 | 56.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> modifiedGraphEdges(int n, vector<vector<int>>& edges, int source, int destination, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] modifiedGrap... | 5
[[4,1,-1],[2,0,-1],[0,3,-1],[4,3,-1]]
0
1
5 | {
"name": "modifiedGraphEdges",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "edges"
},
{
"type": "integer",
"name": "source"
},
{
"type": "integer",
"name": "destination"
},
{
"type": "inte... | {"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... | ['Graph', 'Heap (Priority Queue)', 'Shortest Path'] |
2,700 | Differences Between Two Objects | differences-between-two-objects | null | Medium | 7.6K | 10.1K | 7,625 | 10,140 | 75.2% | ['json-deep-equal', 'convert-object-to-json-string'] | [] | JavaScript | null | {}
{"a": 1, "b": 2} | {
"name": "objDiff",
"params": [
{
"name": "obj1",
"type": "string"
},
{
"type": "string",
"name": "obj2"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,701 | Consecutive Transactions with Increasing Amounts | consecutive-transactions-with-increasing-amounts | null | Hard | 4.2K | 12.3K | 4,190 | 12,318 | 34.0% | [] | ['Create table If Not Exists Transactions (transaction_id int, customer_id int, transaction_date date, amount int)', 'Truncate table Transactions', "insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('1', '101', '2023-05-01', '100')", "insert into Transactions (transaction_id, cust... | Database | null | {"headers":{"Transactions":["transaction_id","customer_id","transaction_date","amount"]},"rows":{"Transactions":[[1,101,"2023-05-01",100],[2,101,"2023-05-02",150],[3,101,"2023-05-03",200],[4,102,"2023-05-01",50],[5,102,"2023-05-03",100],[6,102,"2023-05-04",200],[7,105,"2023-05-01",100],[8,105,"2023-05-02",150],[9,105,"... | {"mysql": ["Create table If Not Exists Transactions (transaction_id int, customer_id int, transaction_date date, amount int)"], "mssql": ["Create table Transactions (transaction_id int, customer_id int, transaction_date date, amount int)"], "oraclesql": ["Create table Transactions (transaction_id int, customer_id int, ... | {"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,702 | Minimum Operations to Make Numbers Non-positive | minimum-operations-to-make-numbers-non-positive | null | Hard | 4.6K | 11K | 4,579 | 11,014 | 41.6% | [] | [] | Algorithms | null | [3,4,1,7,6]
4
2 | {
"name": "minOperations",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "x"
},
{
"type": "integer",
"name": "y"
}
],
"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'] |
2,703 | Return Length of Arguments Passed | return-length-of-arguments-passed | Write a function <code>argumentsLength</code> that returns the count of arguments passed to it.
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> args = [5]
<strong>Output:</strong> 1
<strong>Explanation:</strong>
argumentsLength(5); // 1
One value was passed to the f... | Easy | 235.6K | 249.5K | 235,631 | 249,461 | 94.5% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {...(null|boolean|number|string|Array|Object)} args\n * @return {number}\n */\nvar argumentsLength = function(...args) {\n \n};\n\n/**\n * argumentsLength(1, 2, 3); // 3\n */"}, {"value": "typescript", "text": "TypeScript", "defaultCode": ... | [5] | {
"name": "argumentsLength",
"params": [
{
"type": "string",
"name": "args"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,704 | To Be Or Not To Be | to-be-or-not-to-be | <p>Write a function <code>expect</code> that helps developers test their code. It should take in any value <code>val</code> and return an object with the following two functions.</p>
<ul>
<li><code>toBe(val)</code> accepts another value and returns <code>true</code> if the two values&nbs... | Easy | 280.9K | 446.8K | 280,866 | 446,833 | 62.9% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {string} val\n * @return {Object}\n */\nvar expect = function(val) {\n \n};\n\n/**\n * expect(5).toBe(5); // true\n * expect(5).notToBe(5); // throws \"Equal\"\n */"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "type ToBe... | () => expect(5).toBe(5) | {
"name": "expect",
"params": [
{
"name": "func",
"type": "string"
}
],
"return": {
"type": "integer"
},
"manual": true,
"languages": [
"javascript",
"typescript"
]
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,705 | Compact Object | compact-object | <p>Given an object or array <code>obj</code>, return a <strong>compact object</strong>.</p>
<p>A <strong>compact object</strong> is the same as the original object, except with keys containing <strong>falsy</strong> values removed. This operation applies to the object and any nested objects. Arrays are consi... | Medium | 35.6K | 53.4K | 35,647 | 53,449 | 66.7% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Object|Array} obj\n * @return {Object|Array}\n */\nvar compactObject = function(obj) {\n \n};"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "type JSONValue = null | boolean | number | string | JSONValue[] | { [key: strin... | [null, 0, false, 1] | {
"name": "compactObject",
"params": [
{
"name": "obj",
"type": "string"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,706 | Buy Two Chocolates | buy-two-chocolates | <p>You are given an integer array <code>prices</code> representing the prices of various chocolates in a store. You are also given a single integer <code>money</code>, which represents your initial amount of money.</p>
<p>You must buy <strong>exactly</strong> two chocolates in such a way that you still have some <stro... | Easy | 202.1K | 296.1K | 202,075 | 296,081 | 68.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int buyChoco(vector<int>& prices, int money) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int buyChoco(int[] prices, int money) {\n \n }\n}"}, {"value": "python", "text":... | [1,2,2]
3 | {
"name": "buyChoco",
"params": [
{
"name": "prices",
"type": "integer[]"
},
{
"type": "integer",
"name": "money"
}
],
"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,707 | Extra Characters in a String | extra-characters-in-a-string | <p>You are given a <strong>0-indexed</strong> string <code>s</code> and a dictionary of words <code>dictionary</code>. You have to break <code>s</code> into one or more <strong>non-overlapping</strong> substrings such that each substring is present in <code>dictionary</code>. There may be some <strong>extra characters<... | Medium | 187K | 328K | 186,959 | 328,045 | 57.0% | ['word-break'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minExtraChar(string s, vector<string>& dictionary) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minExtraChar(String s, String[] dictionary) {\n \n }\n}"}, {"value... | "leetscode"
["leet","code","leetcode"] | {
"name": "minExtraChar",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "string[]",
"name": "dictionary"
}
],
"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', 'Dynamic Programming', 'Trie'] |
2,708 | Maximum Strength of a Group | maximum-strength-of-a-group | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> representing the score of students in an exam. The teacher would like to form one <strong>non-empty</strong> group of students with maximal <strong>strength</strong>, where the strength of a group of students of indices <code>i<sub>0</sub></c... | Medium | 32.8K | 133.7K | 32,843 | 133,696 | 24.6% | ['maximum-strength-of-k-disjoint-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxStrength(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxStrength(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "d... | [3,-1,-5,2,5,-9] | {
"name": "maxStrength",
"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', 'Dynamic Programming', 'Backtracking', 'Greedy', 'Bit Manipulation', 'Sorting', 'Enumeration'] |
2,709 | Greatest Common Divisor Traversal | greatest-common-divisor-traversal | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>, and you are allowed to <strong>traverse</strong> between its indices. You can traverse between index <code>i</code> and index <code>j</code>, <code>i != j</code>, if and only if <code>gcd(nums[i], nums[j]) > 1</code>, where <code>gcd</cod... | Hard | 72.8K | 174.1K | 72,765 | 174,087 | 41.8% | ['graph-connectivity-with-threshold'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canTraverseAllPairs(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canTraverseAllPairs(int[] nums) {\n \n }\n}"}, {"value": "python", "text"... | [2,3,6] | {
"name": "canTraverseAllPairs",
"params": [
{
"name": "nums",
"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... | ['Array', 'Math', 'Union Find', 'Number Theory'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.