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,710 | Remove Trailing Zeros From a String | remove-trailing-zeros-from-a-string | <p>Given a <strong>positive</strong> integer <code>num</code> represented as a string, return <em>the integer </em><code>num</code><em> without trailing zeros as a string</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> num = "51230100"
<strong>Output:... | Easy | 79.5K | 101.3K | 79,483 | 101,300 | 78.5% | ['check-if-bitwise-or-has-trailing-zeros'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string removeTrailingZeros(string num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String removeTrailingZeros(String num) {\n \n }\n}"}, {"value": "python", "text": "Pyt... | "51230100" | {
"name": "removeTrailingZeros",
"params": [
{
"name": "num",
"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... | ['String'] |
2,711 | Difference of Number of Distinct Values on Diagonals | difference-of-number-of-distinct-values-on-diagonals | <p>Given a 2D <code>grid</code> of size <code>m x n</code>, you should find the matrix <code>answer</code> of size <code>m x n</code>.</p>
<p>The cell <code>answer[r][c]</code> is calculated by looking at the diagonal values of the cell <code>grid[r][c]</code>:</p>
<ul>
<li>Let <code>leftAbove[r][c]</code> be the nu... | Medium | 21.2K | 31.3K | 21,170 | 31,317 | 67.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> differenceOfDistinctValues(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] differenceOfDistinctValues(int[][] grid) {\n \... | [[1,2,3],[3,1,5],[3,2,1]] | {
"name": "differenceOfDistinctValues",
"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', 'Hash Table', 'Matrix'] |
2,712 | Minimum Cost to Make All Characters Equal | minimum-cost-to-make-all-characters-equal | <p>You are given a <strong>0-indexed</strong> binary string <code>s</code> of length <code>n</code> on which you can apply two types of operations:</p>
<ul>
<li>Choose an index <code>i</code> and invert all characters from index <code>0</code> to index <code>i</code> (both inclusive), with a cost of <code>i... | Medium | 20.5K | 38.7K | 20,517 | 38,673 | 53.1% | ['flip-string-to-monotone-increasing'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumCost(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumCost(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode"... | "0011" | {
"name": "minimumCost",
"params": [
{
"name": "s",
"type": "string"
}
],
"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... | ['String', 'Dynamic Programming', 'Greedy'] |
2,713 | Maximum Strictly Increasing Cells in a Matrix | maximum-strictly-increasing-cells-in-a-matrix | <p>Given a <strong>1-indexed</strong> <code>m x n</code> integer matrix <code>mat</code>, you can select any cell in the matrix as your <strong>starting cell</strong>.</p>
<p>From the starting cell, you can move to any other cell <strong>in the</strong> <strong>same row or column</strong>, but only if the value o... | Hard | 15K | 49.1K | 14,958 | 49,099 | 30.5% | ['number-of-increasing-paths-in-a-grid'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxIncreasingCells(vector<vector<int>>& mat) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxIncreasingCells(int[][] mat) {\n \n }\n}"}, {"value": "python", "text... | [[3,1],[3,4]] | {
"name": "maxIncreasingCells",
"params": [
{
"name": "mat",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Binary Search', 'Dynamic Programming', 'Memoization', 'Sorting', 'Matrix', 'Ordered Set'] |
2,714 | Find Shortest Path with K Hops | find-shortest-path-with-k-hops | null | Hard | 1.3K | 2.1K | 1,287 | 2,081 | 61.8% | [] | [] | Algorithms | null | 4
[[0,1,4],[0,2,2],[2,3,6]]
1
3
2 | {
"name": "shortestPathWithHops",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "edges"
},
{
"type": "integer",
"name": "s"
},
{
"type": "integer",
"name": "d"
},
{
"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... | ['Graph', 'Heap (Priority Queue)', 'Shortest Path'] |
2,715 | Timeout Cancellation | timeout-cancellation | <p>Given a function <code>fn</code>, an array of arguments <code>args</code>, and a timeout <code>t</code> in milliseconds, return a cancel function <code>cancelFn</code>.</p>
<p>After a delay of <code>cancelTimeMs</code>, the returned cancel function <code>cancelFn</code> will be invoked.</p>
<pr... | Easy | 77.5K | 86.6K | 77,512 | 86,590 | 89.5% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Function} fn\n * @param {Array} args\n * @param {number} t\n * @return {Function}\n */\nvar cancellable = function(fn, args, t) {\n \n};\n\n/**\n * const result = [];\n *\n * const fn = (x) => x * 5;\n * const args = [2], t = 20, cance... | (x) => x * 5
[2]
20
50 | {
"name": "cancellable",
"params": [
{
"name": "fn",
"type": "string"
},
{
"type": "string",
"name": "args"
},
{
"type": "integer",
"name": "t"
},
{
"type": "integer",
"name": "cancelTimeMs"
}
],
"return": {
"type": "integer"
... | {"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,716 | Minimize String Length | minimize-string-length | <p>Given a string <code>s</code>, you have two types of operation:</p>
<ol>
<li>Choose an index <code>i</code> in the string, and let <code>c</code> be the character in position <code>i</code>. <strong>Delete</strong> the <strong>closest occurrence</strong> of <code>c</code> to the <strong>left</strong> of <code>i</c... | Easy | 66.6K | 86.7K | 66,603 | 86,676 | 76.8% | ['remove-all-adjacent-duplicates-in-string', 'remove-all-adjacent-duplicates-in-string-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimizedStringLength(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimizedStringLength(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | "aaabc" | {
"name": "minimizedStringLength",
"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... | ['Hash Table', 'String'] |
2,717 | Semi-Ordered Permutation | semi-ordered-permutation | <p>You are given a <strong>0-indexed</strong> permutation of <code>n</code> integers <code>nums</code>.</p>
<p>A permutation is called <strong>semi-ordered</strong> if the first number equals <code>1</code> and the last number equals <code>n</code>. You can perform the below operation as many times as you want until y... | Easy | 34.8K | 55.2K | 34,831 | 55,219 | 63.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int semiOrderedPermutation(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int semiOrderedPermutation(int[] nums) {\n \n }\n}"}, {"value": "python", "text... | [2,1,4,3] | {
"name": "semiOrderedPermutation",
"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', 'Simulation'] |
2,718 | Sum of Matrix After Queries | sum-of-matrix-after-queries | <p>You are given an integer <code>n</code> and a <strong>0-indexed</strong> <strong>2D array</strong> <code>queries</code> where <code>queries[i] = [type<sub>i</sub>, index<sub>i</sub>, val<sub>i</sub>]</code>.</p>
<p>Initially, there is a <strong>0-indexed</strong> <code>n x n</code> matrix filled with <code>0</... | Medium | 22.6K | 73K | 22,650 | 72,993 | 31.0% | ['range-sum-query-2d-mutable', 'range-addition-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long matrixSumQueries(int n, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long matrixSumQueries(int n, int[][] queries) {\n \n }\n}"}, ... | 3
[[0,0,1],[1,2,2],[0,2,3],[1,0,4]] | {
"name": "matrixSumQueries",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "queries"
}
],
"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'] |
2,719 | Count of Integers | count-of-integers | <p>You are given two numeric strings <code>num1</code> and <code>num2</code> and two integers <code>max_sum</code> and <code>min_sum</code>. We denote an integer <code>x</code> to be <em>good</em> if:</p>
<ul>
<li><code>num1 <= x <= num2</code></li>
<li><code>min_sum <= digit_sum(x) <= max_sum</code>.</l... | Hard | 14.4K | 38.3K | 14,369 | 38,295 | 37.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int count(string num1, string num2, int min_sum, int max_sum) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int count(String num1, String num2, int min_sum, int max_sum) {\n ... | "1"
"12"
1
8 | {
"name": "count",
"params": [
{
"name": "num1",
"type": "string"
},
{
"type": "string",
"name": "num2"
},
{
"type": "integer",
"name": "min_sum"
},
{
"type": "integer",
"name": "max_sum"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'String', 'Dynamic Programming'] |
2,720 | Popularity Percentage | popularity-percentage | null | Hard | 2.7K | 4.9K | 2,701 | 4,926 | 54.8% | [] | ['Create table if not exists Friends (user1 int, user2 int)', 'Truncate table Friends', "insert into Friends (user1, user2) values ('2', '1')", "insert into Friends (user1, user2) values ('1', '3')", "insert into Friends (user1, user2) values ('4', '1')", "insert into Friends (user1, user2) values ('1', '5')", "insert ... | Database | null | {"headers":{"Friends":["user1","user2"]},"rows":{"Friends":[[2,1],[1,3],[4,1],[1,5],[1,6],[2,6],[7,2],[8,3],[3,9]]}} | {"mysql": ["Create table if not exists Friends (user1 int, user2 int)"], "mssql": ["Create table Friends(user1 int, user2 int)"], "oraclesql": ["Create table Friends(user1 int, user2 int)"], "database": true, "name": "popularity_percentage", "pythondata": ["Friends = pd.DataFrame([], columns=['user1', 'user2']).astype(... | {"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,721 | Execute Asynchronous Functions in Parallel | execute-asynchronous-functions-in-parallel | <p>Given an array of asynchronous functions <code>functions</code>, return a new promise <code>promise</code>. Each function in the array accepts no arguments and returns a promise. All the promises should be executed in parallel.</p>
<p><code>promise</code> resolves:</p>
<ul>
<li>When all the promise... | Medium | 41.1K | 53.2K | 41,108 | 53,174 | 77.3% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Array<Function>} functions\n * @return {Promise<any>}\n */\nvar promiseAll = function(functions) {\n \n};\n\n/**\n * const promise = promiseAll([() => new Promise(res => res(42))])\n * promise.then(console.log); // [42]\n */"}, {"value": ... | [() => new Promise(resolve => setTimeout(() => resolve(5), 200))] | {
"name": "promiseAll",
"params": [
{
"name": "functions",
"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,722 | Join Two Arrays by ID | join-two-arrays-by-id | <p>Given two arrays <code>arr1</code> and <code>arr2</code>, return a new array <code>joinedArray</code>. All the objects in each of the two inputs arrays will contain an <code>id</code> field that has an integer value. </p>
<p><code>joinedArray</code> is an array formed by merging <... | Medium | 46.5K | 83.2K | 46,543 | 83,238 | 55.9% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Array} arr1\n * @param {Array} arr2\n * @return {Array}\n */\nvar join = function(arr1, arr2) {\n \n};"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "type JSONValue = null | boolean | number | string | JSONValue[] | { [k... | [{"id": 1,"x": 1},{"id": 2,"x": 9}]
[{"id": 3,"x": 5}] | {
"name": "join",
"params": [
{
"name": "arr1",
"type": "string"
},
{
"type": "string",
"name": "arr2"
}
],
"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,723 | Add Two Promises | add-two-promises | Given two promises <code>promise1</code> and <code>promise2</code>, return a new promise. <code>promise1</code> and <code>promise2</code> will both resolve with a number. The returned promise should resolve with the sum of the two numbers.
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<st... | Easy | 144.1K | 157.1K | 144,132 | 157,079 | 91.8% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Promise} promise1\n * @param {Promise} promise2\n * @return {Promise}\n */\nvar addTwoPromises = async function(promise1, promise2) {\n \n};\n\n/**\n * addTwoPromises(Promise.resolve(2), Promise.resolve(2))\n * .then(console.log); // 4\... | new Promise(resolve => setTimeout(() => resolve(2), 20))
new Promise(resolve => setTimeout(() => resolve(5), 60)) | {
"name": "addTwoPromises",
"params": [
{
"name": "promise1",
"type": "string"
},
{
"type": "string",
"name": "promise2"
}
],
"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,724 | Sort By | sort-by | <p>Given an array <code>arr</code> and a function <code>fn</code>, return a sorted array <code>sortedArr</code>. You can assume <code>fn</code> only returns numbers and those numbers determine the sort order of <code>sortedArr</code>. <code>sortedArr</code> must be sorted in <strong>ascending order</stro... | Easy | 60.9K | 73.4K | 60,943 | 73,354 | 83.1% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Array} arr\n * @param {Function} fn\n * @return {Array}\n */\nvar sortBy = function(arr, fn) {\n \n};"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "type JSONValue = null | boolean | number | string | JSONValue[] | { [ke... | [5,4,1,2,3]
(x) => x | {
"name": "sortBy",
"params": [
{
"name": "arr",
"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,725 | Interval Cancellation | interval-cancellation | <p>Given a function <code>fn</code>, an array of arguments <code>args</code>, and an interval time <code>t</code>, return a cancel function <code>cancelFn</code>.</p>
<p>After a delay of <code>cancelTimeMs</code>, the returned cancel function <code>cancelFn</code> will be invoked.</p>
<pre>
s... | Easy | 63.7K | 76.2K | 63,736 | 76,205 | 83.6% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Function} fn\n * @param {Array} args\n * @param {number} t\n * @return {Function}\n */\nvar cancellable = function(fn, args, t) {\n \n};\n\n/**\n * const result = [];\n *\n * const fn = (x) => x * 2;\n * const args = [4], t = 35, cance... | (x) => x * 2
[4]
35
190 | {
"name": "cancellable",
"params": [
{
"name": "fn",
"type": "string"
},
{
"type": "string",
"name": "args"
},
{
"type": "integer",
"name": "t"
},
{
"type": "integer",
"name": "cancelTimeMs"
}
],
"return": {
"type": "integer"
... | {"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,726 | Calculator with Method Chaining | calculator-with-method-chaining | <p>Design a <code>Calculator</code> class. The class should provide the mathematical operations of addition, subtraction, multiplication, division, and exponentiation. It should also allow consecutive operations to be performed using method chaining. The <code>Calculator</code> class constructor should a... | Easy | 41.9K | 54.2K | 41,857 | 54,221 | 77.2% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "class Calculator {\n \n /** \n * @param {number} value\n */\n constructor(value) {\n \n }\n \n /** \n * @param {number} value\n * @return {Calculator}\n */\n add(value){\n \n }\n \n /** \n ... | ["Calculator", "add", "subtract", "getResult"]
[10, 5, 7] | {
"name": "foobar",
"params": [
{
"name": "actions",
"type": "string[]"
},
{
"type": "double[]",
"name": "values"
}
],
"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,727 | Is Object Empty | is-object-empty | <p>Given an object or an array, return if it is empty.</p>
<ul>
<li>An empty object contains no key-value pairs.</li>
<li>An empty array contains no elements.</li>
</ul>
<p>You may assume the object or array is the output of <code>JSON.parse</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</str... | Easy | 93.3K | 114.7K | 93,295 | 114,734 | 81.3% | [] | [] | JavaScript | [{"value": "javascript", "text": "JavaScript", "defaultCode": "/**\n * @param {Object|Array} obj\n * @return {boolean}\n */\nvar isEmpty = function(obj) {\n \n};"}, {"value": "typescript", "text": "TypeScript", "defaultCode": "type JSONValue = null | boolean | number | string | JSONValue[] | { [key: string]: JSONVal... | {"x": 5, "y": 42} | {
"name": "isEmpty",
"params": [
{
"name": "obj",
"type": "string"
}
],
"return": {
"type": "boolean"
},
"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,728 | Count Houses in a Circular Street | count-houses-in-a-circular-street | null | Easy | 2.7K | 3.2K | 2,696 | 3,158 | 85.4% | [] | [] | Algorithms | null | [0,0,0,0]
10 | {
"name": "houseCount",
"params": [
{
"name": "street",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
},
"manual": true,
"languages": [
"cpp",
"java",
"python",
"c",
"csharp",
"javascript",
... | {"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', 'Interactive'] |
2,729 | Check if The Number is Fascinating | check-if-the-number-is-fascinating | <p>You are given an integer <code>n</code> that consists of exactly <code>3</code> digits.</p>
<p>We call the number <code>n</code> <strong>fascinating</strong> if, after the following modification, the resulting number contains all the digits from <code>1</code> to <code>9</code> <strong>exactly</strong> once and doe... | Easy | 52.5K | 100.6K | 52,489 | 100,600 | 52.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isFascinating(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isFascinating(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "c... | 192 | {
"name": "isFascinating",
"params": [
{
"name": "n",
"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... | ['Hash Table', 'Math'] |
2,730 | Find the Longest Semi-Repetitive Substring | find-the-longest-semi-repetitive-substring | <p>You are given a digit string <code>s</code> that consists of digits from 0 to 9.</p>
<p>A string is called <strong>semi-repetitive</strong> if there is <strong>at most</strong> one adjacent pair of the same digit. For example, <code>"0010"</code>, <code>"002020"</code>, <code>"0123"</c... | Medium | 28K | 76.3K | 28,009 | 76,274 | 36.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestSemiRepetitiveSubstring(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestSemiRepetitiveSubstring(String s) {\n \n }\n}"}, {"value": "python", ... | "52233" | {
"name": "longestSemiRepetitiveSubstring",
"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', 'Sliding Window'] |
2,731 | Movement of Robots | movement-of-robots | <p>Some robots are standing on an infinite number line with their initial coordinates given by a <strong>0-indexed</strong> integer array <code>nums</code> and will start moving once given the command to move. The robots will move a unit distance each second.</p>
<p>You are given a string <code>s</code> denoting the d... | Medium | 15.3K | 56.9K | 15,325 | 56,923 | 26.9% | ['last-moment-before-all-ants-fall-out-of-a-plank'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumDistance(vector<int>& nums, string s, int d) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumDistance(int[] nums, String s, int d) {\n \n }\n}"}, {"value": "py... | [-2,0,2]
"RLL"
3 | {
"name": "sumDistance",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "string",
"name": "s"
},
{
"type": "integer",
"name": "d"
}
],
"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', 'Brainteaser', 'Sorting', 'Prefix Sum'] |
2,732 | Find a Good Subset of the Matrix | find-a-good-subset-of-the-matrix | <p>You are given a <strong>0-indexed</strong> <code>m x n</code> binary matrix <code>grid</code>.</p>
<p>Let us call a <strong>non-empty</strong> subset of rows <strong>good</strong> if the sum of each column of the subset is at most half of the length of the subset.</p>
<p>More formally, if the length of the chosen ... | Hard | 7.6K | 16.5K | 7,565 | 16,534 | 45.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> goodSubsetofBinaryMatrix(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> goodSubsetofBinaryMatrix(int[][] grid) {\n \n }... | [[0,1,1,0],[0,0,0,1],[1,1,1,1]] | {
"name": "goodSubsetofBinaryMatrix",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "list<integer>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Bit Manipulation', 'Matrix'] |
2,733 | Neither Minimum nor Maximum | neither-minimum-nor-maximum | <p>Given an integer array <code>nums</code> containing <strong>distinct</strong> <strong>positive</strong> integers, find and return <strong>any</strong> number from the array that is neither the <strong>minimum</strong> nor the <strong>maximum</strong> value in the array, or <strong><code>-1</code></strong> if there i... | Easy | 112.7K | 148.6K | 112,682 | 148,564 | 75.8% | ['third-maximum-number'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findNonMinOrMax(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findNonMinOrMax(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | [3,2,1,4] | {
"name": "findNonMinOrMax",
"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'] |
2,734 | Lexicographically Smallest String After Substring Operation | lexicographically-smallest-string-after-substring-operation | <p>Given a string <code>s</code> consisting of lowercase English letters. Perform the following operation:</p>
<ul>
<li>Select any non-empty <span data-keyword="substring-nonempty">substring</span> then replace every letter of the substring with the preceding letter of the English alphabet. For example, 'b' i... | Medium | 30.8K | 96.4K | 30,762 | 96,447 | 31.9% | ['shifting-letters', 'lexicographically-smallest-string-after-applying-operations', 'lexicographically-smallest-string-after-operations-with-constraint', 'replace-question-marks-in-string-to-minimize-its-value'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string smallestString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String smallestString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "default... | "cbabc" | {
"name": "smallestString",
"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... | ['String', 'Greedy'] |
2,735 | Collecting Chocolates | collecting-chocolates | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> of size <code>n</code> representing the cost of collecting different chocolates. The cost of collecting the chocolate at the index <code>i</code> is <code>nums[i]</code>. Each chocolate is of a different type, and initially, the chocolat... | Medium | 13.5K | 40.4K | 13,522 | 40,446 | 33.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minCost(vector<int>& nums, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minCost(int[] nums, int x) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | [20,1,15]
5 | {
"name": "minCost",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "x"
}
],
"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', 'Enumeration'] |
2,736 | Maximum Sum Queries | maximum-sum-queries | <p>You are given two <strong>0-indexed</strong> integer arrays <code>nums1</code> and <code>nums2</code>, each of length <code>n</code>, and a <strong>1-indexed 2D array</strong> <code>queries</code> where <code>queries[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>.</p>
<p>For the <code>i<sup>th</sup></code> query, find ... | Hard | 6.7K | 24.4K | 6,742 | 24,418 | 27.6% | ['most-beautiful-item-for-each-query'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> maximumSumQueries(vector<int>& nums1, vector<int>& nums2, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] maximumSumQueries(int[] nums1... | [4,3,1,2]
[2,4,9,5]
[[4,1],[1,3],[2,5]] | {
"name": "maximumSumQueries",
"params": [
{
"name": "nums1",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "nums2"
},
{
"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', 'Binary Search', 'Stack', 'Binary Indexed Tree', 'Segment Tree', 'Sorting', 'Monotonic Stack'] |
2,737 | Find the Closest Marked Node | find-the-closest-marked-node | null | Medium | 6.6K | 10.2K | 6,611 | 10,228 | 64.6% | [] | [] | Algorithms | null | 4
[[0,1,1],[1,2,3],[2,3,2],[0,3,4]]
0
[2,3] | {
"name": "minimumDistance",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "list<list<integer>>",
"name": "edges"
},
{
"type": "integer",
"name": "s"
},
{
"type": "integer[]",
"name": "marked"
}
],
"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', 'Graph', 'Heap (Priority Queue)', 'Shortest Path'] |
2,738 | Count Occurrences in Text | count-occurrences-in-text | null | Medium | 8.2K | 14.7K | 8,172 | 14,716 | 55.5% | [] | ['Create table If Not Exists Files (file_name varchar(100), content text )', 'Truncate table Files', "insert into Files (file_name, content) values ('draft1.txt', 'The stock exchange predicts a bull market which would make many investors happy.')", "insert into Files (file_name, content) values ('draft2.txt', 'The stoc... | Database | null | {"headers":{"Files":["file_name","content"]},"rows":{"Files":[["draft1.txt","The stock exchange predicts a bull market which would make many investors happy."],["draft2.txt","The stock exchange predicts a bull market which would make many investors happy, but analysts warn of possibility of too much optimism and that i... | {"mysql": ["Create table If Not Exists Files (file_name varchar(100), content text )"], "mssql": ["Create table Files (file_name varchar(100), content text )"], "oraclesql": ["Create table Files (file_name varchar(100), content clob )"], "database": true, "name": "count_occurrences", "pythondata": ["Files = pd.DataFram... | {"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,739 | Total Distance Traveled | total-distance-traveled | <p>A truck has two fuel tanks. You are given two integers, <code>mainTank</code> representing the fuel present in the main tank in liters and <code>additionalTank</code> representing the fuel present in the additional tank in liters.</p>
<p>The truck has a mileage of <code>10</code> km per liter. Whenever <code>5</cod... | Easy | 51.1K | 128.2K | 51,077 | 128,164 | 39.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int distanceTraveled(int mainTank, int additionalTank) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int distanceTraveled(int mainTank, int additionalTank) {\n \n }\n}"}, ... | 5
10 | {
"name": "distanceTraveled",
"params": [
{
"name": "mainTank",
"type": "integer"
},
{
"type": "integer",
"name": "additionalTank"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Simulation'] |
2,740 | Find the Value of the Partition | find-the-value-of-the-partition | <p>You are given a <strong>positive</strong> integer array <code>nums</code>.</p>
<p>Partition <code>nums</code> into two arrays, <code>nums1</code> and <code>nums2</code>, such that:</p>
<ul>
<li>Each element of the array <code>nums</code> belongs to either the array <code>nums1</code> or the array <code>nums2... | Medium | 37.3K | 58.1K | 37,276 | 58,127 | 64.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findValueOfPartition(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findValueOfPartition(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "... | [1,3,2,4] | {
"name": "findValueOfPartition",
"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'] |
2,741 | Special Permutations | special-permutations | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> containing <code>n</code> <strong>distinct</strong> positive integers. A permutation of <code>nums</code> is called special if:</p>
<ul>
<li>For all indexes <code>0 <= i < n - 1</code>, eit... | Medium | 15.8K | 56K | 15,837 | 56,029 | 28.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int specialPerm(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int specialPerm(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | [2,3,6] | {
"name": "specialPerm",
"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', 'Dynamic Programming', 'Bit Manipulation', 'Bitmask'] |
2,742 | Painting the Walls | painting-the-walls | <p>You are given two <strong>0-indexed</strong> integer arrays, <code>cost</code> and <code>time</code>, of size <code>n</code> representing the costs and the time taken to paint <code>n</code> different walls respectively. There are two painters available:</p>
<ul>
<li>A<strong> paid painter</strong> ... | Hard | 69.5K | 139.6K | 69,502 | 139,646 | 49.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int paintWalls(vector<int>& cost, vector<int>& time) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int paintWalls(int[] cost, int[] time) {\n \n }\n}"}, {"value": "python"... | [1,2,3,2]
[1,2,3,2] | {
"name": "paintWalls",
"params": [
{
"name": "cost",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "time"
}
],
"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'] |
2,743 | Count Substrings Without Repeating Character | count-substrings-without-repeating-character | null | Medium | 7.9K | 10.4K | 7,932 | 10,443 | 76.0% | ['count-complete-substrings'] | [] | Algorithms | null | "abcd" | {
"name": "numberOfSpecialSubstrings",
"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... | ['Hash Table', 'String', 'Sliding Window'] |
2,744 | Find Maximum Number of String Pairs | find-maximum-number-of-string-pairs | <p>You are given a <strong>0-indexed</strong> array <code>words</code> consisting of <strong>distinct</strong> strings.</p>
<p>The string <code>words[i]</code> can be paired with the string <code>words[j]</code> if:</p>
<ul>
<li>The string <code>words[i]</code> is equal to the reversed string of <code>words[j]</code... | Easy | 91.9K | 113K | 91,902 | 112,965 | 81.4% | ['group-shifted-strings', 'palindrome-pairs'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumNumberOfStringPairs(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumNumberOfStringPairs(String[] words) {\n \n }\n}"}, {"value":... | ["cd","ac","dc","ca","zz"] | {
"name": "maximumNumberOfStringPairs",
"params": [
{
"name": "words",
"type": "string[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Simulation'] |
2,745 | Construct the Longest New String | construct-the-longest-new-string | <p>You are given three integers <code>x</code>, <code>y</code>, and <code>z</code>.</p>
<p>You have <code>x</code> strings equal to <code>"AA"</code>, <code>y</code> strings equal to <code>"BB"</code>, and <code>z</code> strings equal to <code>"AB"</code>. You want to choose some (possibl... | Medium | 23.2K | 43.4K | 23,237 | 43,376 | 53.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestString(int x, int y, int z) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestString(int x, int y, int z) {\n \n }\n}"}, {"value": "python", "text": "Pyt... | 2
5
1 | {
"name": "longestString",
"params": [
{
"name": "x",
"type": "integer"
},
{
"type": "integer",
"name": "y"
},
{
"type": "integer",
"name": "z"
}
],
"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', 'Dynamic Programming', 'Greedy', 'Brainteaser'] |
2,746 | Decremental String Concatenation | decremental-string-concatenation | <p>You are given a <strong>0-indexed</strong> array <code>words</code> containing <code>n</code> strings.</p>
<p>Let's define a <strong>join</strong> operation <code>join(x, y)</code> between two strings <code>x</code> and <code>y</code> as concatenating them into <code>xy</code>. However, if the last character of... | Medium | 9.5K | 36.8K | 9,544 | 36,778 | 26.0% | ['largest-merge-of-two-strings'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimizeConcatenatedLength(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimizeConcatenatedLength(String[] words) {\n \n }\n}"}, {"value":... | ["aa","ab","bc"] | {
"name": "minimizeConcatenatedLength",
"params": [
{
"name": "words",
"type": "string[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Dynamic Programming'] |
2,747 | Count Zero Request Servers | count-zero-request-servers | <p>You are given an integer <code>n</code> denoting the total number of servers and a <strong>2D</strong> <strong>0-indexed </strong>integer array <code>logs</code>, where <code>logs[i] = [server_id, time]</code> denotes that the server with id <code>server_id</code> received a request at time <code>time</code>.</p>
<... | Medium | 8.4K | 25.8K | 8,401 | 25,759 | 32.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> countServers(int n, vector<vector<int>>& logs, int x, vector<int>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] countServers(int n, int[][] logs, int x, ... | 3
[[1,3],[2,6],[1,5]]
5
[10,11] | {
"name": "countServers",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "logs"
},
{
"type": "integer",
"name": "x"
},
{
"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', 'Hash Table', 'Sliding Window', 'Sorting'] |
2,748 | Number of Beautiful Pairs | number-of-beautiful-pairs | <p>You are given a <strong>0-indexed </strong>integer array <code>nums</code>. A pair of indices <code>i</code>, <code>j</code> where <code>0 <= i < j < nums.length</code> is called beautiful if the <strong>first digit</strong> of <code>nums[i]</code> and the <strong>last digit</strong> of <code>nums[j]</... | Easy | 40.6K | 80.3K | 40,592 | 80,326 | 50.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countBeautifulPairs(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countBeautifulPairs(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Py... | [2,5,1,4] | {
"name": "countBeautifulPairs",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Math', 'Counting', 'Number Theory'] |
2,749 | Minimum Operations to Make the Integer Zero | minimum-operations-to-make-the-integer-zero | <p>You are given two integers <code>num1</code> and <code>num2</code>.</p>
<p>In one operation, you can choose integer <code>i</code> in the range <code>[0, 60]</code> and subtract <code>2<sup>i</sup> + num2</code> from <code>num1</code>.</p>
<p>Return <em>the integer denoting the <strong>minimum</strong> number of o... | Medium | 10.8K | 36.2K | 10,826 | 36,152 | 29.9% | ['broken-calculator', 'minimum-operations-to-reduce-x-to-zero'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int makeTheIntegerZero(int num1, int num2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int makeTheIntegerZero(int num1, int num2) {\n \n }\n}"}, {"value": "python", "tex... | 3
-2 | {
"name": "makeTheIntegerZero",
"params": [
{
"name": "num1",
"type": "integer"
},
{
"type": "integer",
"name": "num2"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Bit Manipulation', 'Brainteaser', 'Enumeration'] |
2,750 | Ways to Split Array Into Good Subarrays | ways-to-split-array-into-good-subarrays | <p>You are given a binary array <code>nums</code>.</p>
<p>A subarray of an array is <strong>good</strong> if it contains <strong>exactly</strong> <strong>one</strong> element with the value <code>1</code>.</p>
<p>Return <em>an integer denoting the number of ways to split the array </em><code>nums</code><em> into <str... | Medium | 24.2K | 71.8K | 24,158 | 71,814 | 33.6% | ['binary-subarrays-with-sum', 'count-number-of-nice-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfGoodSubarraySplits(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfGoodSubarraySplits(int[] nums) {\n \n }\n}"}, {"value": "python... | [0,1,0,0,1] | {
"name": "numberOfGoodSubarraySplits",
"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'] |
2,751 | Robot Collisions | robot-collisions | <p>There are <code>n</code> <strong>1-indexed</strong> robots, each having a position on a line, health, and movement direction.</p>
<p>You are given <strong>0-indexed</strong> integer arrays <code>positions</code>, <code>healths</code>, and a string <code>directions</code> (<code>directions[i]</code> is either <stron... | Hard | 112.9K | 201.3K | 112,911 | 201,315 | 56.1% | ['asteroid-collision'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> survivedRobotsHealths(vector<int>& positions, vector<int>& healths, string directions) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> survivedRobotsHealths(... | [5,4,3,2,1]
[2,17,9,15,10]
"RRRRR" | {
"name": "survivedRobotsHealths",
"params": [
{
"name": "positions",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "healths"
},
{
"type": "string",
"name": "directions"
}
],
"return": {
"type": "list<integer>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Stack', 'Sorting', 'Simulation'] |
2,752 | Customers with Maximum Number of Transactions on Consecutive Days | customers-with-maximum-number-of-transactions-on-consecutive-days | null | Hard | 2.3K | 5.7K | 2,310 | 5,663 | 40.8% | [] | ['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,753 | Count Houses in a Circular Street II | count-houses-in-a-circular-street-ii | null | Hard | 812 | 1.3K | 812 | 1,326 | 61.2% | [] | [] | Algorithms | null | [1,1,1,1]
10 | {
"name": "foobar",
"params": [
{
"name": "street",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
},
"languages": [
"cpp",
"java",
"python",
"c",
"csharp",
"javascript",
"ruby",
"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... | [] |
2,754 | Bind Function to Context | bind-function-to-context | null | Medium | 876 | 1K | 876 | 1,010 | 86.7% | [] | [] | JavaScript | null | function f(multiplier) { return this.x * multiplier; }
{"x":10}
[5] | {
"name": "jsonParse",
"params": [
{
"name": "fn",
"type": "string"
},
{
"type": "string",
"name": "obj"
},
{
"type": "string",
"name": "inputs"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"man... | {"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,755 | Deep Merge of Two Objects | deep-merge-of-two-objects | null | Medium | 719 | 1.1K | 719 | 1,090 | 66.0% | [] | [] | JavaScript | null | {"a": 1, "c": 3}
{"a": 2, "b": 2} | {
"name": "deepMerge",
"params": [
{
"name": "obj1",
"type": "string"
},
{
"type": "string",
"name": "obj2"
}
],
"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,756 | Query Batching | query-batching | null | Hard | 437 | 660 | 437 | 660 | 66.2% | [] | [] | JavaScript | null | async function(keys) { return keys.map(key => key + '!'); }
100
[{"key": "a", "time": 10}, {"key": "b", "time": 20}, {"key": "c", "time": 30}] | {
"name": "QueryBatcher",
"params": [
{
"name": "queryMultiple",
"type": "string"
},
{
"type": "integer",
"name": "t"
},
{
"type": "string",
"name": "calls"
}
],
"return": {
"type": "integer"
},
"languages": [
"typescript",
"javascript"... | {"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,757 | Generate Circular Array Values | generate-circular-array-values | null | Medium | 544 | 742 | 544 | 742 | 73.3% | [] | [] | JavaScript | null | [1,2,3,4,5]
[1,2,6]
0 | {
"name": "cycleGenerator",
"params": [
{
"name": "arr",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "steps"
},
{
"type": "integer",
"name": "startIndex"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"type... | {"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,758 | Next Day | next-day | null | Easy | 1.3K | 1.5K | 1,280 | 1,507 | 84.9% | [] | [] | JavaScript | null | "2014-06-20" | {
"name": "foobar",
"params": [
{
"type": "string",
"name": "date"
}
],
"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,759 | Convert JSON String to Object | convert-json-string-to-object | null | Hard | 660 | 1.1K | 660 | 1,067 | 61.9% | [] | [] | JavaScript | null | '{"a":2,"b":[1,2,3]}' | {
"name": "jsonParse",
"params": [
{
"name": "str",
"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,760 | Longest Even Odd Subarray With Threshold | longest-even-odd-subarray-with-threshold | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and an integer <code>threshold</code>.</p>
<p>Find the length of the <strong>longest subarray</strong> of <code>nums</code> starting at index <code>l</code> and ending at index <code>r</code> <code>(0 <= l <= r < nums.length)</code>... | Easy | 42.5K | 141.8K | 42,484 | 141,762 | 30.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestAlternatingSubarray(vector<int>& nums, int threshold) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestAlternatingSubarray(int[] nums, int threshold) {\n \... | [3,2,5,4]
5 | {
"name": "longestAlternatingSubarray",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "threshold"
}
],
"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', 'Sliding Window'] |
2,761 | Prime Pairs With Target Sum | prime-pairs-with-target-sum | <p>You are given an integer <code>n</code>. We say that two integers <code>x</code> and <code>y</code> form a prime number pair if:</p>
<ul>
<li><code>1 <= x <= y <= n</code></li>
<li><code>x + y == n</code></li>
<li><code>x</code> and <code>y</code> are prime numbers</li>
</ul>
<p>Return <em>the 2D sorte... | Medium | 33.8K | 96K | 33,782 | 96,021 | 35.2% | ['count-primes'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> findPrimePairs(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> findPrimePairs(int n) {\n \n }\n}"}, {"value": "python", "text"... | 10 | {
"name": "findPrimePairs",
"params": [
{
"name": "n",
"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', 'Math', 'Enumeration', 'Number Theory'] |
2,762 | Continuous Subarrays | continuous-subarrays | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>. A subarray of <code>nums</code> is called <strong>continuous</strong> if:</p>
<ul>
<li>Let <code>i</code>, <code>i + 1</code>, ..., <code>j</code><sub> </sub>be the indices in the subarray. Then, for each pair of indices <code>i <= i<su... | Medium | 108.6K | 187.1K | 108,607 | 187,104 | 58.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long continuousSubarrays(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long continuousSubarrays(int[] nums) {\n \n }\n}"}, {"value": "python", "tex... | [5,4,2,4] | {
"name": "continuousSubarrays",
"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', 'Queue', 'Sliding Window', 'Heap (Priority Queue)', 'Ordered Set', 'Monotonic Queue'] |
2,763 | Sum of Imbalance Numbers of All Subarrays | sum-of-imbalance-numbers-of-all-subarrays | <p>The <strong>imbalance number</strong> of a <strong>0-indexed</strong> integer array <code>arr</code> of length <code>n</code> is defined as the number of indices in <code>sarr = sorted(arr)</code> such that:</p>
<ul>
<li><code>0 <= i < n - 1</code>, and</li>
<li><code>sarr[i+1] - sarr[i] > 1</code></li>
... | Hard | 8.7K | 20.9K | 8,737 | 20,866 | 41.9% | ['count-subarrays-with-median-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumImbalanceNumbers(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumImbalanceNumbers(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Py... | [2,3,1,4] | {
"name": "sumImbalanceNumbers",
"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', 'Ordered Set'] |
2,764 | Is Array a Preorder of Some Binary Tree | is-array-a-preorder-of-some-binary-tree | null | Medium | 1.5K | 2.2K | 1,478 | 2,241 | 66.0% | [] | [] | Algorithms | null | [[0,-1],[1,0],[2,0],[3,2],[4,2]] | {
"name": "isPreorder",
"params": [
{
"name": "nodes",
"type": "list<list<integer>>"
}
],
"return": {
"type": "boolean"
},
"manual": false
} | {"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... | ['Stack', 'Tree', 'Depth-First Search', 'Binary Tree'] |
2,765 | Longest Alternating Subarray | longest-alternating-subarray | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>. A subarray <code>s</code> of length <code>m</code> is called <strong>alternating</strong> if:</p>
<ul>
<li><code>m</code> is greater than <code>1</code>.</li>
<li><code>s<sub>1</sub> = s<sub>0</sub> + 1</code>.</li>
<li>The <strong>0-ind... | Easy | 28.7K | 83.9K | 28,748 | 83,910 | 34.3% | ['longest-turbulent-subarray'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int alternatingSubarray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int alternatingSubarray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Py... | [2,3,4,3,4] | {
"name": "alternatingSubarray",
"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', 'Enumeration'] |
2,766 | Relocate Marbles | relocate-marbles | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> representing the initial positions of some marbles. You are also given two <strong>0-indexed </strong>integer arrays <code>moveFrom</code> and <code>moveTo</code> of <strong>equal</strong> length.</p>
<p>Throughout <code>moveFrom.length</cod... | Medium | 22.6K | 45.2K | 22,601 | 45,242 | 50.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> relocateMarbles(vector<int>& nums, vector<int>& moveFrom, vector<int>& moveTo) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> relocateMarbles(int[] nums, in... | [1,6,7,8]
[1,7,2]
[2,9,5] | {
"name": "relocateMarbles",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "moveFrom"
},
{
"type": "integer[]",
"name": "moveTo"
}
],
"return": {
"type": "list<integer>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sorting', 'Simulation'] |
2,767 | Partition String Into Minimum Beautiful Substrings | partition-string-into-minimum-beautiful-substrings | <p>Given a binary string <code>s</code>, partition the string into one or more <strong>substrings</strong> such that each substring is <strong>beautiful</strong>.</p>
<p>A string is <strong>beautiful</strong> if:</p>
<ul>
<li>It doesn't contain leading zeros.</li>
<li>It's the <strong>binary</strong> repres... | Medium | 19K | 36.4K | 19,004 | 36,362 | 52.3% | ['partition-array-for-maximum-sum', 'minimum-substring-partition-of-equal-character-frequency'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumBeautifulSubstrings(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumBeautifulSubstrings(String s) {\n \n }\n}"}, {"value": "python", "text": ... | "1011" | {
"name": "minimumBeautifulSubstrings",
"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... | ['Hash Table', 'String', 'Dynamic Programming', 'Backtracking'] |
2,768 | Number of Black Blocks | number-of-black-blocks | <p>You are given two integers <code>m</code> and <code>n</code> representing the dimensions of a <strong>0-indexed</strong> <code>m x n</code> grid.</p>
<p>You are also given a <strong>0-indexed</strong> 2D integer matrix <code>coordinates</code>, where <code>coordinates[i] = [x, y]</code> indicates that the... | Medium | 11K | 29.4K | 10,979 | 29,420 | 37.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<long long> countBlackBlocks(int m, int n, vector<vector<int>>& coordinates) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long[] countBlackBlocks(int m, int n, int[][] coordi... | 3
3
[[0,0]] | {
"name": "countBlackBlocks",
"params": [
{
"name": "m",
"type": "integer"
},
{
"type": "integer",
"name": "n"
},
{
"type": "integer[][]",
"name": "coordinates"
}
],
"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', 'Enumeration'] |
2,769 | Find the Maximum Achievable Number | find-the-maximum-achievable-number | <p>Given two integers, <code>num</code> and <code>t</code>. A <strong>number </strong><code>x</code><strong> </strong>is<strong> achievable</strong> if it can become equal to <code>num</code> after applying the following operation <strong>at most</strong> <code>t</code> times:</p>
<ul>
<li>Increase or decrease <code>... | Easy | 150.3K | 165.6K | 150,288 | 165,565 | 90.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int theMaximumAchievableX(int num, int t) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int theMaximumAchievableX(int num, int t) {\n \n }\n}"}, {"value": "python", "text"... | 4
1 | {
"name": "theMaximumAchievableX",
"params": [
{
"name": "num",
"type": "integer"
},
{
"type": "integer",
"name": "t"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math'] |
2,770 | Maximum Number of Jumps to Reach the Last Index | maximum-number-of-jumps-to-reach-the-last-index | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> of <code>n</code> integers and an integer <code>target</code>.</p>
<p>You are initially positioned at index <code>0</code>. In one step, you can jump from index <code>i</code> to any index <code>j</code> such that:</p>
<ul>
<li><code>0 <= i <... | Medium | 30.5K | 98.4K | 30,516 | 98,435 | 31.0% | ['jump-game-ii', 'frog-jump', 'jump-game-iii', 'jump-game-iv', 'minimum-jumps-to-reach-home', 'jump-game-vii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumJumps(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumJumps(int[] nums, int target) {\n \n }\n}"}, {"value": "python", "... | [1,3,6,4,1,2]
2 | {
"name": "maximumJumps",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "target"
}
],
"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'] |
2,771 | Longest Non-decreasing Subarray From Two Arrays | longest-non-decreasing-subarray-from-two-arrays | <p>You are given two <strong>0-indexed</strong> integer arrays <code>nums1</code> and <code>nums2</code> of length <code>n</code>.</p>
<p>Let's define another <strong>0-indexed</strong> integer array, <code>nums3</code>, of length <code>n</code>. For each index <code>i</code> in the range <code>[0, n - 1]</code>, ... | Medium | 29.3K | 98.7K | 29,267 | 98,698 | 29.7% | ['russian-doll-envelopes', 'maximum-length-of-pair-chain'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxNonDecreasingLength(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxNonDecreasingLength(int[] nums1, int[] nums2) {\n \n ... | [2,3,1]
[1,2,1] | {
"name": "maxNonDecreasingLength",
"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', 'Dynamic Programming'] |
2,772 | Apply Operations to Make All Array Elements Equal to Zero | apply-operations-to-make-all-array-elements-equal-to-zero | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and a positive integer <code>k</code>.</p>
<p>You can apply the following operation on the array <strong>any</strong> number of times:</p>
<ul>
<li>Choose <strong>any</strong> subarray of size <code>k</code> from the array and <strong>decr... | Medium | 15.4K | 47.5K | 15,358 | 47,466 | 32.4% | ['continuous-subarray-sum', 'number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkArray(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkArray(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "P... | [2,2,3,1,1,0]
3 | {
"name": "checkArray",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"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', 'Prefix Sum'] |
2,773 | Height of Special Binary Tree | height-of-special-binary-tree | null | Medium | 1.1K | 1.5K | 1,131 | 1,541 | 73.4% | [] | [] | Algorithms | null | [1,2,3,null,null,4,5] | {
"name": "heightOfTree",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "integer"
},
"manual": true,
"languages": [
"cpp",
"java",
"python",
"c",
"csharp",
"javascript",
"ruby",
"swift",
"golang",
"python3",
"s... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
2,774 | Array Upper Bound | array-upper-bound | null | Easy | 1.8K | 2.2K | 1,846 | 2,233 | 82.7% | ['array-prototype-last', 'group-by', 'snail-traversal'] | [] | JavaScript | null | [3,4,5]
5 | {
"name": "upperBound",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "target"
}
],
"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,775 | Undefined to Null | undefined-to-null | null | Medium | 787 | 1.1K | 787 | 1,115 | 70.6% | [] | [] | JavaScript | null | {"a": undefined, "b":3} | {
"name": "undefinedToNull",
"params": [
{
"name": "obj",
"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,776 | Convert Callback Based Function to Promise Based Function | convert-callback-based-function-to-promise-based-function | null | Medium | 1K | 1.1K | 1,029 | 1,114 | 92.4% | [] | [] | JavaScript | null | (callback, a, b, c) => { callback(a * b * c) }
[1, 2, 3] | {
"name": "foobar",
"params": [
{
"name": "fn",
"type": "string"
},
{
"type": "integer[][]",
"name": "args"
}
],
"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,777 | Date Range Generator | date-range-generator | null | Medium | 536 | 653 | 536 | 653 | 82.1% | [] | [] | JavaScript | null | "2023-04-01"
"2023-04-04"
1 | {
"name": "dateRangeGenerator",
"params": [
{
"name": "start",
"type": "integer"
},
{
"type": "integer",
"name": "end"
},
{
"type": "integer",
"name": "step"
}
],
"return": {
"type": "string"
},
"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,778 | Sum of Squares of Special Elements | sum-of-squares-of-special-elements | <p>You are given a <strong>1-indexed</strong> integer array <code>nums</code> of length <code>n</code>.</p>
<p>An element <code>nums[i]</code> of <code>nums</code> is called <strong>special</strong> if <code>i</code> divides <code>n</code>, i.e. <code>n % i == 0</code>.</p>
<p>Return <em>the <strong>sum of the square... | Easy | 83.9K | 103.6K | 83,871 | 103,638 | 80.9% | ['sum-of-square-numbers', 'sum-of-all-odd-length-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumOfSquares(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumOfSquares(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | [1,2,3,4] | {
"name": "sumOfSquares",
"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', 'Enumeration'] |
2,779 | Maximum Beauty of an Array After Applying Operation | maximum-beauty-of-an-array-after-applying-operation | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> and a <strong>non-negative</strong> integer <code>k</code>.</p>
<p>In one operation, you can do the following:</p>
<ul>
<li>Choose an index <code>i</code> that <strong>hasn't been chosen before</strong> from the range <code>[0, nums.length - 1... | Medium | 124.4K | 214.4K | 124,372 | 214,422 | 58.0% | ['maximum-size-subarray-sum-equals-k', 'partition-array-such-that-maximum-difference-is-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumBeauty(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumBeauty(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "... | [4,6,1,2]
2 | {
"name": "maximumBeauty",
"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', 'Binary Search', 'Sliding Window', 'Sorting'] |
2,780 | Minimum Index of a Valid Split | minimum-index-of-a-valid-split | <p>An element <code>x</code> of an integer array <code>arr</code> of length <code>m</code> is <strong>dominant</strong> if <strong>more than half</strong> the elements of <code>arr</code> have a value of <code>x</code>.</p>
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> of length <code>n... | Medium | 139.5K | 183.9K | 139,471 | 183,907 | 75.8% | ['majority-element', 'partition-array-into-disjoint-intervals'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumIndex(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumIndex(List<Integer> nums) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [1,2,2,2] | {
"name": "minimumIndex",
"params": [
{
"name": "nums",
"type": "list<integer>"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sorting'] |
2,781 | Length of the Longest Valid Substring | length-of-the-longest-valid-substring | <p>You are given a string <code>word</code> and an array of strings <code>forbidden</code>.</p>
<p>A string is called <strong>valid</strong> if none of its substrings are present in <code>forbidden</code>.</p>
<p>Return <em>the length of the <strong>longest valid substring</strong> of the string </em><code>word</code... | Hard | 35.1K | 93.4K | 35,069 | 93,357 | 37.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestValidSubstring(string word, vector<string>& forbidden) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestValidSubstring(String word, List<String> forbidden) {\n ... | "cbaaaabc"
["aaa","cb"] | {
"name": "longestValidSubstring",
"params": [
{
"name": "word",
"type": "string"
},
{
"type": "list<string>",
"name": "forbidden"
}
],
"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', 'Sliding Window'] |
2,782 | Number of Unique Categories | number-of-unique-categories | null | Medium | 2.8K | 3.4K | 2,788 | 3,365 | 82.9% | [] | [] | Algorithms | null | 6
[1,1,2,2,3,3] | {
"name": "numberOfCategories",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[]",
"name": "categoryHandler"
}
],
"return": {
"type": "integer"
},
"manual": true,
"languages": [
"cpp",
"java",
"python",
"c",
"csharp",
... | {"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... | ['Union Find', 'Interactive', 'Counting'] |
2,783 | Flight Occupancy and Waitlist Analysis | flight-occupancy-and-waitlist-analysis | null | Medium | 3.7K | 9.7K | 3,724 | 9,737 | 38.2% | [] | ['Create table if not exists Flights(flight_id int,capacity int)', 'Create table if not exists Passengers (passenger_id int,flight_id int)', 'Truncate table Flights', "insert into Flights (flight_id, capacity) values ('1', '2')", "insert into Flights (flight_id, capacity) values ('2', '2')", "insert into Flights (fligh... | Database | null | {"headers":{"Flights":["flight_id","capacity"],"Passengers":["passenger_id","flight_id"]},"rows":{"Flights":[[1,2],[2,2],[3,1]],"Passengers":[[101,1],[102,1],[103,1],[104,2],[105,2],[106,3],[107,3]]}} | {"mysql": ["Create table if not exists Flights(flight_id int,capacity int)", "Create table if not exists Passengers (passenger_id int,flight_id int)"], "mssql": ["Create table Flights(flight_id int,capacity int)", "Create table Passengers (passenger_id int,flight_id int)"], "oraclesql": ["Create table Flights(flight_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,784 | Check if Array is Good | check-if-array-is-good | <p>You are given an integer array <code>nums</code>. We consider an array <strong>good </strong>if it is a permutation of an array <code>base[n]</code>.</p>
<p><code>base[n] = [1, 2, ..., n - 1, n, n] </code>(in other words, it is an array of length <code>n + 1</code> which contains <code>1</code> to <code>n - 1 </cod... | Easy | 57K | 118.1K | 57,030 | 118,089 | 48.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isGood(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isGood(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":... | [2, 1, 3] | {
"name": "isGood",
"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', 'Hash Table', 'Sorting'] |
2,785 | Sort Vowels in a String | sort-vowels-in-a-string | <p>Given a <strong>0-indexed</strong> string <code>s</code>, <strong>permute</strong> <code>s</code> to get a new string <code>t</code> such that:</p>
<ul>
<li>All consonants remain in their original places. More formally, if there is an index <code>i</code> with <code>0 <= i < s.length</code> such that <code>s... | Medium | 148.9K | 186.2K | 148,859 | 186,227 | 79.9% | ['reverse-vowels-of-a-string'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string sortVowels(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String sortVowels(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "... | "lEetcOde" | {
"name": "sortVowels",
"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... | ['String', 'Sorting'] |
2,786 | Visit Array Positions to Maximize Score | visit-array-positions-to-maximize-score | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and a positive integer <code>x</code>.</p>
<p>You are <strong>initially</strong> at position <code>0</code> in the array and you can visit other positions according to the following rules:</p>
<ul>
<li>If you are currently in position <cod... | Medium | 21.8K | 60K | 21,800 | 60,015 | 36.3% | ['jump-game-ii', 'stone-game'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxScore(vector<int>& nums, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxScore(int[] nums, int x) {\n \n }\n}"}, {"value": "python", "text": "Pyt... | [2,3,6,1,9,2]
5 | {
"name": "maxScore",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "x"
}
],
"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'] |
2,787 | Ways to Express an Integer as Sum of Powers | ways-to-express-an-integer-as-sum-of-powers | <p>Given two <strong>positive</strong> integers <code>n</code> and <code>x</code>.</p>
<p>Return <em>the number of ways </em><code>n</code><em> can be expressed as the sum of the </em><code>x<sup>th</sup></code><em> power of <strong>unique</strong> positive integers, in other words, the number of sets of unique intege... | Medium | 22.3K | 66.7K | 22,320 | 66,715 | 33.5% | ['perfect-squares', 'combination-sum-iv', 'target-sum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfWays(int n, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfWays(int n, int x) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo... | 10
2 | {
"name": "numberOfWays",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer",
"name": "x"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming'] |
2,788 | Split Strings by Separator | split-strings-by-separator | <p>Given an array of strings <code>words</code> and a character <code>separator</code>, <strong>split</strong> each string in <code>words</code> by <code>separator</code>.</p>
<p>Return <em>an array of strings containing the new strings formed after the splits, <strong>excluding empty strings</strong>.</em></p>
<p><s... | Easy | 66.8K | 89.6K | 66,818 | 89,646 | 74.5% | ['split-a-string-in-balanced-strings'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> splitWordsBySeparator(vector<string>& words, char separator) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> splitWordsBySeparator(List<String> words, char... | ["one.two.three","four.five","six"]
"." | {
"name": "splitWordsBySeparator",
"params": [
{
"name": "words",
"type": "list<string>"
},
{
"type": "character",
"name": "separator"
}
],
"return": {
"type": "list<string>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String'] |
2,789 | Largest Element in an Array after Merge Operations | largest-element-in-an-array-after-merge-operations | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> consisting of positive integers.</p>
<p>You can do the following operation on the array <strong>any</strong> number of times:</p>
<ul>
<li>Choose an integer <code>i</code> such that <code>0 <= i < nums.length - 1</code> and <code>nums[i] <... | Medium | 33.2K | 71.5K | 33,211 | 71,547 | 46.4% | ['jump-game', 'house-robber', 'get-maximum-in-generated-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxArrayValue(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxArrayValue(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python"... | [2,3,7,9,3] | {
"name": "maxArrayValue",
"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', 'Greedy'] |
2,790 | Maximum Number of Groups With Increasing Length | maximum-number-of-groups-with-increasing-length | <p>You are given a <strong>0-indexed</strong> array <code>usageLimits</code> of length <code>n</code>.</p>
<p>Your task is to create <strong>groups</strong> using numbers from <code>0</code> to <code>n - 1</code>, ensuring that each number, <code>i</code>, is used no more than <code>usageLimits[i]</code> times in tota... | Hard | 11.9K | 54.8K | 11,877 | 54,822 | 21.7% | ['group-the-people-given-the-group-size-they-belong-to'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxIncreasingGroups(vector<int>& usageLimits) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxIncreasingGroups(List<Integer> usageLimits) {\n \n }\n}"}, {"value":... | [1,2,5] | {
"name": "maxIncreasingGroups",
"params": [
{
"name": "usageLimits",
"type": "list<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', 'Binary Search', 'Greedy', 'Sorting'] |
2,791 | Count Paths That Can Form a Palindrome in a Tree | count-paths-that-can-form-a-palindrome-in-a-tree | <p>You are given a <strong>tree</strong> (i.e. a connected, undirected graph that has no cycles) <strong>rooted</strong> at node <code>0</code> consisting of <code>n</code> nodes numbered from <code>0</code> to <code>n - 1</code>. The tree is represented by a <strong>0-indexed</strong> array <code>parent</code> of size... | Hard | 8K | 17.8K | 8,042 | 17,809 | 45.2% | ['count-valid-paths-in-a-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countPalindromePaths(vector<int>& parent, string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countPalindromePaths(List<Integer> parent, String s) {\n \n ... | [-1,0,0,1,1,2]
"acaabc" | {
"name": "countPalindromePaths",
"params": [
{
"name": "parent",
"type": "list<integer>"
},
{
"type": "string",
"name": "s"
}
],
"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... | ['Dynamic Programming', 'Bit Manipulation', 'Tree', 'Depth-First Search', 'Bitmask'] |
2,792 | Count Nodes That Are Great Enough | count-nodes-that-are-great-enough | null | Hard | 1.1K | 1.9K | 1,111 | 1,927 | 57.7% | [] | [] | Algorithms | null | [7,6,5,4,3,2,1]
2 | {
"name": "countGreatEnoughNodes",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"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... | ['Divide and Conquer', 'Tree', 'Depth-First Search', 'Binary Tree'] |
2,793 | Status of Flight Tickets | status-of-flight-tickets | null | Hard | 2.6K | 3.3K | 2,592 | 3,296 | 78.6% | [] | ['Create table if not exists Flights(flight_id int,capacity int)', 'Create table if not exists Passengers (passenger_id int,flight_id int,booking_time datetime)', 'Truncate table Flights', "insert into Flights (flight_id, capacity) values ('1', '2')", "insert into Flights (flight_id, capacity) values ('2', '2')", "inse... | Database | null | {"headers":{"Flights":["flight_id","capacity"],"Passengers":["passenger_id","flight_id","booking_time"]},"rows":{"Flights":[[1,2],[2,2],[3,1]],"Passengers":[[101,1,"2023-07-10 16:30:00"],[102,1,"2023-07-10 17:45:00"],[103,1,"2023-07-10 12:00:00"],[104,2,"2023-07-05 13:23:00"],[105,2,"2023-07-05 09:00:00"],[106,3,"2023-... | {"mysql": ["Create table if not exists Flights(flight_id int,capacity int)", "Create table if not exists Passengers (passenger_id int,flight_id int,booking_time datetime)"], "mssql": ["Create table Flights(flight_id int,capacity int)", "Create table Passengers (passenger_id int,flight_id int, booking_time datetime)"], ... | {"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<... | [] |
2,794 | Create Object from Two Arrays | create-object-from-two-arrays | null | Easy | 1.4K | 2.1K | 1,374 | 2,110 | 65.1% | [] | [] | JavaScript | null | ["a","b","c"]
[1,2,3] | {
"name": "createObject",
"params": [
{
"name": "keysArr",
"type": "string"
},
{
"type": "string",
"name": "valuesArr"
}
],
"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,795 | Parallel Execution of Promises for Individual Results Retrieval | parallel-execution-of-promises-for-individual-results-retrieval | null | Medium | 823 | 916 | 823 | 916 | 89.8% | [] | [] | JavaScript | null | [() => new Promise(resolve => setTimeout(() => resolve(15), 100))] | {
"name": "promiseAllSettled",
"params": [
{
"name": "functions",
"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,796 | Repeat String | repeat-string | null | Easy | 3.2K | 3.4K | 3,151 | 3,389 | 93.0% | [] | [] | JavaScript | null | "hello"
2 | {
"name": "repeat",
"params": [
{
"name": "str",
"type": "string"
},
{
"type": "integer",
"name": "times"
}
],
"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,797 | Partial Function with Placeholders | partial-function-with-placeholders | null | Easy | 1.3K | 1.5K | 1,316 | 1,471 | 89.5% | [] | [] | JavaScript | null | (...args) => args
[2,4,6]
[8,10] | {
"name": "partial",
"params": [
{
"name": "fn",
"type": "string"
},
{
"type": "string",
"name": "args"
},
{
"type": "string",
"name": "restArgs"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"ma... | {"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,798 | Number of Employees Who Met the Target | number-of-employees-who-met-the-target | <p>There are <code>n</code> employees in a company, numbered from <code>0</code> to <code>n - 1</code>. Each employee <code>i</code> has worked for <code>hours[i]</code> hours in the company.</p>
<p>The company requires each employee to work for <strong>at least</strong> <code>target</code> hours.</p>
<p>You are give... | Easy | 197.9K | 226K | 197,896 | 225,985 | 87.6% | ['minimum-operations-to-exceed-threshold-value-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfEmployeesWhoMetTarget(vector<int>& hours, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfEmployeesWhoMetTarget(int[] hours, int target) {\n ... | [0,1,2,3,4]
2 | {
"name": "numberOfEmployeesWhoMetTarget",
"params": [
{
"name": "hours",
"type": "integer[]"
},
{
"type": "integer",
"name": "target"
}
],
"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,799 | Count Complete Subarrays in an Array | count-complete-subarrays-in-an-array | <p>You are given an array <code>nums</code> consisting of <strong>positive</strong> integers.</p>
<p>We call a subarray of an array <strong>complete</strong> if the following condition is satisfied:</p>
<ul>
<li>The number of <strong>distinct</strong> elements in the subarray is equal to the number of distinct eleme... | Medium | 47.7K | 73.9K | 47,711 | 73,940 | 64.5% | ['longest-substring-without-repeating-characters', 'subarrays-with-k-different-integers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countCompleteSubarrays(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countCompleteSubarrays(int[] nums) {\n \n }\n}"}, {"value": "python", "text... | [1,3,1,2,2] | {
"name": "countCompleteSubarrays",
"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', 'Sliding Window'] |
2,800 | Shortest String That Contains Three Strings | shortest-string-that-contains-three-strings | Given three strings <code>a</code>, <code>b</code>, and <code>c</code>, your task is to find a string that has the<strong> minimum</strong> length and contains all three strings as <strong>substrings</strong>.
<p>If there are multiple such strings, return the<em> </em><strong>lexicographically<em> </em>smallest </stron... | Medium | 17.5K | 57.3K | 17,486 | 57,280 | 30.5% | ['shortest-common-supersequence'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string minimumString(string a, string b, string c) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String minimumString(String a, String b, String c) {\n \n }\n}"}, {"value"... | "abc"
"bca"
"aaa" | {
"name": "minimumString",
"params": [
{
"name": "a",
"type": "string"
},
{
"type": "string",
"name": "b"
},
{
"type": "string",
"name": "c"
}
],
"return": {
"type": "string"
},
"manual": false
} | {"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', 'Enumeration'] |
2,801 | Count Stepping Numbers in Range | count-stepping-numbers-in-range | <p>Given two positive integers <code>low</code> and <code>high</code> represented as strings, find the count of <strong>stepping numbers</strong> in the inclusive range <code>[low, high]</code>.</p>
<p>A <strong>stepping number</strong> is an integer such that all of its adjacent digits have an absolute difference of ... | Hard | 9K | 35.2K | 9,018 | 35,166 | 25.6% | ['stepping-numbers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSteppingNumbers(string low, string high) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSteppingNumbers(String low, String high) {\n \n }\n}"}, {"value": ... | "1"
"11" | {
"name": "countSteppingNumbers",
"params": [
{
"name": "low",
"type": "string"
},
{
"type": "string",
"name": "high"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
2,802 | Find The K-th Lucky Number | find-the-k-th-lucky-number | null | Medium | 6K | 7.9K | 5,981 | 7,869 | 76.0% | [] | [] | Algorithms | null | 4 | {
"name": "kthLuckyNumber",
"params": [
{
"name": "k",
"type": "integer"
}
],
"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... | ['Math', 'String', 'Bit Manipulation'] |
2,803 | Factorial Generator | factorial-generator | null | Easy | 1.2K | 1.4K | 1,229 | 1,409 | 87.2% | [] | [] | JavaScript | null | 5 | {
"name": "factorial",
"params": [
{
"name": "n",
"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,804 | Array Prototype ForEach | array-prototype-foreach | null | Easy | 1.2K | 1.4K | 1,227 | 1,374 | 89.3% | [] | [] | JavaScript | null | [1,2,3]
function(val, i, arr){ arr[i] = val * 2 }
{"context": true} | {
"name": "foobar",
"params": [
{
"name": "arr",
"type": "string"
},
{
"type": "string",
"name": "callback"
},
{
"type": "string",
"name": "context"
}
],
"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,805 | Custom Interval | custom-interval | null | Medium | 577 | 697 | 577 | 697 | 82.8% | [] | [] | JavaScript | null | 50
20
225 | {
"name": "foobar",
"params": [
{
"type": "integer",
"name": "delay"
},
{
"type": "integer",
"name": "period"
},
{
"type": "integer",
"name": "cancelTime"
}
],
"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,806 | Account Balance After Rounded Purchase | account-balance-after-rounded-purchase | <p>Initially, you have a bank account balance of <strong>100</strong> dollars.</p>
<p>You are given an integer <code>purchaseAmount</code> representing the amount you will spend on a purchase in dollars, in other words, its price.</p>
<p>When making the purchase, first the <code>purchaseAmount</code> <strong>is round... | Easy | 51.6K | 94.2K | 51,634 | 94,248 | 54.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int accountBalanceAfterPurchase(int purchaseAmount) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int accountBalanceAfterPurchase(int purchaseAmount) {\n \n }\n}"}, {"valu... | 9 | {
"name": "accountBalanceAfterPurchase",
"params": [
{
"name": "purchaseAmount",
"type": "integer"
}
],
"return": {
"type": "integer"
},
"languages": [
"cpp",
"java",
"python",
"c",
"csharp",
"javascript",
"ruby",
"swift",
"golang",
"python3",
... | {"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,807 | Insert Greatest Common Divisors in Linked List | insert-greatest-common-divisors-in-linked-list | <p>Given the head of a linked list <code>head</code>, in which each node contains an integer value.</p>
<p>Between every pair of adjacent nodes, insert a new node with a value equal to the <strong>greatest common divisor</strong> of them.</p>
<p>Return <em>the linked list after insertion</em>.</p>
<p>The <strong>gre... | Medium | 246K | 268.8K | 245,995 | 268,754 | 91.5% | ['reverse-linked-list'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [18,6,10,3] | {
"name": "insertGreatestCommonDivisors",
"params": [
{
"name": "head",
"type": "ListNode"
}
],
"return": {
"type": "ListNode"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Math', 'Number Theory'] |
2,808 | Minimum Seconds to Equalize a Circular Array | minimum-seconds-to-equalize-a-circular-array | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> containing <code>n</code> integers.</p>
<p>At each second, you perform the following operation on the array:</p>
<ul>
<li>For every index <code>i</code> in the range <code>[0, n - 1]</code>, replace <code>nums[i]</code> with either <code>nums[i]</... | Medium | 16.8K | 61.8K | 16,815 | 61,793 | 27.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumSeconds(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumSeconds(List<Integer> nums) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [1,2,1,2] | {
"name": "minimumSeconds",
"params": [
{
"name": "nums",
"type": "list<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,809 | Minimum Time to Make Array Sum At Most x | minimum-time-to-make-array-sum-at-most-x | <p>You are given two <strong>0-indexed</strong> integer arrays <code>nums1</code> and <code>nums2</code> of equal length. Every second, for all indices <code>0 <= i < nums1.length</code>, value of <code>nums1[i]</code> is incremented by <code>nums2[i]</code>. <strong>After</strong> this is done, you can do the fo... | Hard | 5.1K | 20.5K | 5,115 | 20,488 | 25.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumTime(vector<int>& nums1, vector<int>& nums2, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumTime(List<Integer> nums1, List<Integer> nums2, int x) {\n ... | [1,2,3]
[1,2,3]
4 | {
"name": "minimumTime",
"params": [
{
"name": "nums1",
"type": "list<integer>"
},
{
"type": "list<integer>",
"name": "nums2"
},
{
"type": "integer",
"name": "x"
}
],
"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', 'Sorting'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.