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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
901 | Online Stock Span | online-stock-span | <p>Design an algorithm that collects daily price quotes for some stock and returns <strong>the span</strong> of that stock's price for the current day.</p>
<p>The <strong>span</strong> of the stock's price in one day is the maximum number of consecutive days (starting from that day and going backward) for whic... | Medium | 430.2K | 639K | 430,238 | 638,954 | 67.3% | ['daily-temperatures'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class StockSpanner {\npublic:\n StockSpanner() {\n \n }\n \n int next(int price) {\n \n }\n};\n\n/**\n * Your StockSpanner object will be instantiated and called as such:\n * StockSpanner* obj = new StockSpanner();\n * int param_1 = obj->next... | ["StockSpanner","next","next","next","next","next","next","next"]
[[],[100],[80],[60],[70],[60],[75],[85]] | {
"classname": "StockSpanner",
"maxbytesperline": 200000,
"constructor": {
"params": []
},
"methods": [
{
"name" : "next",
"params": [
{
"type": "integer",
"name": "price"
}
],... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Design', 'Monotonic Stack', 'Data Stream'] |
902 | Numbers At Most N Given Digit Set | numbers-at-most-n-given-digit-set | <p>Given an array of <code>digits</code> which is sorted in <strong>non-decreasing</strong> order. You can write numbers using each <code>digits[i]</code> as many times as we want. For example, if <code>digits = ['1','3','5']</code>, we may write numbers such as <code>'13'</code>, <code>... | Hard | 48.3K | 111.8K | 48,290 | 111,831 | 43.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int atMostNGivenDigitSet(vector<string>& digits, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int atMostNGivenDigitSet(String[] digits, int n) {\n \n }\n}"}, {"val... | ["1","3","5","7"]
100 | {
"name": "atMostNGivenDigitSet",
"params": [
{
"name": "digits",
"type": "string[]"
},
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'String', 'Binary Search', 'Dynamic Programming'] |
903 | Valid Permutations for DI Sequence | valid-permutations-for-di-sequence | <p>You are given a string <code>s</code> of length <code>n</code> where <code>s[i]</code> is either:</p>
<ul>
<li><code>'D'</code> means decreasing, or</li>
<li><code>'I'</code> means increasing.</li>
</ul>
<p>A permutation <code>perm</code> of <code>n + 1</code> integers of all the integers in the ... | Hard | 18.1K | 31.9K | 18,079 | 31,867 | 56.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numPermsDISequence(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numPermsDISequence(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau... | "DID" | {
"name": "numPermsDISequence",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming', 'Prefix Sum'] |
904 | Fruit Into Baskets | fruit-into-baskets | <p>You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array <code>fruits</code> where <code>fruits[i]</code> is the <strong>type</strong> of fruit the <code>i<sup>th</sup></code> tree produces.</p>
<p>You want to collect as much fruit as po... | Medium | 497.4K | 1.1M | 497,418 | 1,085,420 | 45.8% | ['longest-nice-subarray', 'fruits-into-baskets-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int totalFruit(vector<int>& fruits) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int totalFruit(int[] fruits) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | [1,2,1] | {
"name": "totalFruit",
"params": [
{
"name": "fruits",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sliding Window'] |
905 | Sort Array By Parity | sort-array-by-parity | <p>Given an integer array <code>nums</code>, move all the even integers at the beginning of the array followed by all the odd integers.</p>
<p>Return <em><strong>any array</strong> that satisfies this condition</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> n... | Easy | 893.5K | 1.2M | 893,475 | 1,171,479 | 76.3% | ['sort-array-by-parity-ii', 'sort-even-and-odd-indices-independently', 'largest-number-after-digit-swaps-by-parity'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> sortArrayByParity(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] sortArrayByParity(int[] nums) {\n \n }\n}"}, {"value": "python", "text... | [3,1,2,4] | {
"name": "sortArrayByParity",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Sorting'] |
906 | Super Palindromes | super-palindromes | <p>Let's say a positive integer is a <strong>super-palindrome</strong> if it is a palindrome, and it is also the square of a palindrome.</p>
<p>Given two positive integers <code>left</code> and <code>right</code> represented as strings, return <em>the number of <strong>super-palindromes</strong> integers in the in... | Hard | 26.2K | 66.9K | 26,209 | 66,898 | 39.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int superpalindromesInRange(string left, string right) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int superpalindromesInRange(String left, String right) {\n \n }\n}"}, ... | "4"
"1000" | {
"name": "superpalindromesInRange",
"params": [
{
"name": "left",
"type": "string"
},
{
"name": "right",
"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... | ['Math', 'String', 'Enumeration'] |
907 | Sum of Subarray Minimums | sum-of-subarray-minimums | <p>Given an array of integers arr, find the sum of <code>min(b)</code>, where <code>b</code> ranges over every (contiguous) subarray of <code>arr</code>. Since the answer may be large, return the answer <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</st... | Medium | 328.4K | 877.8K | 328,437 | 877,792 | 37.4% | ['sum-of-subarray-ranges', 'sum-of-total-strength-of-wizards'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumSubarrayMins(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumSubarrayMins(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [3,1,2,4] | {
"name": "sumSubarrayMins",
"params": [
{
"name": "arr",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Stack', 'Monotonic Stack'] |
908 | Smallest Range I | smallest-range-i | <p>You are given an integer array <code>nums</code> and an integer <code>k</code>.</p>
<p>In one operation, you can choose any index <code>i</code> where <code>0 <= i < nums.length</code> and change <code>nums[i]</code> to <code>nums[i] + x</code> where <code>x</code> is an integer from the range <code>[-k, k]</... | Easy | 104.9K | 146.5K | 104,902 | 146,506 | 71.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int smallestRangeI(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int smallestRangeI(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text":... | [1]
0 | {
"name": "smallestRangeI",
"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', 'Math'] |
909 | Snakes and Ladders | snakes-and-ladders | <p>You are given an <code>n x n</code> integer matrix <code>board</code> where the cells are labeled from <code>1</code> to <code>n<sup>2</sup></code> in a <a href="https://en.wikipedia.org/wiki/Boustrophedon" target="_blank"><strong>Boustrophedon style</strong></a> starting from the bottom left of the board (i.e. <cod... | Medium | 242.9K | 551.3K | 242,921 | 551,267 | 44.1% | ['most-profitable-path-in-a-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int snakesAndLadders(vector<vector<int>>& board) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int snakesAndLadders(int[][] board) {\n \n }\n}"}, {"value": "python", "text... | [[-1,-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1,-1],[-1,35,-1,-1,13,-1],[-1,-1,-1,-1,-1,-1],[-1,15,-1,-1,-1,-1]] | {
"name": "snakesAndLadders",
"params": [
{
"name": "board",
"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'] |
910 | Smallest Range II | smallest-range-ii | <p>You are given an integer array <code>nums</code> and an integer <code>k</code>.</p>
<p>For each index <code>i</code> where <code>0 <= i < nums.length</code>, change <code>nums[i]</code> to be either <code>nums[i] + k</code> or <code>nums[i] - k</code>.</p>
<p>The <strong>score</strong> of <code>nums</code> i... | Medium | 60.3K | 163K | 60,292 | 162,986 | 37.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int smallestRangeII(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int smallestRangeII(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text... | [1]
0 | {
"name": "smallestRangeII",
"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', 'Math', 'Greedy', 'Sorting'] |
911 | Online Election | online-election | <p>You are given two integer arrays <code>persons</code> and <code>times</code>. In an election, the <code>i<sup>th</sup></code> vote was cast for <code>persons[i]</code> at time <code>times[i]</code>.</p>
<p>For each query at a time <code>t</code>, find the person that was leading the election at time <code>t</code>.... | Medium | 67.6K | 128.7K | 67,553 | 128,708 | 52.5% | ['rank-teams-by-votes'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class TopVotedCandidate {\npublic:\n TopVotedCandidate(vector<int>& persons, vector<int>& times) {\n \n }\n \n int q(int t) {\n \n }\n};\n\n/**\n * Your TopVotedCandidate object will be instantiated and called as such:\n * TopVotedCandidate* ... | ["TopVotedCandidate","q","q","q","q","q","q"]
[[[0,1,1,0,0,1,0],[0,5,10,15,20,25,30]],[3],[12],[25],[15],[24],[8]] | {
"classname": "TopVotedCandidate",
"maxbytesperline": 200000,
"constructor": {
"params": [
{ "type": "integer[]",
"name": "persons"
},
{ "type": "integer[]",
"name": "times"
}
]
},
"methods": [
{... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Binary Search', 'Design'] |
912 | Sort an Array | sort-an-array | <p>Given an array of integers <code>nums</code>, sort the array in ascending order and return it.</p>
<p>You must solve the problem <strong>without using any built-in</strong> functions in <code>O(nlog(n))</code> time complexity and with the smallest space complexity possible.</p>
<p> </p>
<p><strong class="exam... | Medium | 890.9K | 1.6M | 890,898 | 1,565,106 | 56.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> sortArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] sortArray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [5,2,3,1] | {
"name": "sortArray",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Divide and Conquer', 'Sorting', 'Heap (Priority Queue)', 'Merge Sort', 'Bucket Sort', 'Radix Sort', 'Counting Sort'] |
913 | Cat and Mouse | cat-and-mouse | <p>A game on an <strong>undirected</strong> graph is played by two players, Mouse and Cat, who alternate turns.</p>
<p>The graph is given as follows: <code>graph[a]</code> is a list of all nodes <code>b</code> such that <code>ab</code> is an edge of the graph.</p>
<p>The mouse starts at node <code>1</code> and goes f... | Hard | 22.5K | 66.3K | 22,527 | 66,273 | 34.0% | ['cat-and-mouse-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int catMouseGame(vector<vector<int>>& graph) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int catMouseGame(int[][] graph) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [[2,5],[3],[0,4,5],[1,4,5],[2,3],[0,2,3]] | {
"name": "catMouseGame",
"params": [
{
"name": "graph",
"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', 'Graph', 'Topological Sort', 'Memoization', 'Game Theory'] |
914 | X of a Kind in a Deck of Cards | x-of-a-kind-in-a-deck-of-cards | <p>You are given an integer array <code>deck</code> where <code>deck[i]</code> represents the number written on the <code>i<sup>th</sup></code> card.</p>
<p>Partition the cards into <strong>one or more groups</strong> such that:</p>
<ul>
<li>Each group has <strong>exactly</strong> <code>x</code> cards where <code>x ... | Easy | 138.2K | 463.1K | 138,160 | 463,143 | 29.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool hasGroupsSizeX(vector<int>& deck) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean hasGroupsSizeX(int[] deck) {\n \n }\n}"}, {"value": "python", "text": "Python"... | [1,2,3,4,4,3,2,1] | {
"name": "hasGroupsSizeX",
"params": [
{
"name": "deck",
"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', 'Counting', 'Number Theory'] |
915 | Partition Array into Disjoint Intervals | partition-array-into-disjoint-intervals | <p>Given an integer array <code>nums</code>, partition it into two (contiguous) subarrays <code>left</code> and <code>right</code> so that:</p>
<ul>
<li>Every element in <code>left</code> is less than or equal to every element in <code>right</code>.</li>
<li><code>left</code> and <code>right</code> are non-empty.</l... | Medium | 90.7K | 185.3K | 90,727 | 185,329 | 49.0% | ['sum-of-beauty-in-the-array', 'optimal-partition-of-string', 'minimum-index-of-a-valid-split', 'maximum-strength-of-k-disjoint-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int partitionDisjoint(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int partitionDisjoint(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python... | [5,0,3,8,6] | {
"name": "partitionDisjoint",
"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'] |
916 | Word Subsets | word-subsets | <p>You are given two string arrays <code>words1</code> and <code>words2</code>.</p>
<p>A string <code>b</code> is a <strong>subset</strong> of string <code>a</code> if every letter in <code>b</code> occurs in <code>a</code> including multiplicity.</p>
<ul>
<li>For example, <code>"wrr"</code> is a subset of... | Medium | 255.3K | 458.8K | 255,317 | 458,750 | 55.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> wordSubsets(vector<string>& words1, vector<string>& words2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> wordSubsets(String[] words1, String[] words2) {... | ["amazon","apple","facebook","google","leetcode"]
["e","o"] | {
"name": "wordSubsets",
"params": [
{
"name": "words1",
"type": "string[]"
},
{
"name": "words2",
"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... | ['Array', 'Hash Table', 'String'] |
917 | Reverse Only Letters | reverse-only-letters | <p>Given a string <code>s</code>, reverse the string according to the following rules:</p>
<ul>
<li>All the characters that are not English letters remain in the same position.</li>
<li>All the English letters (lowercase or uppercase) should be reversed.</li>
</ul>
<p>Return <code>s</code><em> after reversing it</e... | Easy | 265.5K | 398.8K | 265,464 | 398,845 | 66.6% | ['faulty-keyboard'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string reverseOnlyLetters(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String reverseOnlyLetters(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | "ab-cd" | {
"name": "reverseOnlyLetters",
"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'] |
918 | Maximum Sum Circular Subarray | maximum-sum-circular-subarray | <p>Given a <strong>circular integer array</strong> <code>nums</code> of length <code>n</code>, return <em>the maximum possible sum of a non-empty <strong>subarray</strong> of </em><code>nums</code>.</p>
<p>A <strong>circular array</strong> means the end of the array connects to the beginning of the array. Formally, th... | Medium | 328K | 695.6K | 327,980 | 695,648 | 47.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSubarraySumCircular(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSubarraySumCircular(int[] nums) {\n \n }\n}"}, {"value": "python", "text... | [1,-2,3,-2] | {
"name": "maxSubarraySumCircular",
"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', 'Divide and Conquer', 'Dynamic Programming', 'Queue', 'Monotonic Queue'] |
919 | Complete Binary Tree Inserter | complete-binary-tree-inserter | <p>A <strong>complete binary tree</strong> is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.</p>
<p>Design an algorithm to insert a new node to a complete binary tree keeping it complete after the insertion.</p>
<p>Implement the <code>CBT... | Medium | 60.8K | 91.7K | 60,805 | 91,727 | 66.3% | [] | [] | 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... | ["CBTInserter","insert","insert","get_root"]
[[[1,2]],[3],[4],[]] | {
"classname": "CBTInserter",
"maxbytesperline": 200000,
"constructor": {
"params": [
{
"name": "root",
"type": "TreeNode"
}
]
},
"methods": [
{
"name": "insert",
"params": [
{
"name": "val",
"type": "integer"
}
],
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Breadth-First Search', 'Design', 'Binary Tree'] |
920 | Number of Music Playlists | number-of-music-playlists | <p>Your music player contains <code>n</code> different songs. You want to listen to <code>goal</code> songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that:</p>
<ul>
<li>Every song is played <strong>at least once</strong>.</li>
<li>A song can only be played again on... | Hard | 73.9K | 123.3K | 73,938 | 123,290 | 60.0% | ['count-the-number-of-good-subsequences'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numMusicPlaylists(int n, int goal, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numMusicPlaylists(int n, int goal, int k) {\n \n }\n}"}, {"value": "python"... | 3
3
1 | {
"name": "numMusicPlaylists",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "goal",
"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... | ['Math', 'Dynamic Programming', 'Combinatorics'] |
921 | Minimum Add to Make Parentheses Valid | minimum-add-to-make-parentheses-valid | <p>A parentheses string is valid if and only if:</p>
<ul>
<li>It is the empty string,</li>
<li>It can be written as <code>AB</code> (<code>A</code> concatenated with <code>B</code>), where <code>A</code> and <code>B</code> are valid strings, or</li>
<li>It can be written as <code>(A)</code>, where <code>A</code> is... | Medium | 594.8K | 796.4K | 594,765 | 796,381 | 74.7% | ['minimum-number-of-swaps-to-make-the-string-balanced'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minAddToMakeValid(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minAddToMakeValid(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "default... | "())" | {
"name": "minAddToMakeValid",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Stack', 'Greedy'] |
922 | Sort Array By Parity II | sort-array-by-parity-ii | <p>Given an array of integers <code>nums</code>, half of the integers in <code>nums</code> are <strong>odd</strong>, and the other half are <strong>even</strong>.</p>
<p>Sort the array so that whenever <code>nums[i]</code> is odd, <code>i</code> is <strong>odd</strong>, and whenever <code>nums[i]</code> is even, <code... | Easy | 291.7K | 411.1K | 291,686 | 411,083 | 71.0% | ['sort-array-by-parity', 'rearrange-array-elements-by-sign', 'sort-even-and-odd-indices-independently', 'largest-number-after-digit-swaps-by-parity', 'find-the-number-of-k-even-arrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> sortArrayByParityII(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] sortArrayByParityII(int[] nums) {\n \n }\n}"}, {"value": "python", "... | [4,2,5,7] | {
"name": "sortArrayByParityII",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Sorting'] |
923 | 3Sum With Multiplicity | 3sum-with-multiplicity | <p>Given an integer array <code>arr</code>, and an integer <code>target</code>, return the number of tuples <code>i, j, k</code> such that <code>i < j < k</code> and <code>arr[i] + arr[j] + arr[k] == target</code>.</p>
<p>As the answer can be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7... | Medium | 111.3K | 243.4K | 111,286 | 243,425 | 45.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int threeSumMulti(vector<int>& arr, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int threeSumMulti(int[] arr, int target) {\n \n }\n}"}, {"value": "python", "... | [1,1,2,2,3,3,4,4,5,5]
8 | {
"name": "threeSumMulti",
"params": [
{
"name": "arr",
"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', 'Hash Table', 'Two Pointers', 'Sorting', 'Counting'] |
924 | Minimize Malware Spread | minimize-malware-spread | <p>You are given a network of <code>n</code> nodes represented as an <code>n x n</code> adjacency matrix <code>graph</code>, where the <code>i<sup>th</sup></code> node is directly connected to the <code>j<sup>th</sup></code> node if <code>graph[i][j] == 1</code>.</p>
<p>Some nodes <code>initial</code> are initially in... | Hard | 62.4K | 147.9K | 62,449 | 147,881 | 42.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minMalwareSpread(vector<vector<int>>& graph, vector<int>& initial) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minMalwareSpread(int[][] graph, int[] initial) {\n \n... | [[1,1,0],[1,1,0],[0,0,1]]
[0,1] | {
"name": "minMalwareSpread",
"params": [
{
"name": "graph",
"type": "integer[][]"
},
{
"name": "initial",
"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', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Graph'] |
925 | Long Pressed Name | long-pressed-name | <p>Your friend is typing his <code>name</code> into a keyboard. Sometimes, when typing a character <code>c</code>, the key might get <em>long pressed</em>, and the character will be typed 1 or more times.</p>
<p>You examine the <code>typed</code> characters of the keyboard. Return <code>True</code> if it is possible t... | Easy | 165.5K | 510K | 165,473 | 510,041 | 32.4% | ['maximum-matching-of-players-with-trainers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isLongPressedName(string name, string typed) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isLongPressedName(String name, String typed) {\n \n }\n}"}, {"value... | "alex"
"aaleex" | {
"name": "isLongPressedName",
"params": [
{
"name": "name",
"type": "string"
},
{
"name": "typed",
"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'] |
926 | Flip String to Monotone Increasing | flip-string-to-monotone-increasing | <p>A binary string is monotone increasing if it consists of some number of <code>0</code>'s (possibly none), followed by some number of <code>1</code>'s (also possibly none).</p>
<p>You are given a binary string <code>s</code>. You can flip <code>s[i]</code> changing it from <code>0</code> to <code>1</code> or... | Medium | 203.7K | 330.8K | 203,655 | 330,816 | 61.6% | ['minimum-cost-to-make-all-characters-equal'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minFlipsMonoIncr(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minFlipsMonoIncr(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo... | "00110" | {
"name": "minFlipsMonoIncr",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
927 | Three Equal Parts | three-equal-parts | <p>You are given an array <code>arr</code> which consists of only zeros and ones, divide the array into <strong>three non-empty parts</strong> such that all of these parts represent the same binary value.</p>
<p>If it is possible, return any <code>[i, j]</code> with <code>i + 1 < j</code>, such that:</p>
<ul>
<li... | Hard | 32.7K | 80.6K | 32,730 | 80,627 | 40.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> threeEqualParts(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] threeEqualParts(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Py... | [1,0,1,0,1] | {
"name": "threeEqualParts",
"params": [
{
"name": "arr",
"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'] |
928 | Minimize Malware Spread II | minimize-malware-spread-ii | <p>You are given a network of <code>n</code> nodes represented as an <code>n x n</code> adjacency matrix <code>graph</code>, where the <code>i<sup>th</sup></code> node is directly connected to the <code>j<sup>th</sup></code> node if <code>graph[i][j] == 1</code>.</p>
<p>Some nodes <code>initial</code> are initially in... | Hard | 26.1K | 58.8K | 26,137 | 58,819 | 44.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minMalwareSpread(vector<vector<int>>& graph, vector<int>& initial) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minMalwareSpread(int[][] graph, int[] initial) {\n \n... | [[1,1,0],[1,1,0],[0,0,1]]
[0,1] | {
"name": "minMalwareSpread",
"params": [
{
"name": "graph",
"type": "integer[][]"
},
{
"name": "initial",
"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', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Graph'] |
929 | Unique Email Addresses | unique-email-addresses | <p>Every <strong>valid email</strong> consists of a <strong>local name</strong> and a <strong>domain name</strong>, separated by the <code>'@'</code> sign. Besides lowercase letters, the email may contain one or more <code>'.'</code> or <code>'+'</code>.</p>
<ul>
<li>For example, in <code>&quo... | Easy | 533.9K | 790.9K | 533,901 | 790,920 | 67.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numUniqueEmails(vector<string>& emails) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numUniqueEmails(String[] emails) {\n \n }\n}"}, {"value": "python", "text": "... | ["test.email+alex@leetcode.com","test.e.mail+bob.cathy@leetcode.com","testemail+david@lee.tcode.com"] | {
"name": "numUniqueEmails",
"params": [
{
"name": "emails",
"type": "string[]"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String'] |
930 | Binary Subarrays With Sum | binary-subarrays-with-sum | <p>Given a binary array <code>nums</code> and an integer <code>goal</code>, return <em>the number of non-empty <strong>subarrays</strong> with a sum</em> <code>goal</code>.</p>
<p>A <strong>subarray</strong> is a contiguous part of the array.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>... | Medium | 346.9K | 530.7K | 346,891 | 530,665 | 65.4% | ['count-subarrays-with-score-less-than-k', 'ways-to-split-array-into-good-subarrays', 'find-all-possible-stable-binary-arrays-i', 'find-all-possible-stable-binary-arrays-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numSubarraysWithSum(vector<int>& nums, int goal) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numSubarraysWithSum(int[] nums, int goal) {\n \n }\n}"}, {"value": "... | [1,0,1,0,1]
2 | {
"name": "numSubarraysWithSum",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "goal",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sliding Window', 'Prefix Sum'] |
931 | Minimum Falling Path Sum | minimum-falling-path-sum | <p>Given an <code>n x n</code> array of integers <code>matrix</code>, return <em>the <strong>minimum sum</strong> of any <strong>falling path</strong> through</em> <code>matrix</code>.</p>
<p>A <strong>falling path</strong> starts at any element in the first row and chooses the element in the next row that is either d... | Medium | 533.7K | 863.7K | 533,727 | 863,672 | 61.8% | ['minimum-falling-path-sum-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minFallingPathSum(vector<vector<int>>& matrix) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minFallingPathSum(int[][] matrix) {\n \n }\n}"}, {"value": "python", "... | [[2,1,3],[6,5,4],[7,8,9]] | {
"name": "minFallingPathSum",
"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', 'Matrix'] |
932 | Beautiful Array | beautiful-array | <p>An array <code>nums</code> of length <code>n</code> is <strong>beautiful</strong> if:</p>
<ul>
<li><code>nums</code> is a permutation of the integers in the range <code>[1, n]</code>.</li>
<li>For every <code>0 <= i < j < n</code>, there is no index <code>k</code> with <code>i < k < j</code> where ... | Medium | 49.6K | 74.2K | 49,599 | 74,232 | 66.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> beautifulArray(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] beautifulArray(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo... | 4 | {
"name": "beautifulArray",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Divide and Conquer'] |
933 | Number of Recent Calls | number-of-recent-calls | <p>You have a <code>RecentCounter</code> class which counts the number of recent requests within a certain time frame.</p>
<p>Implement the <code>RecentCounter</code> class:</p>
<ul>
<li><code>RecentCounter()</code> Initializes the counter with zero recent requests.</li>
<li><code>int ping(int t)</code> Adds a new ... | Easy | 386.5K | 500.1K | 386,529 | 500,075 | 77.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class RecentCounter {\npublic:\n RecentCounter() {\n \n }\n \n int ping(int t) {\n \n }\n};\n\n/**\n * Your RecentCounter object will be instantiated and called as such:\n * RecentCounter* obj = new RecentCounter();\n * int param_1 = obj->pin... | ["RecentCounter","ping","ping","ping","ping"]
[[],[1],[100],[3001],[3002]] | {
"classname": "RecentCounter",
"maxbytesperline": 200000,
"constructor": {
"params": [
]
},
"methods": [
{
"name" : "ping",
"params": [
{
"name": "t",
"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... | ['Design', 'Queue', 'Data Stream'] |
934 | Shortest Bridge | shortest-bridge | <p>You are given an <code>n x n</code> binary matrix <code>grid</code> where <code>1</code> represents land and <code>0</code> represents water.</p>
<p>An <strong>island</strong> is a 4-directionally connected group of <code>1</code>'s not connected to any other <code>1</code>'s. There are <strong>exactly two ... | Medium | 238.3K | 408K | 238,337 | 408,027 | 58.4% | ['minimum-number-of-operations-to-make-x-and-y-equal'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int shortestBridge(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int shortestBridge(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Py... | [[0,1],[1,0]] | {
"name": "shortestBridge",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Depth-First Search', 'Breadth-First Search', 'Matrix'] |
935 | Knight Dialer | knight-dialer | <p>The chess knight has a <strong>unique movement</strong>, it may move two squares vertically and one square horizontally, or two squares horizontally and one square vertically (with both forming the shape of an <strong>L</strong>). The possible movements of chess knight are shown in this diagram:</p>
<p>A chess... | Medium | 187.9K | 308K | 187,890 | 308,005 | 61.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int knightDialer(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int knightDialer(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So... | 1 | {
"name": "knightDialer",
"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'] |
936 | Stamping The Sequence | stamping-the-sequence | <p>You are given two strings <code>stamp</code> and <code>target</code>. Initially, there is a string <code>s</code> of length <code>target.length</code> with all <code>s[i] == '?'</code>.</p>
<p>In one turn, you can place <code>stamp</code> over <code>s</code> and replace every letter in the <code>s</code> wi... | Hard | 61.1K | 98.8K | 61,105 | 98,758 | 61.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> movesToStamp(string stamp, string target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] movesToStamp(String stamp, String target) {\n \n }\n}"}, {"value"... | "abc"
"ababc" | {
"name": "movesToStamp",
"params": [
{
"name": "stamp",
"type": "string"
},
{
"name": "target",
"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', 'Greedy', 'Queue'] |
937 | Reorder Data in Log Files | reorder-data-in-log-files | <p>You are given an array of <code>logs</code>. Each log is a space-delimited string of words, where the first word is the <strong>identifier</strong>.</p>
<p>There are two types of logs:</p>
<ul>
<li><b>Letter-logs</b>: All words (except the identifier) consist of lowercase English letters.</li>
<li><strong>Digit-... | Medium | 390.3K | 688.4K | 390,346 | 688,384 | 56.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> reorderLogFiles(vector<string>& logs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String[] reorderLogFiles(String[] logs) {\n \n }\n}"}, {"value": "python... | ["dig1 8 1 5 1","let1 art can","dig2 3 6","let2 own kit dig","let3 art zero"] | {
"name": "reorderLogFiles",
"params": [
{
"name": "logs",
"type": "string[]"
}
],
"return": {
"type": "string[]"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Sorting'] |
938 | Range Sum of BST | range-sum-of-bst | <p>Given the <code>root</code> node of a binary search tree and two integers <code>low</code> and <code>high</code>, return <em>the sum of values of all nodes with a value in the <strong>inclusive</strong> range </em><code>[low, high]</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img al... | Easy | 1.2M | 1.4M | 1,222,689 | 1,399,226 | 87.4% | [] | [] | 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... | [10,5,15,3,7,null,18]
7
15 | {
"name": "rangeSumBST",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"name": "low",
"type": "integer"
},
{
"name": "high",
"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... | ['Tree', 'Depth-First Search', 'Binary Search Tree', 'Binary Tree'] |
939 | Minimum Area Rectangle | minimum-area-rectangle | <p>You are given an array of points in the <strong>X-Y</strong> plane <code>points</code> where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>.</p>
<p>Return <em>the minimum area of a rectangle formed from these points, with sides parallel to the X and Y axes</em>. If there is not any such rectangle, return <... | Medium | 165K | 300.8K | 165,040 | 300,768 | 54.9% | ['minimum-rectangles-to-cover-points', 'maximum-area-rectangle-with-point-constraints-i', 'maximum-area-rectangle-with-point-constraints-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minAreaRect(vector<vector<int>>& points) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minAreaRect(int[][] points) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [[1,1],[1,3],[3,1],[3,3],[2,2]] | {
"name": "minAreaRect",
"params": [
{
"name": "points",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Math', 'Geometry', 'Sorting'] |
940 | Distinct Subsequences II | distinct-subsequences-ii | <p>Given a string s, return <em>the number of <strong>distinct non-empty subsequences</strong> of</em> <code>s</code>. Since the answer may be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
A <strong>subsequence</strong> of a string is a new string that is formed from the original st... | Hard | 45K | 103.7K | 45,029 | 103,659 | 43.4% | ['number-of-unique-good-subsequences', 'count-k-subsequences-of-a-string-with-maximum-beauty'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int distinctSubseqII(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int distinctSubseqII(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo... | "abc" | {
"name": "distinctSubseqII",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
941 | Valid Mountain Array | valid-mountain-array | <p>Given an array of integers <code>arr</code>, return <em><code>true</code> if and only if it is a valid mountain array</em>.</p>
<p>Recall that arr is a mountain array if and only if:</p>
<ul>
<li><code>arr.length >= 3</code></li>
<li>There exists some <code>i</code> with <code>0 < i < arr.length - 1</co... | Easy | 481.3K | 1.4M | 481,321 | 1,419,131 | 33.9% | ['minimum-number-of-removals-to-make-mountain-array', 'beautiful-towers-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool validMountainArray(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean validMountainArray(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "P... | [2,1] | {
"name": "validMountainArray",
"params": [
{
"name": "arr",
"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'] |
942 | DI String Match | di-string-match | <p>A permutation <code>perm</code> of <code>n + 1</code> integers of all the integers in the range <code>[0, n]</code> can be represented as a string <code>s</code> of length <code>n</code> where:</p>
<ul>
<li><code>s[i] == 'I'</code> if <code>perm[i] < perm[i + 1]</code>, and</li>
<li><code>s[i] == '... | Easy | 180.7K | 226.4K | 180,673 | 226,400 | 79.8% | ['construct-smallest-number-from-di-string'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> diStringMatch(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] diStringMatch(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau... | "IDID" | {
"name": "diStringMatch",
"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... | ['Array', 'Two Pointers', 'String', 'Greedy'] |
943 | Find the Shortest Superstring | find-the-shortest-superstring | <p>Given an array of strings <code>words</code>, return <em>the smallest string that contains each string in</em> <code>words</code> <em>as a substring</em>. If there are multiple valid strings of the smallest length, return <strong>any of them</strong>.</p>
<p>You may assume that no string in <code>words</code> is a ... | Hard | 31.8K | 71.9K | 31,757 | 71,926 | 44.2% | ['maximum-rows-covered-by-columns', 'find-the-minimum-cost-array-permutation'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string shortestSuperstring(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String shortestSuperstring(String[] words) {\n \n }\n}"}, {"value": "python... | ["alex","loves","leetcode"] | {
"name": "shortestSuperstring",
"params": [
{
"name": "words",
"type": "string[]"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Dynamic Programming', 'Bit Manipulation', 'Bitmask'] |
944 | Delete Columns to Make Sorted | delete-columns-to-make-sorted | <p>You are given an array of <code>n</code> strings <code>strs</code>, all of the same length.</p>
<p>The strings can be arranged such that there is one on each line, making a grid.</p>
<ul>
<li>For example, <code>strs = ["abc", "bce", "cae"]</code> can be arranged as follows:</li>
</ul... | Easy | 203.9K | 272.9K | 203,871 | 272,851 | 74.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minDeletionSize(vector<string>& strs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minDeletionSize(String[] strs) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | ["cba","daf","ghi"] | {
"name": "minDeletionSize",
"params": [
{
"name": "strs",
"type": "string[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String'] |
945 | Minimum Increment to Make Array Unique | minimum-increment-to-make-array-unique | <p>You are given an integer array <code>nums</code>. In one move, you can pick an index <code>i</code> where <code>0 <= i < nums.length</code> and increment <code>nums[i]</code> by <code>1</code>.</p>
<p>Return <em>the minimum number of moves to make every value in </em><code>nums</code><em> <strong>unique</stro... | Medium | 254.3K | 422K | 254,328 | 421,959 | 60.3% | ['minimum-operations-to-make-the-array-increasing', 'maximum-product-after-k-increments', 'minimum-number-of-operations-to-make-elements-in-array-distinct'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minIncrementForUnique(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minIncrementForUnique(int[] nums) {\n \n }\n}"}, {"value": "python", "text":... | [1,2,2] | {
"name": "minIncrementForUnique",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Sorting', 'Counting'] |
946 | Validate Stack Sequences | validate-stack-sequences | <p>Given two integer arrays <code>pushed</code> and <code>popped</code> each with distinct values, return <code>true</code><em> if this could have been the result of a sequence of push and pop operations on an initially empty stack, or </em><code>false</code><em> otherwise.</em></p>
<p> </p>
<p><strong class="exa... | Medium | 336.8K | 483.8K | 336,773 | 483,821 | 69.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool validateStackSequences(vector<int>& pushed, vector<int>& popped) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean validateStackSequences(int[] pushed, int[] popped) {\n ... | [1,2,3,4,5]
[4,5,3,2,1] | {
"name": "validateStackSequences",
"params": [
{
"name": "pushed",
"type": "integer[]"
},
{
"name": "popped",
"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', 'Stack', 'Simulation'] |
947 | Most Stones Removed with Same Row or Column | most-stones-removed-with-same-row-or-column | <p>On a 2D plane, we place <code>n</code> stones at some integer coordinate points. Each coordinate point may have at most one stone.</p>
<p>A stone can be removed if it shares either <strong>the same row or the same column</strong> as another stone that has not been removed.</p>
<p>Given an array <code>stones</code>... | Medium | 333.9K | 537.6K | 333,916 | 537,587 | 62.1% | ['minimum-moves-to-get-a-peaceful-board'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int removeStones(vector<vector<int>>& stones) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int removeStones(int[][] stones) {\n \n }\n}"}, {"value": "python", "text": "Py... | [[0,0],[0,1],[1,0],[1,2],[2,1],[2,2]] | {
"name": "removeStones",
"params": [
{
"name": "stones",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'Depth-First Search', 'Union Find', 'Graph'] |
948 | Bag of Tokens | bag-of-tokens | <p>You start with an initial <strong>power</strong> of <code>power</code>, an initial <strong>score</strong> of <code>0</code>, and a bag of tokens given as an integer array <code>tokens</code>, where each <code>tokens[i]</code> denotes the value of token<em><sub>i</sub></em>.</p>
<p>Your goal is to <strong>maxim... | Medium | 245K | 414.7K | 245,038 | 414,660 | 59.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int bagOfTokensScore(vector<int>& tokens, int power) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int bagOfTokensScore(int[] tokens, int power) {\n \n }\n}"}, {"value": "... | [100]
50 | {
"name": "bagOfTokensScore",
"params": [
{
"name": "tokens",
"type": "integer[]"
},
{
"name": "power",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Greedy', 'Sorting'] |
949 | Largest Time for Given Digits | largest-time-for-given-digits | <p>Given an array <code>arr</code> of 4 digits, find the latest 24-hour time that can be made using each digit <strong>exactly once</strong>.</p>
<p>24-hour times are formatted as <code>"HH:MM"</code>, where <code>HH</code> is between <code>00</code> and <code>23</code>, and <code>MM</code> is between <code>... | Medium | 95.5K | 269.3K | 95,511 | 269,285 | 35.5% | ['number-of-valid-clock-times'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string largestTimeFromDigits(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String largestTimeFromDigits(int[] arr) {\n \n }\n}"}, {"value": "python", "te... | [1,2,3,4] | {
"name": "largestTimeFromDigits",
"params": [
{
"name": "arr",
"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... | ['Array', 'String', 'Backtracking', 'Enumeration'] |
950 | Reveal Cards In Increasing Order | reveal-cards-in-increasing-order | <p>You are given an integer array <code>deck</code>. There is a deck of cards where every card has a unique integer. The integer on the <code>i<sup>th</sup></code> card is <code>deck[i]</code>.</p>
<p>You can order the deck in any order you want. Initially, all the cards start face down (unrevealed) in one deck.</p>
... | Medium | 213.7K | 256.9K | 213,652 | 256,862 | 83.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> deckRevealedIncreasing(vector<int>& deck) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] deckRevealedIncreasing(int[] deck) {\n \n }\n}"}, {"value": "pyth... | [17,13,11,2,3,5,7] | {
"name": "deckRevealedIncreasing",
"params": [
{
"name": "deck",
"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', 'Queue', 'Sorting', 'Simulation'] |
951 | Flip Equivalent Binary Trees | flip-equivalent-binary-trees | <p>For a binary tree <strong>T</strong>, we can define a <strong>flip operation</strong> as follows: choose any node, and swap the left and right child subtrees.</p>
<p>A binary tree <strong>X</strong> is <em>flip equivalent</em> to a binary tree <strong>Y</strong> if and only if we can make <strong>X</strong> eq... | Medium | 254K | 364.4K | 253,995 | 364,363 | 69.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,2,3,4,5,6,null,null,null,7,8]
[1,3,2,null,6,4,5,null,null,null,null,8,7] | {
"name": "flipEquiv",
"params": [
{
"name": "root1",
"type": "TreeNode"
},
{
"name": "root2",
"type": "TreeNode"
}
],
"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... | ['Tree', 'Depth-First Search', 'Binary Tree'] |
952 | Largest Component Size by Common Factor | largest-component-size-by-common-factor | <p>You are given an integer array of unique positive integers <code>nums</code>. Consider the following graph:</p>
<ul>
<li>There are <code>nums.length</code> nodes, labeled <code>nums[0]</code> to <code>nums[nums.length - 1]</code>,</li>
<li>There is an undirected edge between <code>nums[i]</code> and <code>nums[j]... | Hard | 58.5K | 142.5K | 58,462 | 142,531 | 41.0% | ['groups-of-strings', 'distinct-prime-factors-of-product-of-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largestComponentSize(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largestComponentSize(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "... | [4,6,15,35] | {
"name": "largestComponentSize",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Math', 'Union Find', 'Number Theory'] |
953 | Verifying an Alien Dictionary | verifying-an-alien-dictionary | <p>In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different <code>order</code>. The <code>order</code> of the alphabet is some permutation of lowercase letters.</p>
<p>Given a sequence of <code>words</code> written in the alien language, and the <code>order</code> of the... | Easy | 547.3K | 986.3K | 547,284 | 986,259 | 55.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isAlienSorted(vector<string>& words, string order) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isAlienSorted(String[] words, String order) {\n \n }\n}"}, {"... | ["hello","leetcode"]
"hlabcdefgijkmnopqrstuvwxyz" | {
"name": "isAlienSorted",
"params": [
{
"name": "words",
"type": "string[]"
},
{
"name": "order",
"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... | ['Array', 'Hash Table', 'String'] |
954 | Array of Doubled Pairs | array-of-doubled-pairs | <p>Given an integer array of even length <code>arr</code>, return <code>true</code><em> if it is possible to reorder </em><code>arr</code><em> such that </em><code>arr[2 * i + 1] = 2 * arr[2 * i]</code><em> for every </em><code>0 <= i < len(arr) / 2</code><em>, or </em><code>false</code><em> otherwise</em>.</p>
... | Medium | 95.9K | 243.9K | 95,919 | 243,858 | 39.3% | ['find-original-array-from-doubled-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canReorderDoubled(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canReorderDoubled(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Pyt... | [3,1,3,6] | {
"name": "canReorderDoubled",
"params": [
{
"name": "arr",
"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', 'Greedy', 'Sorting'] |
955 | Delete Columns to Make Sorted II | delete-columns-to-make-sorted-ii | <p>You are given an array of <code>n</code> strings <code>strs</code>, all of the same length.</p>
<p>We may choose any deletion indices, and we delete all the characters in those indices for each string.</p>
<p>For example, if we have <code>strs = ["abcdef","uvwxyz"]</code> and deletion indices <... | Medium | 22.2K | 62.7K | 22,247 | 62,695 | 35.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minDeletionSize(vector<string>& strs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minDeletionSize(String[] strs) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | ["ca","bb","ac"] | {
"name": "minDeletionSize",
"params": [
{
"name": "strs",
"type": "string[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Greedy'] |
956 | Tallest Billboard | tallest-billboard | <p>You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel support must be an equal height.</p>
<p>You are given a collection of <code>rods</code> that can be welded together. For example, if you have rods of lengths <code>1</code>... | Hard | 63.7K | 122.8K | 63,742 | 122,800 | 51.9% | ['partition-array-into-two-arrays-to-minimize-sum-difference'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int tallestBillboard(vector<int>& rods) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int tallestBillboard(int[] rods) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [1,2,3,6] | {
"name": "tallestBillboard",
"params": [
{
"name": "rods",
"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'] |
957 | Prison Cells After N Days | prison-cells-after-n-days | <p>There are <code>8</code> prison cells in a row and each cell is either occupied or vacant.</p>
<p>Each day, whether the cell is occupied or vacant changes according to the following rules:</p>
<ul>
<li>If a cell has two adjacent neighbors that are both occupied or both vacant, then the cell becomes occupied.</li>... | Medium | 168.3K | 432.1K | 168,260 | 432,069 | 38.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> prisonAfterNDays(vector<int>& cells, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] prisonAfterNDays(int[] cells, int n) {\n \n }\n}"}, {"value": "... | [0,1,0,1,1,0,0,1]
7 | {
"name": "prisonAfterNDays",
"params": [
{
"name": "cells",
"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', 'Hash Table', 'Math', 'Bit Manipulation'] |
958 | Check Completeness of a Binary Tree | check-completeness-of-a-binary-tree | <p>Given the <code>root</code> of a binary tree, determine if it is a <em>complete binary tree</em>.</p>
<p>In a <strong><a href="http://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees" target="_blank">complete binary tree</a></strong>, every level, except possibly the last, is completely filled, and all nodes... | Medium | 281.4K | 483.9K | 281,383 | 483,889 | 58.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,2,3,4,5,6] | {
"name": "isCompleteTree",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"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... | ['Tree', 'Breadth-First Search', 'Binary Tree'] |
959 | Regions Cut By Slashes | regions-cut-by-slashes | <p>An <code>n x n</code> grid is composed of <code>1 x 1</code> squares where each <code>1 x 1</code> square consists of a <code>'/'</code>, <code>'\'</code>, or blank space <code>' '</code>. These characters divide the square into contiguous regions.</p>
<p>Given the grid <code>grid</code> rep... | Medium | 142.9K | 184K | 142,905 | 184,048 | 77.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int regionsBySlashes(vector<string>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int regionsBySlashes(String[] grid) {\n \n }\n}"}, {"value": "python", "text": "Py... | [" /","/ "] | {
"name": "regionsBySlashes",
"params": [
{
"name": "grid",
"type": "string[]"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix'] |
960 | Delete Columns to Make Sorted III | delete-columns-to-make-sorted-iii | <p>You are given an array of <code>n</code> strings <code>strs</code>, all of the same length.</p>
<p>We may choose any deletion indices, and we delete all the characters in those indices for each string.</p>
<p>For example, if we have <code>strs = ["abcdef","uvwxyz"]</code> and deletion indices <... | Hard | 16.5K | 28.3K | 16,515 | 28,281 | 58.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minDeletionSize(vector<string>& strs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minDeletionSize(String[] strs) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | ["babca","bbazb"] | {
"name": "minDeletionSize",
"params": [
{
"name": "strs",
"type": "string[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Dynamic Programming'] |
961 | N-Repeated Element in Size 2N Array | n-repeated-element-in-size-2n-array | <p>You are given an integer array <code>nums</code> with the following properties:</p>
<ul>
<li><code>nums.length == 2 * n</code>.</li>
<li><code>nums</code> contains <code>n + 1</code> <strong>unique</strong> elements.</li>
<li>Exactly one element of <code>nums</code> is repeated <code>n</code> times.</li>
</ul>
... | Easy | 259.4K | 335.4K | 259,371 | 335,385 | 77.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int repeatedNTimes(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int repeatedNTimes(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [1,2,3,3] | {
"name": "repeatedNTimes",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table'] |
962 | Maximum Width Ramp | maximum-width-ramp | <p>A <strong>ramp</strong> in an integer array <code>nums</code> is a pair <code>(i, j)</code> for which <code>i < j</code> and <code>nums[i] <= nums[j]</code>. The <strong>width</strong> of such a ramp is <code>j - i</code>.</p>
<p>Given an integer array <code>nums</code>, return <em>the maximum width of a <str... | Medium | 189.7K | 341K | 189,713 | 340,986 | 55.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxWidthRamp(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxWidthRamp(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | [6,0,8,2,1,5] | {
"name": "maxWidthRamp",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Stack', 'Monotonic Stack'] |
963 | Minimum Area Rectangle II | minimum-area-rectangle-ii | <p>You are given an array of points in the <strong>X-Y</strong> plane <code>points</code> where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>.</p>
<p>Return <em>the minimum area of any rectangle formed from these points, with sides <strong>not necessarily parallel</strong> to the X and Y axes</em>. If there ... | Medium | 32.5K | 58.6K | 32,473 | 58,572 | 55.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double minAreaFreeRect(vector<vector<int>>& points) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double minAreaFreeRect(int[][] points) {\n \n }\n}"}, {"value": "python",... | [[1,2],[2,1],[1,0],[0,1]] | {
"name": "minAreaFreeRect",
"params": [
{
"name": "points",
"type": "integer[][]"
}
],
"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', 'Math', 'Geometry'] |
964 | Least Operators to Express Number | least-operators-to-express-number | <p>Given a single positive integer <code>x</code>, we will write an expression of the form <code>x (op1) x (op2) x (op3) x ...</code> where each operator <code>op1</code>, <code>op2</code>, etc. is either addition, subtraction, multiplication, or division (<code>+</code>, <code>-</code>, <code>*</code>, or <code>/)</co... | Hard | 11.3K | 23.4K | 11,311 | 23,352 | 48.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int leastOpsExpressTarget(int x, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int leastOpsExpressTarget(int x, int target) {\n \n }\n}"}, {"value": "python", ... | 3
19 | {
"name": "leastOpsExpressTarget",
"params": [
{
"name": "x",
"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... | ['Math', 'Dynamic Programming', 'Memoization'] |
965 | Univalued Binary Tree | univalued-binary-tree | <p>A binary tree is <strong>uni-valued</strong> if every node in the tree has the same value.</p>
<p>Given the <code>root</code> of a binary tree, return <code>true</code><em> if the given tree is <strong>uni-valued</strong>, or </em><code>false</code><em> otherwise.</em></p>
<p> </p>
<p><strong class="example">... | Easy | 245.2K | 341K | 245,204 | 341,017 | 71.9% | ['find-all-the-lonely-nodes'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,1,1,1,1,null,1] | {
"name": "isUnivalTree",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"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... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
966 | Vowel Spellchecker | vowel-spellchecker | <p>Given a <code>wordlist</code>, we want to implement a spellchecker that converts a query word into a correct word.</p>
<p>For a given <code>query</code> word, the spell checker handles two categories of spelling mistakes:</p>
<ul>
<li>Capitalization: If the query matches a word in the wordlist (<strong>case-insen... | Medium | 45.1K | 87.7K | 45,143 | 87,667 | 51.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> spellchecker(vector<string>& wordlist, vector<string>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String[] spellchecker(String[] wordlist, String[] querie... | ["KiTe","kite","hare","Hare"]
["kite","Kite","KiTe","Hare","HARE","Hear","hear","keti","keet","keto"] | {
"name": "spellchecker",
"params": [
{
"name": "wordlist",
"type": "string[]"
},
{
"name": "queries",
"type": "string[]"
}
],
"return": {
"type": "string[]"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String'] |
967 | Numbers With Same Consecutive Differences | numbers-with-same-consecutive-differences | <p>Given two integers n and k, return <em>an array of all the integers of length </em><code>n</code><em> where the difference between every two consecutive digits is </em><code>k</code>. You may return the answer in <strong>any order</strong>.</p>
<p>Note that the integers should not have leading zeros. Integers as <c... | Medium | 144.2K | 246K | 144,215 | 246,049 | 58.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> numsSameConsecDiff(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] numsSameConsecDiff(int n, int k) {\n \n }\n}"}, {"value": "python", "text"... | 3
7 | {
"name": "numsSameConsecDiff",
"params": [
{
"name": "n",
"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... | ['Backtracking', 'Breadth-First Search'] |
968 | Binary Tree Cameras | binary-tree-cameras | <p>You are given the <code>root</code> of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate children.</p>
<p>Return <em>the minimum number of cameras needed to monitor all nodes of the tree</em>.</p>
<p> </p>
<p><strong class="exampl... | Hard | 158.6K | 337.3K | 158,622 | 337,277 | 47.0% | ['distribute-coins-in-binary-tree', 'choose-edges-to-maximize-score-in-a-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [0,0,null,0,0] | {
"name": "minCameraCover",
"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'] |
969 | Pancake Sorting | pancake-sorting | <p>Given an array of integers <code>arr</code>, sort the array by performing a series of <strong>pancake flips</strong>.</p>
<p>In one pancake flip we do the following steps:</p>
<ul>
<li>Choose an integer <code>k</code> where <code>1 <= k <= arr.length</code>.</li>
<li>Reverse the sub-array <code>arr[0...k-1... | Medium | 104.1K | 146.5K | 104,092 | 146,494 | 71.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> pancakeSort(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> pancakeSort(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Py... | [3,2,4,1] | {
"name": "pancakeSort",
"params": [
{
"name": "arr",
"type": "integer[]"
}
],
"return": {
"type": "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', 'Two Pointers', 'Greedy', 'Sorting'] |
970 | Powerful Integers | powerful-integers | <p>Given three integers <code>x</code>, <code>y</code>, and <code>bound</code>, return <em>a list of all the <strong>powerful integers</strong> that have a value less than or equal to</em> <code>bound</code>.</p>
<p>An integer is <strong>powerful</strong> if it can be represented as <code>x<sup>i</sup> + y<sup>j</sup>... | Medium | 59.5K | 135.3K | 59,514 | 135,340 | 44.0% | ['count-the-number-of-powerful-integers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> powerfulIntegers(int x, int y, int bound) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> powerfulIntegers(int x, int y, int bound) {\n \n }\n}"}, ... | 2
3
10 | {
"name": "powerfulIntegers",
"params": [
{
"name": "x",
"type": "integer"
},
{
"name": "y",
"type": "integer"
},
{
"name": "bound",
"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... | ['Hash Table', 'Math', 'Enumeration'] |
971 | Flip Binary Tree To Match Preorder Traversal | flip-binary-tree-to-match-preorder-traversal | <p>You are given the <code>root</code> of a binary tree with <code>n</code> nodes, where each node is uniquely assigned a value from <code>1</code> to <code>n</code>. You are also given a sequence of <code>n</code> values <code>voyage</code>, which is the <strong>desired</strong> <a href="https://en.wikipedia.org/wiki/... | Medium | 45.3K | 89K | 45,320 | 88,980 | 50.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,2]
[2,1] | {
"name": "flipMatchVoyage",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"name": "voyage",
"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... | ['Tree', 'Depth-First Search', 'Binary Tree'] |
972 | Equal Rational Numbers | equal-rational-numbers | <p>Given two strings <code>s</code> and <code>t</code>, each of which represents a non-negative rational number, return <code>true</code> if and only if they represent the same number. The strings may use parentheses to denote the repeating part of the rational number.</p>
<p>A <strong>rational number</strong> can be ... | Hard | 8.6K | 19.3K | 8,588 | 19,312 | 44.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isRationalEqual(string s, string t) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isRationalEqual(String s, String t) {\n \n }\n}"}, {"value": "python", "text... | "0.(52)"
"0.5(25)" | {
"name": "isRationalEqual",
"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... | ['Math', 'String'] |
973 | K Closest Points to Origin | k-closest-points-to-origin | <p>Given an array of <code>points</code> where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> represents a point on the <strong>X-Y</strong> plane and an integer <code>k</code>, return the <code>k</code> closest points to the origin <code>(0, 0)</code>.</p>
<p>The distance between two points on the <strong>X-... | Medium | 1.5M | 2.2M | 1,466,229 | 2,166,102 | 67.7% | ['kth-largest-element-in-an-array', 'top-k-frequent-elements', 'top-k-frequent-words', 'find-nearest-point-that-has-the-same-x-or-y-coordinate', 'minimum-rectangles-to-cover-points', 'k-th-nearest-obstacle-queries'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> kClosest(vector<vector<int>>& points, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] kClosest(int[][] points, int k) {\n \n }\n}"}, {"val... | [[1,3],[-2,2]]
1 | {
"name": "kClosest",
"params": [
{
"name": "points",
"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', 'Math', 'Divide and Conquer', 'Geometry', 'Sorting', 'Heap (Priority Queue)', 'Quickselect'] |
974 | Subarray Sums Divisible by K | subarray-sums-divisible-by-k | <p>Given an integer array <code>nums</code> and an integer <code>k</code>, return <em>the number of non-empty <strong>subarrays</strong> that have a sum divisible by </em><code>k</code>.</p>
<p>A <strong>subarray</strong> is a <strong>contiguous</strong> part of an array.</p>
<p> </p>
<p><strong class="example">... | Medium | 395.9K | 712.6K | 395,914 | 712,607 | 55.6% | ['subarray-sum-equals-k', 'make-sum-divisible-by-p', 'count-number-of-bad-pairs', 'find-the-divisibility-array-of-a-string', 'count-of-interesting-subarrays', 'maximum-subarray-sum-with-length-divisible-by-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int subarraysDivByK(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int subarraysDivByK(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text... | [4,5,0,-2,-3,1]
5 | {
"name": "subarraysDivByK",
"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'] |
975 | Odd Even Jump | odd-even-jump | <p>You are given an integer array <code>arr</code>. From some starting index, you can make a series of jumps. The (1<sup>st</sup>, 3<sup>rd</sup>, 5<sup>th</sup>, ...) jumps in the series are called <strong>odd-numbered jumps</strong>, and the (2<sup>nd</sup>, 4<sup>th</sup>, 6<sup>th</sup>, ...) jumps in the series ar... | Hard | 95.6K | 235.4K | 95,612 | 235,372 | 40.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int oddEvenJumps(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int oddEvenJumps(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | [10,13,12,14,15] | {
"name": "oddEvenJumps",
"params": [
{
"name": "arr",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Stack', 'Monotonic Stack', 'Ordered Set'] |
976 | Largest Perimeter Triangle | largest-perimeter-triangle | <p>Given an integer array <code>nums</code>, return <em>the largest perimeter of a triangle with a non-zero area, formed from three of these lengths</em>. If it is impossible to form any triangle of a non-zero area, return <code>0</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<str... | Easy | 269.8K | 472.2K | 269,816 | 472,241 | 57.1% | ['largest-triangle-area'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largestPerimeter(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largestPerimeter(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [2,1,2] | {
"name": "largestPerimeter",
"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', 'Greedy', 'Sorting'] |
977 | Squares of a Sorted Array | squares-of-a-sorted-array | <p>Given an integer array <code>nums</code> sorted in <strong>non-decreasing</strong> order, return <em>an array of <strong>the squares of each number</strong> sorted in non-decreasing order</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [-4,-1,0,3,10]
... | Easy | 2.2M | 3M | 2,169,553 | 2,966,444 | 73.1% | ['merge-sorted-array', 'sort-transformed-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> sortedSquares(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] sortedSquares(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [-4,-1,0,3,10] | {
"name": "sortedSquares",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Sorting'] |
978 | Longest Turbulent Subarray | longest-turbulent-subarray | <p>Given an integer array <code>arr</code>, return <em>the length of a maximum size turbulent subarray of</em> <code>arr</code>.</p>
<p>A subarray is <strong>turbulent</strong> if the comparison sign flips between each adjacent pair of elements in the subarray.</p>
<p>More formally, a subarray <code>[arr[i], arr[i + ... | Medium | 117.6K | 245.7K | 117,573 | 245,696 | 47.9% | ['maximum-subarray', 'longest-alternating-subarray'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxTurbulenceSize(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxTurbulenceSize(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [9,4,2,10,7,8,8,1,9] | {
"name": "maxTurbulenceSize",
"params": [
{
"name": "arr",
"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', 'Sliding Window'] |
979 | Distribute Coins in Binary Tree | distribute-coins-in-binary-tree | <p>You are given the <code>root</code> of a binary tree with <code>n</code> nodes where each <code>node</code> in the tree has <code>node.val</code> coins. There are <code>n</code> coins in total throughout the whole tree.</p>
<p>In one move, we may choose two adjacent nodes and move one coin from one node to another.... | Medium | 209.4K | 271.6K | 209,439 | 271,593 | 77.1% | ['sum-of-distances-in-tree', 'binary-tree-cameras'] | [] | 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,0,0] | {
"name": "distributeCoins",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Binary Tree'] |
980 | Unique Paths III | unique-paths-iii | <p>You are given an <code>m x n</code> integer array <code>grid</code> where <code>grid[i][j]</code> could be:</p>
<ul>
<li><code>1</code> representing the starting square. There is exactly one starting square.</li>
<li><code>2</code> representing the ending square. There is exactly one ending square.</li>
<li><cod... | Hard | 225.7K | 274.5K | 225,749 | 274,489 | 82.2% | ['sudoku-solver', 'unique-paths-ii', 'word-search-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int uniquePathsIII(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int uniquePathsIII(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Py... | [[1,0,0,0],[0,0,0,0],[0,0,2,-1]] | {
"name": "uniquePathsIII",
"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', 'Backtracking', 'Bit Manipulation', 'Matrix'] |
981 | Time Based Key-Value Store | time-based-key-value-store | <p>Design a time-based key-value data structure that can store multiple values for the same key at different time stamps and retrieve the key's value at a certain timestamp.</p>
<p>Implement the <code>TimeMap</code> class:</p>
<ul>
<li><code>TimeMap()</code> Initializes the object of the data structure.</li>
<l... | Medium | 567.3K | 1.1M | 567,278 | 1,148,399 | 49.4% | ['stock-price-fluctuation'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class TimeMap {\npublic:\n TimeMap() {\n \n }\n \n void set(string key, string value, int timestamp) {\n \n }\n \n string get(string key, int timestamp) {\n \n }\n};\n\n/**\n * Your TimeMap object will be instantiated and call... | ["TimeMap","set","get","get","set","get","get"]
[[],["foo","bar",1],["foo",1],["foo",3],["foo","bar2",4],["foo",4],["foo",5]] | {
"classname": "TimeMap",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "string",
"name": "key"
},
{
"type": "string",
"name": "value"
},
{
"type": "integer",
"name": "timest... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Binary Search', 'Design'] |
982 | Triples with Bitwise AND Equal To Zero | triples-with-bitwise-and-equal-to-zero | <p>Given an integer array nums, return <em>the number of <strong>AND triples</strong></em>.</p>
<p>An <strong>AND triple</strong> is a triple of indices <code>(i, j, k)</code> such that:</p>
<ul>
<li><code>0 <= i < nums.length</code></li>
<li><code>0 <= j < nums.length</code></li>
<li><code>0 <= k &... | Hard | 21.4K | 36.2K | 21,377 | 36,158 | 59.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countTriplets(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countTriplets(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa... | [2,1,3] | {
"name": "countTriplets",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Bit Manipulation'] |
983 | Minimum Cost For Tickets | minimum-cost-for-tickets | <p>You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array <code>days</code>. Each day is an integer from <code>1</code> to <code>365</code>.</p>
<p>Train tickets are sold in <strong>three different ways</strong>:</p>
<ul>
<li>a <strong>1... | Medium | 424.3K | 629.5K | 424,276 | 629,483 | 67.4% | ['coin-change', 'most-expensive-item-that-can-not-be-bought'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int mincostTickets(vector<int>& days, vector<int>& costs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int mincostTickets(int[] days, int[] costs) {\n \n }\n}"}, {"value"... | [1,4,6,7,8,20]
[2,7,15] | {
"name": "mincostTickets",
"params": [
{
"name": "days",
"type": "integer[]"
},
{
"name": "costs",
"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'] |
984 | String Without AAA or BBB | string-without-aaa-or-bbb | <p>Given two integers <code>a</code> and <code>b</code>, return <strong>any</strong> string <code>s</code> such that:</p>
<ul>
<li><code>s</code> has length <code>a + b</code> and contains exactly <code>a</code> <code>'a'</code> letters, and exactly <code>b</code> <code>'b'</code> letters,</li>
<li>T... | Medium | 54.1K | 122K | 54,132 | 121,960 | 44.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string strWithout3a3b(int a, int b) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String strWithout3a3b(int a, int b) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | 1
2 | {
"name": "strWithout3a3b",
"params": [
{
"name": "a",
"type": "integer"
},
{
"name": "b",
"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... | ['String', 'Greedy'] |
985 | Sum of Even Numbers After Queries | sum-of-even-numbers-after-queries | <p>You are given an integer array <code>nums</code> and an array <code>queries</code> where <code>queries[i] = [val<sub>i</sub>, index<sub>i</sub>]</code>.</p>
<p>For each query <code>i</code>, first, apply <code>nums[index<sub>i</sub>] = nums[index<sub>i</sub>] + val<sub>i</sub></code>, then print the sum of the even... | Medium | 146.9K | 214.7K | 146,926 | 214,716 | 68.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> sumEvenAfterQueries(vector<int>& nums, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] sumEvenAfterQueries(int[] nums, int[][] queries)... | [1,2,3,4]
[[1,0],[-3,1],[-4,0],[2,3]] | {
"name": "sumEvenAfterQueries",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "queries",
"type": "integer[][]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Simulation'] |
986 | Interval List Intersections | interval-list-intersections | <p>You are given two lists of closed intervals, <code>firstList</code> and <code>secondList</code>, where <code>firstList[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> and <code>secondList[j] = [start<sub>j</sub>, end<sub>j</sub>]</code>. Each list of intervals is pairwise <strong>disjoint</strong> and in <strong>so... | Medium | 498.8K | 687.6K | 498,753 | 687,629 | 72.5% | ['merge-intervals', 'merge-sorted-array', 'employee-free-time', 'maximum-matching-of-players-with-trainers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> intervalIntersection(vector<vector<int>>& firstList, vector<vector<int>>& secondList) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] intervalIntersection(... | [[0,2],[5,10],[13,23],[24,25]]
[[1,5],[8,12],[15,24],[25,26]] | {
"name": "intervalIntersection",
"params": [
{
"name": "firstList",
"type": "integer[][]"
},
{
"name": "secondList",
"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', 'Line Sweep'] |
987 | Vertical Order Traversal of a Binary Tree | vertical-order-traversal-of-a-binary-tree | <p>Given the <code>root</code> of a binary tree, calculate the <strong>vertical order traversal</strong> of the binary tree.</p>
<p>For each node at position <code>(row, col)</code>, its left and right children will be at positions <code>(row + 1, col - 1)</code> and <code>(row + 1, col + 1)</code> respectively. The r... | Hard | 565.1K | 1.1M | 565,117 | 1,114,601 | 50.7% | [] | [] | 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,9,20,null,null,15,7] | {
"name": "verticalTraversal",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"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... | ['Hash Table', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Sorting', 'Binary Tree'] |
988 | Smallest String Starting From Leaf | smallest-string-starting-from-leaf | <p>You are given the <code>root</code> of a binary tree where each node has a value in the range <code>[0, 25]</code> representing the letters <code>'a'</code> to <code>'z'</code>.</p>
<p>Return <em>the <strong>lexicographically smallest</strong> string that starts at a leaf of this tree and ends at th... | Medium | 204.7K | 337.2K | 204,719 | 337,183 | 60.7% | ['sum-root-to-leaf-numbers', 'binary-tree-paths'] | [] | 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... | [0,1,2,3,4,3,4] | {
"name": "smallestFromLeaf",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"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', 'Backtracking', 'Tree', 'Depth-First Search', 'Binary Tree'] |
989 | Add to Array-Form of Integer | add-to-array-form-of-integer | <p>The <strong>array-form</strong> of an integer <code>num</code> is an array representing its digits in left to right order.</p>
<ul>
<li>For example, for <code>num = 1321</code>, the array form is <code>[1,3,2,1]</code>.</li>
</ul>
<p>Given <code>num</code>, the <strong>array-form</strong> of an integer, and an in... | Easy | 295.5K | 656.6K | 295,457 | 656,584 | 45.0% | ['add-two-numbers', 'plus-one', 'add-binary', 'add-strings'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> addToArrayForm(vector<int>& num, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> addToArrayForm(int[] num, int k) {\n \n }\n}"}, {"value": "... | [1,2,0,0]
34 | {
"name": "addToArrayForm",
"params": [
{
"name": "num",
"type": "integer[]"
},
{
"name": "k",
"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'] |
990 | Satisfiability of Equality Equations | satisfiability-of-equality-equations | <p>You are given an array of strings <code>equations</code> that represent relationships between variables where each string <code>equations[i]</code> is of length <code>4</code> and takes one of two different forms: <code>"x<sub>i</sub>==y<sub>i</sub>"</code> or <code>"x<sub>i</sub>!=y<sub>i</sub>"... | Medium | 144.6K | 284K | 144,601 | 284,037 | 50.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool equationsPossible(vector<string>& equations) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean equationsPossible(String[] equations) {\n \n }\n}"}, {"value": "pyt... | ["a==b","b!=a"] | {
"name": "equationsPossible",
"params": [
{
"name": "equations",
"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... | ['Array', 'String', 'Union Find', 'Graph'] |
991 | Broken Calculator | broken-calculator | <p>There is a broken calculator that has the integer <code>startValue</code> on its display initially. In one operation, you can:</p>
<ul>
<li>multiply the number on display by <code>2</code>, or</li>
<li>subtract <code>1</code> from the number on display.</li>
</ul>
<p>Given two integers <code>startValue</code> an... | Medium | 109.6K | 199.2K | 109,597 | 199,235 | 55.0% | ['2-keys-keyboard', 'minimum-operations-to-make-the-integer-zero'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int brokenCalc(int startValue, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int brokenCalc(int startValue, int target) {\n \n }\n}"}, {"value": "python", "tex... | 2
3 | {
"name": "brokenCalc",
"params": [
{
"name": "startValue",
"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... | ['Math', 'Greedy'] |
992 | Subarrays with K Different Integers | subarrays-with-k-different-integers | <p>Given an integer array <code>nums</code> and an integer <code>k</code>, return <em>the number of <strong>good subarrays</strong> of </em><code>nums</code>.</p>
<p>A <strong>good array</strong> is an array where the number of different integers in that array is exactly <code>k</code>.</p>
<ul>
<li>For example, <co... | Hard | 280.7K | 429.5K | 280,693 | 429,485 | 65.4% | ['longest-substring-without-repeating-characters', 'longest-substring-with-at-most-two-distinct-characters', 'longest-substring-with-at-most-k-distinct-characters', 'count-vowel-substrings-of-a-string', 'number-of-unique-flavors-after-sharing-k-candies', 'k-divisible-elements-subarrays', 'count-complete-subarrays-in-an... | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int subarraysWithKDistinct(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int subarraysWithKDistinct(int[] nums, int k) {\n \n }\n}"}, {"value": "... | [1,2,1,2,3]
2 | {
"name": "subarraysWithKDistinct",
"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', 'Sliding Window', 'Counting'] |
993 | Cousins in Binary Tree | cousins-in-binary-tree | <p>Given the <code>root</code> of a binary tree with unique values and the values of two different nodes of the tree <code>x</code> and <code>y</code>, return <code>true</code> <em>if the nodes corresponding to the values </em><code>x</code><em> and </em><code>y</code><em> in the tree are <strong>cousins</strong>, or <... | Easy | 315.3K | 544.8K | 315,293 | 544,847 | 57.9% | ['binary-tree-level-order-traversal', 'cousins-in-binary-tree-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... | [1,2,3,4]
4
3 | {
"name": "isCousins",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"name": "x",
"type": "integer"
},
{
"name": "y",
"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... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
994 | Rotting Oranges | rotting-oranges | <p>You are given an <code>m x n</code> <code>grid</code> where each cell can have one of three values:</p>
<ul>
<li><code>0</code> representing an empty cell,</li>
<li><code>1</code> representing a fresh orange, or</li>
<li><code>2</code> representing a rotten orange.</li>
</ul>
<p>Every minute, any fresh orange t... | Medium | 1.2M | 2.1M | 1,184,995 | 2,109,089 | 56.2% | ['walls-and-gates', 'battleships-in-a-board', 'detonate-the-maximum-bombs', 'escape-the-spreading-fire'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int orangesRotting(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int orangesRotting(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Py... | [[2,1,1],[1,1,0],[0,1,1]] | {
"name": "orangesRotting",
"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'] |
995 | Minimum Number of K Consecutive Bit Flips | minimum-number-of-k-consecutive-bit-flips | <p>You are given a binary array <code>nums</code> and an integer <code>k</code>.</p>
<p>A <strong>k-bit flip</strong> is choosing a <strong>subarray</strong> of length <code>k</code> from <code>nums</code> and simultaneously changing every <code>0</code> in the subarray to <code>1</code>, and every <code>1</code> in t... | Hard | 132.5K | 213.3K | 132,528 | 213,273 | 62.1% | ['bulb-switcher', 'minimum-time-to-remove-all-cars-containing-illegal-goods', 'number-of-distinct-binary-strings-after-applying-operations', 'minimum-operations-to-make-binary-array-elements-equal-to-one-i', 'smallest-number-with-all-set-bits'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minKBitFlips(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minKBitFlips(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Py... | [0,1,0]
1 | {
"name": "minKBitFlips",
"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', 'Bit Manipulation', 'Queue', 'Sliding Window', 'Prefix Sum'] |
996 | Number of Squareful Arrays | number-of-squareful-arrays | <p>An array is <strong>squareful</strong> if the sum of every pair of adjacent elements is a <strong>perfect square</strong>.</p>
<p>Given an integer array nums, return <em>the number of permutations of </em><code>nums</code><em> that are <strong>squareful</strong></em>.</p>
<p>Two permutations <code>perm1</code> and... | Hard | 44.1K | 87.4K | 44,062 | 87,427 | 50.4% | ['permutations-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numSquarefulPerms(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numSquarefulPerms(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python... | [1,17,8] | {
"name": "numSquarefulPerms",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Math', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Bitmask'] |
997 | Find the Town Judge | find-the-town-judge | <p>In a town, there are <code>n</code> people labeled from <code>1</code> to <code>n</code>. There is a rumor that one of these people is secretly the town judge.</p>
<p>If the town judge exists, then:</p>
<ol>
<li>The town judge trusts nobody.</li>
<li>Everybody (except for the town judge) trusts the town judge.</... | Easy | 657.9K | 1.3M | 657,935 | 1,318,243 | 49.9% | ['find-the-celebrity'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findJudge(int n, vector<vector<int>>& trust) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findJudge(int n, int[][] trust) {\n \n }\n}"}, {"value": "python", "text... | 2
[[1,2]] | {
"name": "findJudge",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "trust",
"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', 'Graph'] |
998 | Maximum Binary Tree II | maximum-binary-tree-ii | <p>A <strong>maximum tree</strong> is a tree where every node has a value greater than any other value in its subtree.</p>
<p>You are given the <code>root</code> of a maximum binary tree and an integer <code>val</code>.</p>
<p>Just as in the <a href="https://leetcode.com/problems/maximum-binary-tree/" target="_blank"... | Medium | 40.7K | 59K | 40,676 | 59,005 | 68.9% | ['maximum-binary-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [4,1,3,null,null,2]
5 | {
"name": "insertIntoMaxTree",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"name": "val",
"type": "integer"
}
],
"return": {
"type": "TreeNode"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Binary Tree'] |
999 | Available Captures for Rook | available-captures-for-rook | <p>You are given an <code>8 x 8</code> <strong>matrix</strong> representing a chessboard. There is <strong>exactly one</strong> white rook represented by <code>'R'</code>, some number of white bishops <code>'B'</code>, and some number of black pawns <code>'p'</code>. Empty squares are represente... | Easy | 76.3K | 108.7K | 76,269 | 108,743 | 70.1% | ['count-unguarded-cells-in-the-grid', 'minimum-moves-to-capture-the-queen', 'maximum-value-sum-by-placing-three-rooks-ii', 'maximum-value-sum-by-placing-three-rooks-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numRookCaptures(vector<vector<char>>& board) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numRookCaptures(char[][] board) {\n \n }\n}"}, {"value": "python", "text... | [[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".","R",".",".",".","p"],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."],[".",".",".","p",".",".",".","."],[".",".",".",".",".",".",".","."],[".",".",".",".",".",".",".","."]] | {
"name": "numRookCaptures",
"params": [
{
"name": "board",
"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', 'Matrix', 'Simulation'] |
1,000 | Minimum Cost to Merge Stones | minimum-cost-to-merge-stones | <p>There are <code>n</code> piles of <code>stones</code> arranged in a row. The <code>i<sup>th</sup></code> pile has <code>stones[i]</code> stones.</p>
<p>A move consists of merging exactly <code>k</code> <strong>consecutive</strong> piles into one pile, and the cost of this move is equal to the total number of stones... | Hard | 44.7K | 101.3K | 44,663 | 101,281 | 44.1% | ['burst-balloons', 'minimum-cost-to-connect-sticks'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int mergeStones(vector<int>& stones, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int mergeStones(int[] stones, int k) {\n \n }\n}"}, {"value": "python", "text": "... | [3,2,4,1]
2 | {
"name": "mergeStones",
"params": [
{
"name": "stones",
"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', 'Dynamic Programming', 'Prefix Sum'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.