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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
301 | Remove Invalid Parentheses | remove-invalid-parentheses | <p>Given a string <code>s</code> that contains parentheses and letters, remove the minimum number of invalid parentheses to make the input string valid.</p>
<p>Return <em>a list of <strong>unique strings</strong> that are valid with the minimum number of removals</em>. You may return the answer in <strong>any order</s... | Hard | 468.1K | 955.2K | 468,102 | 955,233 | 49.0% | ['valid-parentheses', 'minimum-number-of-swaps-to-make-the-string-balanced'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> removeInvalidParentheses(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> removeInvalidParentheses(String s) {\n \n }\n}"}, {"value": "p... | "()())()" | {
"name":"removeInvalidParentheses",
"params":[
{
"name":"s",
"type":"string"
}
],
"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... | ['String', 'Backtracking', 'Breadth-First Search'] |
302 | Smallest Rectangle Enclosing Black Pixels | smallest-rectangle-enclosing-black-pixels | null | Hard | 52.1K | 87.6K | 52,113 | 87,599 | 59.5% | ['find-the-minimum-area-to-cover-all-ones-ii', 'find-the-minimum-area-to-cover-all-ones-i'] | [] | Algorithms | null | [["0","0","1","0"],["0","1","1","0"],["0","1","0","0"]]
0
2 | {
"name": "minArea",
"params": [
{
"name": "image",
"type": "character[][]"
},
{
"name": "x",
"type": "integer"
},
{
"name": "y",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Depth-First Search', 'Breadth-First Search', 'Matrix'] |
303 | Range Sum Query - Immutable | range-sum-query-immutable | <p>Given an integer array <code>nums</code>, handle multiple queries of the following type:</p>
<ol>
<li>Calculate the <strong>sum</strong> of the elements of <code>nums</code> between indices <code>left</code> and <code>right</code> <strong>inclusive</strong> where <code>left <= right</code>.</li>
</ol>
<p>Imple... | Easy | 684K | 1M | 683,969 | 1,009,911 | 67.7% | ['range-sum-query-2d-immutable', 'range-sum-query-mutable', 'maximum-size-subarray-sum-equals-k', 'sum-of-variable-length-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class NumArray {\npublic:\n NumArray(vector<int>& nums) {\n \n }\n \n int sumRange(int left, int right) {\n \n }\n};\n\n/**\n * Your NumArray object will be instantiated and called as such:\n * NumArray* obj = new NumArray(nums);\n * int para... | ["NumArray","sumRange","sumRange","sumRange"]
[[[-2,0,3,-5,2,-1]],[0,2],[2,5],[0,5]] | {
"classname": "NumArray",
"maxbytesperline": 135000,
"constructor": {
"params": [
{
"type": "integer[]",
"name": "nums"
},
{
"type": "integer",
"name": "numsSize",
"lang": "c",
"value": "size_1"
}
]
},
"methods": [
{
"n... | {"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', 'Design', 'Prefix Sum'] |
304 | Range Sum Query 2D - Immutable | range-sum-query-2d-immutable | <p>Given a 2D matrix <code>matrix</code>, handle multiple queries of the following type:</p>
<ul>
<li>Calculate the <strong>sum</strong> of the elements of <code>matrix</code> inside the rectangle defined by its <strong>upper left corner</strong> <code>(row1, col1)</code> and <strong>lower right corner</strong> <code... | Medium | 412.8K | 734.2K | 412,818 | 734,164 | 56.2% | ['range-sum-query-immutable', 'range-sum-query-2d-mutable', 'find-the-grid-of-region-average'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class NumMatrix {\npublic:\n NumMatrix(vector<vector<int>>& matrix) {\n \n }\n \n int sumRegion(int row1, int col1, int row2, int col2) {\n \n }\n};\n\n/**\n * Your NumMatrix object will be instantiated and called as such:\n * NumMatrix* obj ... | ["NumMatrix","sumRegion","sumRegion","sumRegion"]
[[[[3,0,1,4,2],[5,6,3,2,1],[1,2,0,1,5],[4,1,0,1,7],[1,0,3,0,5]]],[2,1,4,3],[1,1,2,2],[1,2,2,4]] | {
"classname": "NumMatrix",
"maxbytesperline": 150000,
"constructor": {
"params": [
{
"type": "integer[][]",
"name": "matrix"
},
{
"type": "integer",
"name": "matrixRowSize",
"lang": "c",
"value": "size_1"
},
{
"type": "inte... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Design', 'Matrix', 'Prefix Sum'] |
305 | Number of Islands II | number-of-islands-ii | null | Hard | 160.5K | 401.1K | 160,529 | 401,096 | 40.0% | ['number-of-islands', 'process-restricted-friend-requests'] | [] | Algorithms | null | 3
3
[[0,0],[0,1],[1,2],[2,1]] | {
"name": "numIslands2",
"params": [
{
"name": "m",
"type": "integer",
"dealloc": false
},
{
"name": "n",
"type": "integer",
"dealloc": false
},
{
"name": "positions",
"type": "integer[][]",
"dealloc": false
}
],
"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', 'Hash Table', 'Union Find'] |
306 | Additive Number | additive-number | <p>An <strong>additive number</strong> is a string whose digits can form an <strong>additive sequence</strong>.</p>
<p>A valid <strong>additive sequence</strong> should contain <strong>at least</strong> three numbers. Except for the first two numbers, each subsequent number in the sequence must be the sum of the prece... | Medium | 102.5K | 316.7K | 102,533 | 316,698 | 32.4% | ['split-array-into-fibonacci-sequence'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isAdditiveNumber(string num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isAdditiveNumber(String num) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | "112358" | {
"name": "isAdditiveNumber",
"params": [
{
"name": "num",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Backtracking'] |
307 | Range Sum Query - Mutable | range-sum-query-mutable | <p>Given an integer array <code>nums</code>, handle multiple queries of the following types:</p>
<ol>
<li><strong>Update</strong> the value of an element in <code>nums</code>.</li>
<li>Calculate the <strong>sum</strong> of the elements of <code>nums</code> between indices <code>left</code> and <code>right</code> <st... | Medium | 299.6K | 719.5K | 299,582 | 719,517 | 41.6% | ['range-sum-query-immutable', 'range-sum-query-2d-mutable', 'shifting-letters-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class NumArray {\npublic:\n NumArray(vector<int>& nums) {\n \n }\n \n void update(int index, int val) {\n \n }\n \n int sumRange(int left, int right) {\n \n }\n};\n\n/**\n * Your NumArray object will be instantiated and called... | ["NumArray","sumRange","update","sumRange"]
[[[1,3,5]],[0,2],[1,2],[0,2]] | {
"classname": "NumArray",
"maxbytesperline": 170000,
"constructor": {
"params": [
{
"type": "integer[]",
"name": "nums"
}
]
},
"methods": [
{
"name": "update",
"params": [
{
"type": "integer",
"name": "index"
},
{... | {"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', 'Design', 'Binary Indexed Tree', 'Segment Tree'] |
308 | Range Sum Query 2D - Mutable | range-sum-query-2d-mutable | null | Medium | 80.4K | 179.6K | 80,404 | 179,622 | 44.8% | ['range-sum-query-2d-immutable', 'range-sum-query-mutable', 'increment-submatrices-by-one', 'sum-of-matrix-after-queries'] | [] | Algorithms | null | ["NumMatrix","sumRegion","update","sumRegion"]
[[[[3,0,1,4,2],[5,6,3,2,1],[1,2,0,1,5],[4,1,0,1,7],[1,0,3,0,5]]],[2,1,4,3],[3,2,2],[2,1,4,3]] | {
"classname": "NumMatrix",
"maxbytesperline": 115000,
"constructor": {
"params": [
{
"type": "integer[][]",
"name": "matrix"
},
{
"type": "integer",
"name": "matrixRowSize",
"lang": "... | {"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', 'Design', 'Binary Indexed Tree', 'Segment Tree', 'Matrix'] |
309 | Best Time to Buy and Sell Stock with Cooldown | best-time-to-buy-and-sell-stock-with-cooldown | <p>You are given an array <code>prices</code> where <code>prices[i]</code> is the price of a given stock on the <code>i<sup>th</sup></code> day.</p>
<p>Find the maximum profit you can achieve. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times) with the foll... | Medium | 622K | 1M | 622,023 | 1,036,812 | 60.0% | ['best-time-to-buy-and-sell-stock', 'best-time-to-buy-and-sell-stock-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxProfit(vector<int>& prices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxProfit(int[] prices) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | [1,2,3,0,2] | {
"name": "maxProfit",
"params": [
{
"name": "prices",
"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'] |
310 | Minimum Height Trees | minimum-height-trees | <p>A tree is an undirected graph in which any two vertices are connected by <i>exactly</i> one path. In other words, any connected graph without simple cycles is a tree.</p>
<p>Given a tree of <code>n</code> nodes labelled from <code>0</code> to <code>n - 1</code>, and an array of <code>n - 1</code... | Medium | 422K | 1M | 421,999 | 1,006,936 | 41.9% | ['course-schedule', 'course-schedule-ii', 'collect-coins-in-a-tree', 'count-pairs-of-connectable-servers-in-a-weighted-tree-network', 'find-minimum-diameter-after-merging-two-trees'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findMinHeightTrees(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> findMinHeightTrees(int n, int[][] edges) {\n \n ... | 4
[[1,0],[1,2],[1,3]] | {
"name": "findMinHeightTrees",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "edges",
"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... | ['Depth-First Search', 'Breadth-First Search', 'Graph', 'Topological Sort'] |
311 | Sparse Matrix Multiplication | sparse-matrix-multiplication | null | Medium | 205.2K | 299K | 205,206 | 298,954 | 68.6% | [] | [] | Algorithms | null | [[1,0,0],[-1,0,3]]
[[7,0,0],[0,0,0],[0,0,1]] | {
"name": "multiply",
"params": [
{
"name": "mat1",
"type": "integer[][]"
},
{
"name": "mat2",
"type": "integer[][]"
}
],
"return": {
"type": "integer[][]",
"rowsize": "size_1",
"colsize": "*col_size_2",
"dealloc": true
}
} | {"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'] |
312 | Burst Balloons | burst-balloons | <p>You are given <code>n</code> balloons, indexed from <code>0</code> to <code>n - 1</code>. Each balloon is painted with a number on it represented by an array <code>nums</code>. You are asked to burst all the balloons.</p>
<p>If you burst the <code>i<sup>th</sup></code> balloon, you will get <code>nums[i - 1] * nums... | Hard | 347.8K | 571.6K | 347,818 | 571,609 | 60.8% | ['minimum-cost-to-merge-stones'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxCoins(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxCoins(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ... | [3,1,5,8] | {
"name": "maxCoins",
"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'] |
313 | Super Ugly Number | super-ugly-number | <p>A <strong>super ugly number</strong> is a positive integer whose prime factors are in the array <code>primes</code>.</p>
<p>Given an integer <code>n</code> and an array of integers <code>primes</code>, return <em>the</em> <code>n<sup>th</sup></code> <em><strong>super ugly number</strong></em>.</p>
<p>The <code>n<s... | Medium | 141.5K | 311.6K | 141,477 | 311,633 | 45.4% | ['ugly-number-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int nthSuperUglyNumber(int n, vector<int>& primes) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int nthSuperUglyNumber(int n, int[] primes) {\n \n }\n}"}, {"value": "pyth... | 12
[2,7,13,19] | {
"name": "nthSuperUglyNumber",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "primes",
"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'] |
314 | Binary Tree Vertical Order Traversal | binary-tree-vertical-order-traversal | null | Medium | 528.1K | 929.3K | 528,071 | 929,252 | 56.8% | ['binary-tree-level-order-traversal'] | [] | Algorithms | null | [3,9,20,null,null,15,7] | {
"name": "verticalOrder",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "list<list<integer>>",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Sorting', 'Binary Tree'] |
315 | Count of Smaller Numbers After Self | count-of-smaller-numbers-after-self | <p>Given an integer array <code>nums</code>, return<em> an integer array </em><code>counts</code><em> where </em><code>counts[i]</code><em> is the number of smaller elements to the right of </em><code>nums[i]</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nu... | Hard | 348.7K | 815.9K | 348,654 | 815,884 | 42.7% | ['count-of-range-sum', 'queue-reconstruction-by-height', 'reverse-pairs', 'how-many-numbers-are-smaller-than-the-current-number', 'count-good-triplets-in-an-array', 'count-the-number-of-k-big-indices'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> countSmaller(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> countSmaller(int[] nums) {\n \n }\n}"}, {"value": "python", "text":... | [5,2,6,1] | {
"name": "countSmaller",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "list<integer>",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Divide and Conquer', 'Binary Indexed Tree', 'Segment Tree', 'Merge Sort', 'Ordered Set'] |
316 | Remove Duplicate Letters | remove-duplicate-letters | <p>Given a string <code>s</code>, remove duplicate letters so that every letter appears once and only once. You must make sure your result is <span data-keyword="lexicographically-smaller-string"><strong>the smallest in lexicographical order</strong></span> among all possible results.</p>
<p> </p>
<p><strong clas... | Medium | 374.8K | 735.1K | 374,824 | 735,102 | 51.0% | ['smallest-k-length-subsequence-with-occurrences-of-a-letter'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string removeDuplicateLetters(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String removeDuplicateLetters(String s) {\n \n }\n}"}, {"value": "python", "text": "P... | "bcabc" | {
"name": "removeDuplicateLetters",
"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', 'Stack', 'Greedy', 'Monotonic Stack'] |
317 | Shortest Distance from All Buildings | shortest-distance-from-all-buildings | null | Hard | 200.2K | 453.3K | 200,153 | 453,281 | 44.2% | ['walls-and-gates', 'best-meeting-point', 'as-far-from-land-as-possible'] | [] | Algorithms | null | [[1,0,2,0,1],[0,0,0,0,0],[0,0,1,0,0]] | {
"name": "shortestDistance",
"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', 'Breadth-First Search', 'Matrix'] |
318 | Maximum Product of Word Lengths | maximum-product-of-word-lengths | <p>Given a string array <code>words</code>, return <em>the maximum value of</em> <code>length(word[i]) * length(word[j])</code> <em>where the two words do not share common letters</em>. If no such two words exist, return <code>0</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<stron... | Medium | 232.5K | 384.6K | 232,456 | 384,626 | 60.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxProduct(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxProduct(String[] words) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | ["abcw","baz","foo","bar","xtfn","abcdef"] | {
"name": "maxProduct",
"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', 'Bit Manipulation'] |
319 | Bulb Switcher | bulb-switcher | <p>There are <code>n</code> bulbs that are initially off. You first turn on all the bulbs, then you turn off every second bulb.</p>
<p>On the third round, you toggle every third bulb (turning on if it's off or turning off if it's on). For the <code>i<sup>th</sup></code> round, you toggle every <code>i</co... | Medium | 251.2K | 466.6K | 251,183 | 466,637 | 53.8% | ['bulb-switcher-ii', 'minimum-number-of-k-consecutive-bit-flips', 'number-of-times-binary-string-is-prefix-aligned', 'find-the-pivot-integer'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int bulbSwitch(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int bulbSwitch(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Soluti... | 3 | {
"name": "bulbSwitch",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Brainteaser'] |
320 | Generalized Abbreviation | generalized-abbreviation | null | Medium | 73.9K | 123.3K | 73,929 | 123,283 | 60.0% | ['subsets', 'unique-word-abbreviation', 'minimum-unique-word-abbreviation'] | [] | Algorithms | null | "word" | {
"name": "generateAbbreviations",
"params": [
{
"name": "word",
"type": "string"
}
],
"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... | ['String', 'Backtracking', 'Bit Manipulation'] |
321 | Create Maximum Number | create-maximum-number | <p>You are given two integer arrays <code>nums1</code> and <code>nums2</code> of lengths <code>m</code> and <code>n</code> respectively. <code>nums1</code> and <code>nums2</code> represent the digits of two numbers. You are also given an integer <code>k</code>.</p>
<p>Create the maximum number of length <code>k <= ... | Hard | 70.2K | 219.1K | 70,158 | 219,130 | 32.0% | ['remove-k-digits', 'maximum-swap'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> maxNumber(vector<int>& nums1, vector<int>& nums2, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] maxNumber(int[] nums1, int[] nums2, int k) {\n \n ... | [3,4,6,5]
[9,1,2,5,8,3]
5 | {
"name": "maxNumber",
"params": [
{
"name": "nums1",
"type": "integer[]"
},
{
"name": "nums2",
"type": "integer[]"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Stack', 'Greedy', 'Monotonic Stack'] |
322 | Coin Change | coin-change | <p>You are given an integer array <code>coins</code> representing coins of different denominations and an integer <code>amount</code> representing a total amount of money.</p>
<p>Return <em>the fewest number of coins that you need to make up that amount</em>. If that amount of money cannot be made up by any combinatio... | Medium | 2.3M | 4.9M | 2,255,279 | 4,897,488 | 46.0% | ['minimum-cost-for-tickets', 'maximum-value-of-k-coins-from-piles', 'minimum-number-of-operations-to-convert-time', 'minimum-cost-to-split-an-array', 'count-of-sub-multisets-with-bounded-sum', 'length-of-the-longest-subsequence-that-sums-to-target', 'minimum-number-of-coins-to-be-added', 'most-expensive-item-that-can-n... | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int coinChange(vector<int>& coins, int amount) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int coinChange(int[] coins, int amount) {\n \n }\n}"}, {"value": "python", "te... | [1,2,5]
11 | {
"name": "coinChange",
"params": [
{
"name": "coins",
"type": "integer[]"
},
{
"name": "amount",
"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', 'Breadth-First Search'] |
323 | Number of Connected Components in an Undirected Graph | number-of-connected-components-in-an-undirected-graph | null | Medium | 471.4K | 736.8K | 471,422 | 736,767 | 64.0% | ['number-of-islands', 'graph-valid-tree', 'number-of-provinces', 'paths-in-maze-that-lead-to-same-room', 'count-the-number-of-complete-components'] | [] | Algorithms | null | 5
[[0,1],[1,2],[3,4]] | {
"name": "countComponents",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "edges",
"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... | ['Depth-First Search', 'Breadth-First Search', 'Union Find', 'Graph'] |
324 | Wiggle Sort II | wiggle-sort-ii | <p>Given an integer array <code>nums</code>, reorder it such that <code>nums[0] < nums[1] > nums[2] < nums[3]...</code>.</p>
<p>You may assume the input array always has a valid answer.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [1,5,1,1,6,4]
<s... | Medium | 177.1K | 499.8K | 177,118 | 499,845 | 35.4% | ['sort-colors', 'kth-largest-element-in-an-array', 'wiggle-sort', 'array-with-elements-not-equal-to-average-of-neighbors'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n void wiggleSort(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public void wiggleSort(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | [1,5,1,1,6,4] | {
"name": "wiggleSort",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "void"
},
"output": {
"paramindex": 0
},
"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... | ['Array', 'Divide and Conquer', 'Greedy', 'Sorting', 'Quickselect'] |
325 | Maximum Size Subarray Sum Equals k | maximum-size-subarray-sum-equals-k | null | Medium | 205K | 407.6K | 204,971 | 407,650 | 50.3% | ['minimum-size-subarray-sum', 'range-sum-query-immutable', 'contiguous-array', 'subarray-product-less-than-k', 'maximum-beauty-of-an-array-after-applying-operation', 'shortest-subarray-with-or-at-least-k-ii'] | [] | Algorithms | null | [1,-1,5,-2,3]
3 | {
"name": "maxSubArrayLen",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "k",
"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', 'Prefix Sum'] |
326 | Power of Three | power-of-three | <p>Given an integer <code>n</code>, return <em><code>true</code> if it is a power of three. Otherwise, return <code>false</code></em>.</p>
<p>An integer <code>n</code> is a power of three, if there exists an integer <code>x</code> such that <code>n == 3<sup>x</sup></code>.</p>
<p> </p>
<p><strong class="example"... | Easy | 995.1K | 2.1M | 995,150 | 2,084,548 | 47.7% | ['power-of-two', 'power-of-four', 'check-if-number-is-a-sum-of-powers-of-three'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isPowerOfThree(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isPowerOfThree(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ... | 27 | {
"name": "isPowerOfThree",
"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... | ['Math', 'Recursion'] |
327 | Count of Range Sum | count-of-range-sum | <p>Given an integer array <code>nums</code> and two integers <code>lower</code> and <code>upper</code>, return <em>the number of range sums that lie in</em> <code>[lower, upper]</code> <em>inclusive</em>.</p>
<p>Range sum <code>S(i, j)</code> is defined as the sum of the elements in <code>nums</code> between indices <... | Hard | 87.7K | 238.4K | 87,650 | 238,414 | 36.8% | ['count-of-smaller-numbers-after-self', 'reverse-pairs', 'count-the-number-of-fair-pairs', 'find-the-number-of-copy-arrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countRangeSum(vector<int>& nums, int lower, int upper) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countRangeSum(int[] nums, int lower, int upper) {\n \n }\n}"},... | [-2,5,-1]
-2
2 | {
"name": "countRangeSum",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "lower",
"type": "integer"
},
{
"name": "upper",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Divide and Conquer', 'Binary Indexed Tree', 'Segment Tree', 'Merge Sort', 'Ordered Set'] |
328 | Odd Even Linked List | odd-even-linked-list | <p>Given the <code>head</code> of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return <em>the reordered list</em>.</p>
<p>The <strong>first</strong> node is considered <strong>odd</strong>, and the <strong>second</strong> node is <strong>even</strong>... | Medium | 1.2M | 1.9M | 1,185,085 | 1,914,955 | 61.9% | ['split-linked-list-in-parts', 'transform-array-by-parity'] | [] | 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 * ... | [1,2,3,4,5] | {
"name": "oddEvenList",
"params": [
{
"name": "head",
"type": "ListNode",
"dealloc": false
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"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'] |
329 | Longest Increasing Path in a Matrix | longest-increasing-path-in-a-matrix | <p>Given an <code>m x n</code> integers <code>matrix</code>, return <em>the length of the longest increasing path in </em><code>matrix</code>.</p>
<p>From each cell, you can either move in four directions: left, right, up, or down. You <strong>may not</strong> move <strong>diagonally</strong> or move <strong>outside t... | Hard | 614.2K | 1.1M | 614,155 | 1,115,644 | 55.0% | ['number-of-increasing-paths-in-a-grid'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestIncreasingPath(vector<vector<int>>& matrix) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestIncreasingPath(int[][] matrix) {\n \n }\n}"}, {"value": "py... | [[9,9,4],[6,6,8],[2,1,1]] | {
"name": "longestIncreasingPath",
"params": [
{
"name": "matrix",
"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', 'Depth-First Search', 'Breadth-First Search', 'Graph', 'Topological Sort', 'Memoization', 'Matrix'] |
330 | Patching Array | patching-array | <p>Given a sorted integer array <code>nums</code> and an integer <code>n</code>, add/patch elements to the array such that any number in the range <code>[1, n]</code> inclusive can be formed by the sum of some elements in the array.</p>
<p>Return <em>the minimum number of patches required</em>.</p>
<p> </p>
<p><... | Hard | 167.3K | 313.3K | 167,288 | 313,314 | 53.4% | ['maximum-number-of-consecutive-values-you-can-make'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minPatches(vector<int>& nums, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minPatches(int[] nums, int n) {\n \n }\n}"}, {"value": "python", "text": "Python... | [1,3]
6 | {
"name": "minPatches",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy'] |
331 | Verify Preorder Serialization of a Binary Tree | verify-preorder-serialization-of-a-binary-tree | <p>One way to serialize a binary tree is to use <strong>preorder traversal</strong>. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as <code>'#'</code>.</p>
<img alt="" src="https://assets.leetcode.com/uploads/2021/03/12/pre-tree.jp... | Medium | 152.2K | 331.1K | 152,235 | 331,137 | 46.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isValidSerialization(string preorder) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isValidSerialization(String preorder) {\n \n }\n}"}, {"value": "python", "... | "9,3,4,#,#,1,#,#,2,#,6,#,#" | {
"name": "isValidSerialization",
"params": [
{
"name": "preorder",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Stack', 'Tree', 'Binary Tree'] |
332 | Reconstruct Itinerary | reconstruct-itinerary | <p>You are given a list of airline <code>tickets</code> where <code>tickets[i] = [from<sub>i</sub>, to<sub>i</sub>]</code> represent the departure and the arrival airports of one flight. Reconstruct the itinerary in order and return it.</p>
<p>All of the tickets belong to a man who departs from <code>"JFK"</... | Hard | 482.7K | 1.1M | 482,719 | 1,110,821 | 43.5% | ['longest-common-subpath', 'valid-arrangement-of-pairs'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> findItinerary(vector<vector<string>>& tickets) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> findItinerary(List<List<String>> tickets) {\n \n }... | [["MUC","LHR"],["JFK","MUC"],["SFO","SJC"],["LHR","SFO"]] | {
"name": "findItinerary",
"params": [
{
"name": "tickets",
"type": "list<list<string>>"
}
],
"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... | ['Depth-First Search', 'Graph', 'Eulerian Circuit'] |
333 | Largest BST Subtree | largest-bst-subtree | null | Medium | 121K | 267.7K | 121,032 | 267,696 | 45.2% | [] | [] | Algorithms | null | [10,5,15,1,8,null,7] | {
"name": "largestBSTSubtree",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming', 'Tree', 'Depth-First Search', 'Binary Search Tree', 'Binary Tree'] |
334 | Increasing Triplet Subsequence | increasing-triplet-subsequence | <p>Given an integer array <code>nums</code>, return <code>true</code><em> if there exists a triple of indices </em><code>(i, j, k)</code><em> such that </em><code>i < j < k</code><em> and </em><code>nums[i] < nums[j] < nums[k]</code>. If no such indices exists, return <code>false</code>.</p>
<p> </p>
... | Medium | 769.7K | 2M | 769,693 | 1,966,495 | 39.1% | ['longest-increasing-subsequence', 'count-special-quadruplets', 'count-good-triplets-in-an-array', 'count-increasing-quadruplets'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool increasingTriplet(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean increasingTriplet(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "P... | [1,2,3,4,5] | {
"name": "increasingTriplet",
"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', 'Greedy'] |
335 | Self Crossing | self-crossing | <p>You are given an array of integers <code>distance</code>.</p>
<p>You start at the point <code>(0, 0)</code> on an <strong>X-Y plane,</strong> and you move <code>distance[0]</code> meters to the north, then <code>distance[1]</code> meters to the west, <code>distance[2]</code> meters to the south, <code>distance[3]</... | Hard | 39.3K | 123.7K | 39,314 | 123,734 | 31.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isSelfCrossing(vector<int>& distance) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isSelfCrossing(int[] distance) {\n \n }\n}"}, {"value": "python", "text": ... | [2,1,1,2] | {
"name": "isSelfCrossing",
"params": [
{
"name": "distance",
"type": "integer[]"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Geometry'] |
336 | Palindrome Pairs | palindrome-pairs | <p>You are given a <strong>0-indexed</strong> array of <strong>unique</strong> strings <code>words</code>.</p>
<p>A <strong>palindrome pair</strong> is a pair of integers <code>(i, j)</code> such that:</p>
<ul>
<li><code>0 <= i, j < words.length</code>,</li>
<li><code>i != j</code>, and</li>
<li><code>words[... | Hard | 222.1K | 615.2K | 222,056 | 615,188 | 36.1% | ['longest-palindromic-substring', 'shortest-palindrome', 'longest-palindrome-by-concatenating-two-letter-words', 'find-maximum-number-of-string-pairs'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> palindromePairs(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> palindromePairs(String[] words) {\n \n }\n}"},... | ["abcd","dcba","lls","s","sssll"] | {
"name": "palindromePairs",
"params": [
{
"name": "words",
"type": "string[]"
}
],
"return": {
"type": "list<list<integer>>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Trie'] |
337 | House Robber III | house-robber-iii | <p>The thief has found himself a new place for his thievery again. There is only one entrance to this area, called <code>root</code>.</p>
<p>Besides the <code>root</code>, each house has one and only one parent house. After a tour, the smart thief realized that all houses in this place form a binary tree. It will auto... | Medium | 430.3K | 785.5K | 430,289 | 785,506 | 54.8% | ['house-robber', 'house-robber-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [3,2,3,null,3,null,1] | {
"name": "rob",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming', 'Tree', 'Depth-First Search', 'Binary Tree'] |
338 | Counting Bits | counting-bits | <p>Given an integer <code>n</code>, return <em>an array </em><code>ans</code><em> of length </em><code>n + 1</code><em> such that for each </em><code>i</code><em> </em>(<code>0 <= i <= n</code>)<em>, </em><code>ans[i]</code><em> is the <strong>number of </strong></em><code>1</code><em><strong>'s</strong> in t... | Easy | 1.3M | 1.7M | 1,336,612 | 1,681,146 | 79.5% | ['number-of-1-bits', 'sum-of-values-at-indices-with-k-set-bits', 'find-the-k-or-of-an-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> countBits(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] countBits(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "clas... | 2 | {
"name": "countBits",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming', 'Bit Manipulation'] |
339 | Nested List Weight Sum | nested-list-weight-sum | null | Medium | 364.5K | 427.2K | 364,522 | 427,172 | 85.3% | ['nested-list-weight-sum-ii', 'array-nesting', 'employee-importance'] | [] | Algorithms | null | [[1,1],2,[1,1]] | {
"name": "depthSum",
"params": [
{
"name": "nestedList",
"type": "list<NestedInteger>"
}
],
"return": {
"type": "integer"
},
"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... | ['Depth-First Search', 'Breadth-First Search'] |
340 | Longest Substring with At Most K Distinct Characters | longest-substring-with-at-most-k-distinct-characters | null | Medium | 373.4K | 756K | 373,397 | 756,011 | 49.4% | ['longest-substring-without-repeating-characters', 'longest-substring-with-at-most-two-distinct-characters', 'longest-repeating-character-replacement', 'subarrays-with-k-different-integers', 'max-consecutive-ones-iii', 'maximize-the-confusion-of-an-exam'] | [] | Algorithms | null | "eceba"
2 | {
"name": "lengthOfLongestSubstringKDistinct",
"params": [
{
"name": "s",
"type": "string"
},
{
"name": "k",
"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... | ['Hash Table', 'String', 'Sliding Window'] |
341 | Flatten Nested List Iterator | flatten-nested-list-iterator | <p>You are given a nested list of integers <code>nestedList</code>. Each element is either an integer or a list whose elements may also be integers or other lists. Implement an iterator to flatten it.</p>
<p>Implement the <code>NestedIterator</code> class:</p>
<ul>
<li><code>NestedIterator(List<NestedInteger> ... | Medium | 490.5K | 751.7K | 490,468 | 751,737 | 65.2% | ['flatten-2d-vector', 'zigzag-iterator', 'mini-parser', 'array-nesting'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * // This is the interface that allows for creating nested lists.\n * // You should not implement it, or speculate about its implementation\n * class NestedInteger {\n * public:\n * // Return true if this NestedInteger holds a single integer, rather than a ne... | [[1,1],2,[1,1]] | {
"name": "",
"params": [
{
"name": "nestedList",
"type": "list<NestedInteger>"
}
],
"return": {
"type": "integer"
},
"manual": true
} | {"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', 'Design', 'Queue', 'Iterator'] |
342 | Power of Four | power-of-four | <p>Given an integer <code>n</code>, return <em><code>true</code> if it is a power of four. Otherwise, return <code>false</code></em>.</p>
<p>An integer <code>n</code> is a power of four, if there exists an integer <code>x</code> such that <code>n == 4<sup>x</sup></code>.</p>
<p> </p>
<p><strong class="example">E... | Easy | 783.4K | 1.6M | 783,357 | 1,591,930 | 49.2% | ['power-of-two', 'power-of-three'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isPowerOfFour(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isPowerOfFour(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "c... | 16 | {
"name": "isPowerOfFour",
"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... | ['Math', 'Bit Manipulation', 'Recursion'] |
343 | Integer Break | integer-break | <p>Given an integer <code>n</code>, break it into the sum of <code>k</code> <strong>positive integers</strong>, where <code>k >= 2</code>, and maximize the product of those integers.</p>
<p>Return <em>the maximum product you can get</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
... | Medium | 390.8K | 640.7K | 390,764 | 640,692 | 61.0% | ['maximize-number-of-nice-divisors'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int integerBreak(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int integerBreak(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So... | 2 | {
"name": "integerBreak",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Dynamic Programming'] |
344 | Reverse String | reverse-string | <p>Write a function that reverses a string. The input string is given as an array of characters <code>s</code>.</p>
<p>You must do this by modifying the input array <a href="https://en.wikipedia.org/wiki/In-place_algorithm" target="_blank">in-place</a> with <code>O(1)</code> extra memory.</p>
<p> </p>
<p><strong... | Easy | 3.1M | 3.9M | 3,116,853 | 3,916,660 | 79.6% | ['reverse-vowels-of-a-string', 'reverse-string-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n void reverseString(vector<char>& s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public void reverseString(char[] s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | ["h","e","l","l","o"] | {
"name": "reverseString",
"params": [
{
"name": "s",
"type": "character[]"
}
],
"return": {
"type": "void"
},
"output": {
"paramindex": 0
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String'] |
345 | Reverse Vowels of a String | reverse-vowels-of-a-string | <p>Given a string <code>s</code>, reverse only all the vowels in the string and return it.</p>
<p>The vowels are <code>'a'</code>, <code>'e'</code>, <code>'i'</code>, <code>'o'</code>, and <code>'u'</code>, and they can appear in both lower and upper cases, more than once.</p>
... | Easy | 1.2M | 2.1M | 1,225,543 | 2,132,761 | 57.5% | ['reverse-string', 'remove-vowels-from-a-string', 'faulty-keyboard', 'sort-vowels-in-a-string'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string reverseVowels(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String reverseVowels(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo... | "IceCreAm" | {
"name": "reverseVowels",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String'] |
346 | Moving Average from Data Stream | moving-average-from-data-stream | null | Easy | 473.8K | 594K | 473,751 | 593,997 | 79.8% | ['k-radius-subarray-averages'] | [] | Algorithms | null | ["MovingAverage","next","next","next","next"]
[[3],[1],[10],[3],[5]] | {
"classname": "MovingAverage",
"constructor": {
"params": [
{
"type": "integer",
"name": "size"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "val"
}
],
"name": "next",
"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', 'Design', 'Queue', 'Data Stream'] |
347 | Top K Frequent Elements | top-k-frequent-elements | <p>Given an integer array <code>nums</code> and an integer <code>k</code>, return <em>the</em> <code>k</code> <em>most frequent elements</em>. You may return the answer in <strong>any order</strong>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> nums = [1,1,1,2,2,3],... | Medium | 2.7M | 4.3M | 2,731,101 | 4,250,424 | 64.3% | ['word-frequency', 'kth-largest-element-in-an-array', 'sort-characters-by-frequency', 'split-array-into-consecutive-subsequences', 'top-k-frequent-words', 'k-closest-points-to-origin', 'sort-features-by-popularity', 'sender-with-largest-word-count', 'most-frequent-even-element', 'linked-list-frequency'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> topKFrequent(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] topKFrequent(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "... | [1,1,1,2,2,3]
2 | {
"name": "topKFrequent",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "k",
"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', 'Divide and Conquer', 'Sorting', 'Heap (Priority Queue)', 'Bucket Sort', 'Counting', 'Quickselect'] |
348 | Design Tic-Tac-Toe | design-tic-tac-toe | null | Medium | 279.9K | 478.4K | 279,910 | 478,445 | 58.5% | ['valid-tic-tac-toe-state'] | [] | Algorithms | null | ["TicTacToe","move","move","move","move","move","move","move"]
[[3],[0,0,1],[0,2,2],[2,2,1],[1,1,2],[2,0,1],[1,0,2],[2,1,1]] | {
"classname": "TicTacToe",
"constructor": {
"params": [
{
"type": "integer",
"name": "n"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "row"
},
{
"type": "integer",
"name": "col"
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Design', 'Matrix', 'Simulation'] |
349 | Intersection of Two Arrays | intersection-of-two-arrays | <p>Given two integer arrays <code>nums1</code> and <code>nums2</code>, return <em>an array of their <span data-keyword="array-intersection">intersection</span></em>. Each element in the result must be <strong>unique</strong> and you may return the result in <strong>any order</strong>.</p>
<p> </p>
<p><strong clas... | Easy | 1.5M | 1.9M | 1,475,484 | 1,937,116 | 76.2% | ['intersection-of-two-arrays-ii', 'intersection-of-three-sorted-arrays', 'find-the-difference-of-two-arrays', 'count-common-words-with-one-occurrence', 'choose-numbers-from-two-arrays-in-range', 'intersection-of-multiple-arrays', 'minimum-common-value', 'maximum-size-of-a-set-after-removals'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] intersection(int[] nums1, int[] nums2) {\n \n }\n}"}, ... | [1,2,2,1]
[2,2] | {
"name": "intersection",
"params": [
{
"name": "nums1",
"type": "integer[]"
},
{
"name": "nums2",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Two Pointers', 'Binary Search', 'Sorting'] |
350 | Intersection of Two Arrays II | intersection-of-two-arrays-ii | <p>Given two integer arrays <code>nums1</code> and <code>nums2</code>, return <em>an array of their intersection</em>. Each element in the result must appear as many times as it shows in both arrays and you may return the result in <strong>any order</strong>.</p>
<p> </p>
<p><strong class="example">Example 1:</st... | Easy | 1.5M | 2.6M | 1,526,591 | 2,589,952 | 58.9% | ['intersection-of-two-arrays', 'find-common-characters', 'find-the-difference-of-two-arrays', 'choose-numbers-from-two-arrays-in-range', 'intersection-of-multiple-arrays', 'minimum-common-value'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] intersect(int[] nums1, int[] nums2) {\n \n }\n}"}, {"valu... | [1,2,2,1]
[2,2] | {
"name": "intersect",
"params": [
{
"name": "nums1",
"type": "integer[]"
},
{
"name": "nums2",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Two Pointers', 'Binary Search', 'Sorting'] |
351 | Android Unlock Patterns | android-unlock-patterns | null | Medium | 79.9K | 150.1K | 79,938 | 150,140 | 53.2% | [] | [] | Algorithms | null | 1
1 | {
"name": "numberOfPatterns",
"params": [
{
"name": "m",
"type": "integer"
},
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Bitmask'] |
352 | Data Stream as Disjoint Intervals | data-stream-as-disjoint-intervals | <p>Given a data stream input of non-negative integers <code>a<sub>1</sub>, a<sub>2</sub>, ..., a<sub>n</sub></code>, summarize the numbers seen so far as a list of disjoint intervals.</p>
<p>Implement the <code>SummaryRanges</code> class:</p>
<ul>
<li><code>SummaryRanges()</code> Initializes the object with an empty... | Hard | 117.7K | 195K | 117,690 | 195,011 | 60.4% | ['summary-ranges', 'find-right-interval', 'range-module', 'count-integers-in-intervals'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class SummaryRanges {\npublic:\n SummaryRanges() {\n \n }\n \n void addNum(int value) {\n \n }\n \n vector<vector<int>> getIntervals() {\n \n }\n};\n\n/**\n * Your SummaryRanges object will be instantiated and called as such:\... | ["SummaryRanges","addNum","getIntervals","addNum","getIntervals","addNum","getIntervals","addNum","getIntervals","addNum","getIntervals"]
[[],[1],[],[3],[],[7],[],[2],[],[6],[]] | {
"classname": "SummaryRanges",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "value"
}
],
"return": {
"type": "void"
},
"name": "addNum"
},
{
"params": [],
"return": ... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Binary Search', 'Design', 'Ordered Set'] |
353 | Design Snake Game | design-snake-game | null | Medium | 93.2K | 238.6K | 93,213 | 238,552 | 39.1% | [] | [] | Algorithms | null | ["SnakeGame","move","move","move","move","move","move"]
[[3,2,[[1,2],[0,1]]],["R"],["D"],["R"],["U"],["L"],["U"]] | {
"classname": "SnakeGame",
"constructor": {
"params": [
{
"type": "integer",
"name": "width"
},
{
"type": "integer",
"name": "height"
},
{
"type": "integer[][]",
"name": "food"
}
]
},
"methods": [
{
"params": ... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Design', 'Queue', 'Simulation'] |
354 | Russian Doll Envelopes | russian-doll-envelopes | <p>You are given a 2D array of integers <code>envelopes</code> where <code>envelopes[i] = [w<sub>i</sub>, h<sub>i</sub>]</code> represents the width and the height of an envelope.</p>
<p>One envelope can fit into another if and only if both the width and height of one envelope are greater than the other envelope's... | Hard | 248.1K | 666.8K | 248,114 | 666,808 | 37.2% | ['longest-increasing-subsequence', 'the-number-of-weak-characters-in-the-game', 'longest-non-decreasing-subarray-from-two-arrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxEnvelopes(vector<vector<int>>& envelopes) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxEnvelopes(int[][] envelopes) {\n \n }\n}"}, {"value": "python", "text... | [[5,4],[6,4],[6,7],[2,3]] | {
"name": "maxEnvelopes",
"params": [
{
"name": "envelopes",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Dynamic Programming', 'Sorting'] |
355 | Design Twitter | design-twitter | <p>Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the <code>10</code> most recent tweets in the user's news feed.</p>
<p>Implement the <code>Twitter</code> class:</p>
<ul>
<li><code>Twitter()</code> Initializes your twitter object.</li>
<li><... | Medium | 242.3K | 580K | 242,286 | 579,962 | 41.8% | ['design-a-file-sharing-system'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Twitter {\npublic:\n Twitter() {\n \n }\n \n void postTweet(int userId, int tweetId) {\n \n }\n \n vector<int> getNewsFeed(int userId) {\n \n }\n \n void follow(int followerId, int followeeId) {\n \n }\n ... | ["Twitter","postTweet","getNewsFeed","follow","postTweet","getNewsFeed","unfollow","getNewsFeed"]
[[],[1,5],[1],[1,2],[2,6],[1],[1,2],[1]] | {
"classname": "Twitter",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "userId"
},
{
"type": "integer",
"name": "tweetId"
}
],
"return": {
"type": "void"
},... | {"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', 'Linked List', 'Design', 'Heap (Priority Queue)'] |
356 | Line Reflection | line-reflection | null | Medium | 43.5K | 121.3K | 43,539 | 121,283 | 35.9% | ['max-points-on-a-line', 'number-of-boomerangs'] | [] | Algorithms | null | [[1,1],[-1,1]] | {
"name": "isReflected",
"params": [
{
"name": "points",
"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', 'Math'] |
357 | Count Numbers with Unique Digits | count-numbers-with-unique-digits | <p>Given an integer <code>n</code>, return the count of all numbers with unique digits, <code>x</code>, where <code>0 <= x < 10<sup>n</sup></code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> n = 2
<strong>Output:</strong> 91
<strong>Explanation:</strong> T... | Medium | 159.7K | 295.2K | 159,688 | 295,236 | 54.1% | ['count-special-integers', 'count-numbers-with-unique-digits-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countNumbersWithUniqueDigits(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countNumbersWithUniqueDigits(int n) {\n \n }\n}"}, {"value": "python", "text": "P... | 2 | {
"name": "countNumbersWithUniqueDigits",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Dynamic Programming', 'Backtracking'] |
358 | Rearrange String k Distance Apart | rearrange-string-k-distance-apart | null | Hard | 69.3K | 176.4K | 69,333 | 176,370 | 39.3% | ['task-scheduler', 'reorganize-string', 'construct-string-with-repeat-limit'] | [] | Algorithms | null | "aabbcc"
3 | {
"name": "rearrangeString",
"params": [
{
"name": "s",
"type": "string"
},
{
"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... | ['Hash Table', 'String', 'Greedy', 'Sorting', 'Heap (Priority Queue)', 'Counting'] |
359 | Logger Rate Limiter | logger-rate-limiter | null | Easy | 355.6K | 465.4K | 355,586 | 465,361 | 76.4% | ['design-hit-counter'] | [] | Algorithms | null | ["Logger","shouldPrintMessage","shouldPrintMessage","shouldPrintMessage","shouldPrintMessage","shouldPrintMessage","shouldPrintMessage"]
[[],[1,"foo"],[2,"bar"],[3,"foo"],[8,"bar"],[10,"foo"],[11,"foo"]] | {
"classname": "Logger",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "timestamp"
},
{
"type": "string",
"name": "message"
}
],
"name": "shouldPrintMessage",
"retur... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'Design', 'Data Stream'] |
360 | Sort Transformed Array | sort-transformed-array | null | Medium | 70.8K | 124.4K | 70,769 | 124,405 | 56.9% | ['squares-of-a-sorted-array', 'minimum-time-to-repair-cars'] | [] | Algorithms | null | [-4,-2,2,4]
1
3
5 | {
"name": "sortTransformedArray",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "a",
"type": "integer"
},
{
"name": "b",
"type": "integer"
},
{
"name": "c",
"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', 'Two Pointers', 'Sorting'] |
361 | Bomb Enemy | bomb-enemy | null | Medium | 81.1K | 155.9K | 81,148 | 155,920 | 52.0% | ['minimum-cost-homecoming-of-a-robot-in-a-grid', 'stamping-the-grid', 'count-unguarded-cells-in-the-grid', 'maximum-trailing-zeros-in-a-cornered-path'] | [] | Algorithms | null | [["0","E","0","0"],["E","0","W","E"],["0","E","0","0"]] | {
"name": "maxKilledEnemies",
"params": [
{
"name": "grid",
"type": "character[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Matrix'] |
362 | Design Hit Counter | design-hit-counter | null | Medium | 275.8K | 399.2K | 275,773 | 399,241 | 69.1% | ['logger-rate-limiter'] | [] | Algorithms | null | ["HitCounter","hit","hit","hit","getHits","hit","getHits","getHits"]
[[],[1],[2],[3],[4],[300],[300],[301]] | {
"classname": "HitCounter",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "timestamp"
}
],
"return": {
"type": "void"
},
"name": "hit"
},
{
"params": [
{
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Design', 'Queue', 'Data Stream'] |
363 | Max Sum of Rectangle No Larger Than K | max-sum-of-rectangle-no-larger-than-k | <p>Given an <code>m x n</code> matrix <code>matrix</code> and an integer <code>k</code>, return <em>the max sum of a rectangle in the matrix such that its sum is no larger than</em> <code>k</code>.</p>
<p>It is <strong>guaranteed</strong> that there will be a rectangle with a sum no larger than <code>k</code>.</p>
<p... | Hard | 132.5K | 297.5K | 132,534 | 297,499 | 44.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSumSubmatrix(vector<vector<int>>& matrix, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSumSubmatrix(int[][] matrix, int k) {\n \n }\n}"}, {"value": "... | [[1,0,1],[0,-2,3]]
2 | {
"name": "maxSumSubmatrix",
"params": [
{
"name": "matrix",
"type": "integer[][]"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Matrix', 'Prefix Sum', 'Ordered Set'] |
364 | Nested List Weight Sum II | nested-list-weight-sum-ii | null | Medium | 150.8K | 231.1K | 150,752 | 231,069 | 65.2% | ['nested-list-weight-sum', 'array-nesting'] | [] | Algorithms | null | [[1,1],2,[1,1]] | {
"name": "depthSumInverse",
"params": [
{
"name": "nestedList",
"type": "list<NestedInteger>"
}
],
"return": {
"type": "integer"
},
"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', 'Depth-First Search', 'Breadth-First Search'] |
365 | Water and Jug Problem | water-and-jug-problem | <p>You are given two jugs with capacities <code>x</code> liters and <code>y</code> liters. You have an infinite water supply. Return whether the total amount of water in both jugs may reach <code>target</code> using the following operations:</p>
<ul>
<li>Fill either jug completely with water.</li>
<li>Completely emp... | Medium | 121.1K | 283.6K | 121,115 | 283,617 | 42.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canMeasureWater(int x, int y, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canMeasureWater(int x, int y, int target) {\n \n }\n}"}, {"value": "py... | 3
5
4 | {
"name": "canMeasureWater",
"params": [
{
"name": "x",
"type": "integer"
},
{
"name": "y",
"type": "integer"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Depth-First Search', 'Breadth-First Search'] |
366 | Find Leaves of Binary Tree | find-leaves-of-binary-tree | null | Medium | 273.9K | 338.1K | 273,906 | 338,148 | 81.0% | [] | [] | Algorithms | null | [1,2,3,4,5] | {
"name": "findLeaves",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "list<list<integer>>",
"dealloc": true
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Binary Tree'] |
367 | Valid Perfect Square | valid-perfect-square | <p>Given a positive integer num, return <code>true</code> <em>if</em> <code>num</code> <em>is a perfect square or</em> <code>false</code> <em>otherwise</em>.</p>
<p>A <strong>perfect square</strong> is an integer that is the square of an integer. In other words, it is the product of some integer with itself.</p>
<p>Y... | Easy | 748.6K | 1.7M | 748,587 | 1,697,897 | 44.1% | ['sqrtx', 'sum-of-square-numbers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isPerfectSquare(int num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isPerfectSquare(int num) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | 16 | {
"name": "isPerfectSquare",
"params": [
{
"name": "num",
"type": "integer"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Binary Search'] |
368 | Largest Divisible Subset | largest-divisible-subset | <p>Given a set of <strong>distinct</strong> positive integers <code>nums</code>, return the largest subset <code>answer</code> such that every pair <code>(answer[i], answer[j])</code> of elements in this subset satisfies:</p>
<ul>
<li><code>answer[i] % answer[j] == 0</code>, or</li>
<li><code>answer[j] % answer[i] =... | Medium | 428.1K | 879.3K | 428,104 | 879,254 | 48.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> largestDivisibleSubset(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> largestDivisibleSubset(int[] nums) {\n \n }\n}"}, {"value... | [1,2,3] | {
"name": "largestDivisibleSubset",
"params": [
{
"name": "nums",
"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', 'Math', 'Dynamic Programming', 'Sorting'] |
369 | Plus One Linked List | plus-one-linked-list | null | Medium | 84.2K | 137.7K | 84,187 | 137,700 | 61.1% | ['plus-one', 'double-a-number-represented-as-a-linked-list'] | [] | Algorithms | null | [1,2,3] | {
"name": "plusOne",
"params": [
{
"name": "head",
"type": "ListNode",
"dealloc": false
}
],
"return": {
"type": "ListNode",
"dealloc": true
}
} | {"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'] |
370 | Range Addition | range-addition | null | Medium | 99.1K | 137.2K | 99,055 | 137,210 | 72.2% | ['range-addition-ii', 'count-positions-on-street-with-required-brightness', 'shifting-letters-ii'] | [] | Algorithms | null | 5
[[1,3,2],[2,4,3],[0,2,-2]] | {
"name": "getModifiedArray",
"params": [
{
"name": "length",
"type": "integer"
},
{
"name": "updates",
"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', 'Prefix Sum'] |
371 | Sum of Two Integers | sum-of-two-integers | <p>Given two integers <code>a</code> and <code>b</code>, return <em>the sum of the two integers without using the operators</em> <code>+</code> <em>and</em> <code>-</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> a = 1, b = 2
<strong>Output:</strong> 3
</pre><p... | Medium | 574.9K | 1.1M | 574,941 | 1,077,511 | 53.4% | ['add-two-numbers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getSum(int a, int b) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getSum(int a, int b) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class ... | 1
2 | {
"name": "getSum",
"params": [
{
"name": "a",
"type": "integer"
},
{
"name": "b",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Bit Manipulation'] |
372 | Super Pow | super-pow | <p>Your task is to calculate <code>a<sup>b</sup></code> mod <code>1337</code> where <code>a</code> is a positive integer and <code>b</code> is an extremely large positive integer given in the form of an array.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> a = 2, b ... | Medium | 84.1K | 238.1K | 84,119 | 238,079 | 35.3% | ['powx-n'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int superPow(int a, vector<int>& b) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int superPow(int a, int[] b) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | 2
[3] | {
"name": "superPow",
"params": [
{
"name": "a",
"type": "integer"
},
{
"name": "b",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Divide and Conquer'] |
373 | Find K Pairs with Smallest Sums | find-k-pairs-with-smallest-sums | <p>You are given two integer arrays <code>nums1</code> and <code>nums2</code> sorted in <strong>non-decreasing order</strong> and an integer <code>k</code>.</p>
<p>Define a pair <code>(u, v)</code> which consists of one element from the first array and one element from the second array.</p>
<p>Return <em>the</em... | Medium | 365.5K | 902.1K | 365,538 | 902,138 | 40.5% | ['kth-smallest-element-in-a-sorted-matrix', 'find-k-th-smallest-pair-distance', 'kth-smallest-product-of-two-sorted-arrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> kSmallestPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> kSmallestPairs(int[] nums1, int[]... | [1,7,11]
[2,4,6]
3 | {
"name": "kSmallestPairs",
"params": [
{
"name": "nums1",
"type": "integer[]"
},
{
"name": "nums2",
"type": "integer[]"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "list<list<integer>>"
},
"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... | ['Array', 'Heap (Priority Queue)'] |
374 | Guess Number Higher or Lower | guess-number-higher-or-lower | <p>We are playing the Guess Game. The game is as follows:</p>
<p>I pick a number from <code>1</code> to <code>n</code>. You have to guess which number I picked.</p>
<p>Every time you guess wrong, I will tell you whether the number I picked is higher or lower than your guess.</p>
<p>You call a pre-defined API <code>i... | Easy | 822.8K | 1.5M | 822,840 | 1,484,791 | 55.4% | ['first-bad-version', 'guess-number-higher-or-lower-ii', 'find-k-closest-elements'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/** \n * Forward declaration of guess API.\n * @param num your guess\n * @return \t -1 if num is higher than the picked number\n *\t\t\t 1 if num is lower than the picked number\n * otherwise return 0\n * int guess(int num);\n */\n\nclass Soluti... | 10
6 | {
"name": "guessNumber",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "pick",
"type": "integer"
}
],
"return": {
"type": "integer"
},
"manual": true,
"languages": [
"cpp",
"java",
"python",
"c",
"csharp",
"javascript",
"r... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Binary Search', 'Interactive'] |
375 | Guess Number Higher or Lower II | guess-number-higher-or-lower-ii | <p>We are playing the Guessing Game. The game will work as follows:</p>
<ol>
<li>I pick a number between <code>1</code> and <code>n</code>.</li>
<li>You guess a number.</li>
<li>If you guess the right number, <strong>you win the game</strong>.</li>
<li>If you guess the wrong number, then I will tell... | Medium | 140.9K | 277.2K | 140,903 | 277,213 | 50.8% | ['flip-game-ii', 'guess-number-higher-or-lower', 'can-i-win', 'find-k-closest-elements'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getMoneyAmount(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getMoneyAmount(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "clas... | 10 | {
"name": "getMoneyAmount",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Dynamic Programming', 'Game Theory'] |
376 | Wiggle Subsequence | wiggle-subsequence | <p>A <strong>wiggle sequence</strong> is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with one element and a sequence with two non-equal elements are trivially wiggle sequ... | Medium | 266.6K | 546.5K | 266,622 | 546,506 | 48.8% | ['rearrange-array-elements-by-sign'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int wiggleMaxLength(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int wiggleMaxLength(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | [1,7,4,9,2,5] | {
"name": "wiggleMaxLength",
"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', 'Greedy'] |
377 | Combination Sum IV | combination-sum-iv | <p>Given an array of <strong>distinct</strong> integers <code>nums</code> and a target integer <code>target</code>, return <em>the number of possible combinations that add up to</em> <code>target</code>.</p>
<p>The test cases are generated so that the answer can fit in a <strong>32-bit</strong> integer.</p>
<p>&... | Medium | 540.3K | 990K | 540,297 | 990,009 | 54.6% | ['combination-sum', 'ways-to-express-an-integer-as-sum-of-powers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int combinationSum4(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int combinationSum4(int[] nums, int target) {\n \n }\n}"}, {"value": "pyth... | [1,2,3]
4 | {
"name": "combinationSum4",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "target",
"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'] |
378 | Kth Smallest Element in a Sorted Matrix | kth-smallest-element-in-a-sorted-matrix | <p>Given an <code>n x n</code> <code>matrix</code> where each of the rows and columns is sorted in ascending order, return <em>the</em> <code>k<sup>th</sup></code> <em>smallest element in the matrix</em>.</p>
<p>Note that it is the <code>k<sup>th</sup></code> smallest element <strong>in the sorted order</strong>, not ... | Medium | 698K | 1.1M | 697,982 | 1,101,726 | 63.4% | ['find-k-pairs-with-smallest-sums', 'kth-smallest-number-in-multiplication-table', 'find-k-th-smallest-pair-distance', 'k-th-smallest-prime-fraction'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int kthSmallest(vector<vector<int>>& matrix, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int kthSmallest(int[][] matrix, int k) {\n \n }\n}"}, {"value": "python",... | [[1,5,9],[10,11,13],[12,13,15]]
8 | {
"name": "kthSmallest",
"params": [
{
"name": "matrix",
"type": "integer[][]"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Sorting', 'Heap (Priority Queue)', 'Matrix'] |
379 | Design Phone Directory | design-phone-directory | null | Medium | 70.2K | 134.3K | 70,196 | 134,339 | 52.3% | ['seat-reservation-manager'] | [] | Algorithms | null | ["PhoneDirectory","get","get","check","get","check","release","check"]
[[3],[],[],[2],[],[2],[2],[2]] | {
"classname": "PhoneDirectory",
"constructor": {
"params": [
{
"name": "maxNumbers",
"type": "integer"
}
]
},
"methods": [
{
"params": [],
"name": "get",
"return": {
"type": "integer"
}
},
{
"params": [
{
"t... | {"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', 'Linked List', 'Design', 'Queue'] |
380 | Insert Delete GetRandom O(1) | insert-delete-getrandom-o1 | <p>Implement the <code>RandomizedSet</code> class:</p>
<ul>
<li><code>RandomizedSet()</code> Initializes the <code>RandomizedSet</code> object.</li>
<li><code>bool insert(int val)</code> Inserts an item <code>val</code> into the set if not present. Returns <code>true</code> if the item was not present, <code>false</... | Medium | 1.2M | 2.1M | 1,150,796 | 2,093,587 | 55.0% | ['insert-delete-getrandom-o1-duplicates-allowed'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class RandomizedSet {\npublic:\n RandomizedSet() {\n \n }\n \n bool insert(int val) {\n \n }\n \n bool remove(int val) {\n \n }\n \n int getRandom() {\n \n }\n};\n\n/**\n * Your RandomizedSet object will be ins... | ["RandomizedSet","insert","remove","insert","getRandom","remove","insert","getRandom"]
[[],[1],[2],[2],[],[1],[2],[]] | {
"classname": "RandomizedSet",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "val"
}
],
"name": "insert",
"return": {
"type": "boolean"
}
},
{
"params": [
{
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Math', 'Design', 'Randomized'] |
381 | Insert Delete GetRandom O(1) - Duplicates allowed | insert-delete-getrandom-o1-duplicates-allowed | <p><code>RandomizedCollection</code> is a data structure that contains a collection of numbers, possibly duplicates (i.e., a multiset). It should support inserting and removing specific elements and also reporting a random element.</p>
<p>Implement the <code>RandomizedCollection</code> class:</p>
<ul>
<li><code>Rand... | Hard | 162.3K | 452.9K | 162,316 | 452,860 | 35.8% | ['insert-delete-getrandom-o1'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class RandomizedCollection {\npublic:\n RandomizedCollection() {\n \n }\n \n bool insert(int val) {\n \n }\n \n bool remove(int val) {\n \n }\n \n int getRandom() {\n \n }\n};\n\n/**\n * Your RandomizedCollecti... | ["RandomizedCollection","insert","insert","insert","getRandom","remove","getRandom"]
[[],[1],[1],[2],[],[1],[]] | {
"classname": "RandomizedCollection",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "val"
}
],
"return": {
"type": "boolean"
},
"name": "insert"
},
{
"params": [
{
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Math', 'Design', 'Randomized'] |
382 | Linked List Random Node | linked-list-random-node | <p>Given a singly linked list, return a random node's value from the linked list. Each node must have the <strong>same probability</strong> of being chosen.</p>
<p>Implement the <code>Solution</code> class:</p>
<ul>
<li><code>Solution(ListNode head)</code> Initializes the object with the head of the singly-linke... | Medium | 262.4K | 411.1K | 262,421 | 411,058 | 63.8% | ['random-pick-index'] | [] | 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 * ... | ["Solution","getRandom","getRandom","getRandom","getRandom","getRandom"]
[[[1,2,3]],[],[],[],[],[]] | {
"classname": "Solution",
"constructor": {
"params": [
{
"type": "ListNode",
"name": "head"
}
]
},
"methods": [
{
"params": [],
"name": "getRandom",
"return": {
"type": "integer"
}
}
],
"return": {
"type": "boolean"
},
"sys... | {"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', 'Reservoir Sampling', 'Randomized'] |
383 | Ransom Note | ransom-note | <p>Given two strings <code>ransomNote</code> and <code>magazine</code>, return <code>true</code><em> if </em><code>ransomNote</code><em> can be constructed by using the letters from </em><code>magazine</code><em> and </em><code>false</code><em> otherwise</em>.</p>
<p>Each letter in <code>magazine</code> can only be us... | Easy | 1.6M | 2.4M | 1,556,578 | 2,426,588 | 64.1% | ['stickers-to-spell-word', 'find-words-that-can-be-formed-by-characters'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canConstruct(string ransomNote, string magazine) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canConstruct(String ransomNote, String magazine) {\n \n }\n}"},... | "a"
"b" | {
"name": "canConstruct",
"params": [
{
"name": "ransomNote",
"type": "string"
},
{
"name": "magazine",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Counting'] |
384 | Shuffle an Array | shuffle-an-array | <p>Given an integer array <code>nums</code>, design an algorithm to randomly shuffle the array. All permutations of the array should be <strong>equally likely</strong> as a result of the shuffling.</p>
<p>Implement the <code>Solution</code> class:</p>
<ul>
<li><code>Solution(int[] nums)</code> Initializes the object... | Medium | 361.3K | 613.5K | 361,340 | 613,461 | 58.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n Solution(vector<int>& nums) {\n \n }\n \n vector<int> reset() {\n \n }\n \n vector<int> shuffle() {\n \n }\n};\n\n/**\n * Your Solution object will be instantiated and called as such:\n * Solution* ... | ["Solution","shuffle","reset","shuffle"]
[[[1,2,3]],[],[],[]] | {
"classname": "Solution",
"constructor": {
"params": [
{
"type": "integer[]",
"name": "nums"
}
]
},
"methods": [
{
"params": [],
"name": "reset",
"return": {
"type": "integer[]"
}
},
{
"params": [],
"return": {
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Design', 'Randomized'] |
385 | Mini Parser | mini-parser | <p>Given a string s represents the serialization of a nested list, implement a parser to deserialize it and return <em>the deserialized</em> <code>NestedInteger</code>.</p>
<p>Each element is either an integer or a list whose elements may also be integers or other lists.</p>
<p> </p>
<p><strong class="example">E... | Medium | 63.4K | 159.4K | 63,436 | 159,352 | 39.8% | ['flatten-nested-list-iterator', 'ternary-expression-parser', 'remove-comments'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * // This is the interface that allows for creating nested lists.\n * // You should not implement it, or speculate about its implementation\n * class NestedInteger {\n * public:\n * // Constructor initializes an empty nested list.\n * NestedInteger();\n *... | "324" | {
"name": "deserialize",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "NestedInteger"
},
"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', 'Stack', 'Depth-First Search'] |
386 | Lexicographical Numbers | lexicographical-numbers | <p>Given an integer <code>n</code>, return all the numbers in the range <code>[1, n]</code> sorted in lexicographical order.</p>
<p>You must write an algorithm that runs in <code>O(n)</code> time and uses <code>O(1)</code> extra space. </p>
<p> </p>
<p><strong class="example">Example 1:</strong></... | Medium | 265.1K | 362.9K | 265,080 | 362,926 | 73.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> lexicalOrder(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> lexicalOrder(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau... | 13 | {
"name": "lexicalOrder",
"params": [
{
"name": "n",
"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... | ['Depth-First Search', 'Trie'] |
387 | First Unique Character in a String | first-unique-character-in-a-string | <p>Given a string <code>s</code>, find the <strong>first</strong> non-repeating character in it and return its index. If it <strong>does not</strong> exist, return <code>-1</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="... | Easy | 2M | 3.1M | 1,961,182 | 3,093,712 | 63.4% | ['sort-characters-by-frequency', 'first-letter-to-appear-twice'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int firstUniqChar(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int firstUniqChar(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "... | "leetcode" | {
"name": "firstUniqChar",
"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', 'Queue', 'Counting'] |
388 | Longest Absolute File Path | longest-absolute-file-path | <p>Suppose we have a file system that stores both files and directories. An example of one system is represented in the following picture:</p>
<p><img alt="" src="https://assets.leetcode.com/uploads/2020/08/28/mdir.jpg" style="width: 681px; height: 322px;" /></p>
<p>Here, we have <code>dir</code> as the only director... | Medium | 167.8K | 347.9K | 167,766 | 347,938 | 48.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int lengthLongestPath(string input) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int lengthLongestPath(String input) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | "dir\n\tsubdir1\n\tsubdir2\n\t\tfile.ext" | {
"name": "lengthLongestPath",
"params": [
{
"name": "input",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Stack', 'Depth-First Search'] |
389 | Find the Difference | find-the-difference | <p>You are given two strings <code>s</code> and <code>t</code>.</p>
<p>String <code>t</code> is generated by random shuffling string <code>s</code> and then add one more letter at a random position.</p>
<p>Return the letter that was added to <code>t</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</st... | Easy | 881.1K | 1.5M | 881,055 | 1,477,248 | 59.6% | ['single-number', 'permutation-difference-between-two-strings'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n char findTheDifference(string s, string t) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public char findTheDifference(String s, String t) {\n \n }\n}"}, {"value": "python", "tex... | "abcd"
"abcde" | {
"name": "findTheDifference",
"params": [
{
"name": "s",
"type": "string"
},
{
"name": "t",
"type": "string"
}
],
"return": {
"type": "character"
}
} | {"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', 'Bit Manipulation', 'Sorting'] |
390 | Elimination Game | elimination-game | <p>You have a list <code>arr</code> of all integers in the range <code>[1, n]</code> sorted in a strictly increasing order. Apply the following algorithm on <code>arr</code>:</p>
<ul>
<li>Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.</li>
<... | Medium | 86.3K | 193.2K | 86,320 | 193,223 | 44.7% | ['min-max-game'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int lastRemaining(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int lastRemaining(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class ... | 9 | {
"name": "lastRemaining",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Recursion'] |
391 | Perfect Rectangle | perfect-rectangle | <p>Given an array <code>rectangles</code> where <code>rectangles[i] = [x<sub>i</sub>, y<sub>i</sub>, a<sub>i</sub>, b<sub>i</sub>]</code> represents an axis-aligned rectangle. The bottom-left point of the rectangle is <code>(x<sub>i</sub>, y<sub>i</sub>)</code> and the top-right point of it is <code>(a<sub>i</sub>, b<s... | Hard | 49.9K | 142.8K | 49,882 | 142,831 | 34.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isRectangleCover(vector<vector<int>>& rectangles) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isRectangleCover(int[][] rectangles) {\n \n }\n}"}, {"value": ... | [[1,1,3,3],[3,1,4,2],[3,2,4,4],[1,3,2,4],[2,3,3,4]] | {
"name": "isRectangleCover",
"params": [
{
"name": "rectangles",
"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', 'Line Sweep'] |
392 | Is Subsequence | is-subsequence | <p>Given two strings <code>s</code> and <code>t</code>, return <code>true</code><em> if </em><code>s</code><em> is a <strong>subsequence</strong> of </em><code>t</code><em>, or </em><code>false</code><em> otherwise</em>.</p>
<p>A <strong>subsequence</strong> of a string is a new string that is formed from the original... | Easy | 2M | 4.1M | 1,995,762 | 4,133,825 | 48.3% | ['number-of-matching-subsequences', 'shortest-way-to-form-string', 'append-characters-to-string-to-make-subsequence', 'make-string-a-subsequence-using-cyclic-increments'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isSubsequence(string s, string t) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isSubsequence(String s, String t) {\n \n }\n}"}, {"value": "python", "text": "... | "abc"
"ahbgdc" | {
"name": "isSubsequence",
"params": [
{
"name": "s",
"type": "string"
},
{
"name": "t",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String', 'Dynamic Programming'] |
393 | UTF-8 Validation | utf-8-validation | <p>Given an integer array <code>data</code> representing the data, return whether it is a valid <strong>UTF-8</strong> encoding (i.e. it translates to a sequence of valid UTF-8 encoded characters).</p>
<p>A character in <strong>UTF8</strong> can be from <strong>1 to 4 bytes</strong> long, subjected to the following ru... | Medium | 130.8K | 287.8K | 130,842 | 287,840 | 45.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool validUtf8(vector<int>& data) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean validUtf8(int[] data) {\n \n }\n}"}, {"value": "python", "text": "Python", "default... | [197,130,1] | {
"name": "validUtf8",
"params": [
{
"name": "data",
"type": "integer[]"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Bit Manipulation'] |
394 | Decode String | decode-string | <p>Given an encoded string, return its decoded string.</p>
<p>The encoding rule is: <code>k[encoded_string]</code>, where the <code>encoded_string</code> inside the square brackets is being repeated exactly <code>k</code> times. Note that <code>k</code> is guaranteed to be a positive integer.</p>
<p>You may assume th... | Medium | 986.6K | 1.6M | 986,611 | 1,621,574 | 60.8% | ['encode-string-with-shortest-length', 'number-of-atoms', 'brace-expansion'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string decodeString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String decodeString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode... | "3[a]2[bc]" | {
"name": "decodeString",
"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', 'Stack', 'Recursion'] |
395 | Longest Substring with At Least K Repeating Characters | longest-substring-with-at-least-k-repeating-characters | <p>Given a string <code>s</code> and an integer <code>k</code>, return <em>the length of the longest substring of</em> <code>s</code> <em>such that the frequency of each character in this substring is greater than or equal to</em> <code>k</code>.</p>
<p data-pm-slice="1 1 []">if no such substring exists, return 0.</p>... | Medium | 257.1K | 567K | 257,146 | 566,970 | 45.4% | ['longest-subsequence-repeated-k-times', 'number-of-equal-count-substrings', 'optimal-partition-of-string', 'length-of-longest-subarray-with-at-most-k-frequency', 'find-longest-special-substring-that-occurs-thrice-ii', 'find-longest-special-substring-that-occurs-thrice-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestSubstring(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestSubstring(String s, int k) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | "aaabb"
3 | {
"name": "longestSubstring",
"params": [
{
"name": "s",
"type": "string"
},
{
"name": "k",
"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... | ['Hash Table', 'String', 'Divide and Conquer', 'Sliding Window'] |
396 | Rotate Function | rotate-function | <p>You are given an integer array <code>nums</code> of length <code>n</code>.</p>
<p>Assume <code>arr<sub>k</sub></code> to be an array obtained by rotating <code>nums</code> by <code>k</code> positions clock-wise. We define the <strong>rotation function</strong> <code>F</code> on <code>nums</code> as follow:</p>
<ul... | Medium | 96.6K | 220.9K | 96,642 | 220,939 | 43.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxRotateFunction(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxRotateFunction(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python... | [4,3,2,6] | {
"name": "maxRotateFunction",
"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'] |
397 | Integer Replacement | integer-replacement | <p>Given a positive integer <code>n</code>, you can apply one of the following operations:</p>
<ol>
<li>If <code>n</code> is even, replace <code>n</code> with <code>n / 2</code>.</li>
<li>If <code>n</code> is odd, replace <code>n</code> with either <code>n + 1</code> or <code>n - 1</code>.</li>
</ol>
<p>R... | Medium | 137.7K | 378.4K | 137,651 | 378,372 | 36.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int integerReplacement(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int integerReplacement(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode... | 8 | {
"name": "integerReplacement",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming', 'Greedy', 'Bit Manipulation', 'Memoization'] |
398 | Random Pick Index | random-pick-index | <p>Given an integer array <code>nums</code> with possible <strong>duplicates</strong>, randomly output the index of a given <code>target</code> number. You can assume that the given target number must exist in the array.</p>
<p>Implement the <code>Solution</code> class:</p>
<ul>
<li><code>Solution(int[] nums)</code>... | Medium | 274.5K | 426.3K | 274,452 | 426,317 | 64.4% | ['linked-list-random-node', 'random-pick-with-blacklist', 'random-pick-with-weight'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n Solution(vector<int>& nums) {\n \n }\n \n int pick(int target) {\n \n }\n};\n\n/**\n * Your Solution object will be instantiated and called as such:\n * Solution* obj = new Solution(nums);\n * int param_1 = obj->pi... | ["Solution","pick","pick","pick"]
[[[1,2,3,3,3]],[3],[1],[3]] | {
"classname": "Solution",
"constructor": {
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "numsSize",
"lang": "c",
"value": "size_1"
... | {"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', 'Reservoir Sampling', 'Randomized'] |
399 | Evaluate Division | evaluate-division | <p>You are given an array of variable pairs <code>equations</code> and an array of real numbers <code>values</code>, where <code>equations[i] = [A<sub>i</sub>, B<sub>i</sub>]</code> and <code>values[i]</code> represent the equation <code>A<sub>i</sub> / B<sub>i</sub> = values[i]</code>. Each <code>A<sub>i</sub></code> ... | Medium | 582.3K | 926K | 582,284 | 925,992 | 62.9% | ['check-for-contradictions-in-equations', 'maximize-amount-after-two-days-of-conversions'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<double> calcEquation(vector<vector<string>>& equations, vector<double>& values, vector<vector<string>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double[] calcEq... | [["a","b"],["b","c"]]
[2.0,3.0]
[["a","c"],["b","a"],["a","e"],["a","a"],["x","x"]] | {
"name": "calcEquation",
"params": [
{
"name": "equations",
"type": "list<list<string>>"
},
{
"name": "values",
"type": "double[]"
},
{
"name": "queries",
"type": "list<list<string>>"
}
],
"return": {
"type": "double[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Graph', 'Shortest Path'] |
400 | Nth Digit | nth-digit | <p>Given an integer <code>n</code>, return the <code>n<sup>th</sup></code> digit of the infinite integer sequence <code>[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...]</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> n = 3
<strong>Output:</strong> 3
</pre>
<p><stron... | Medium | 108K | 304.6K | 107,988 | 304,640 | 35.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findNthDigit(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findNthDigit(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So... | 3 | {
"name": "findNthDigit",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Binary Search'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.