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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,510 | Minimum Pair Removal to Sort Array II | minimum-pair-removal-to-sort-array-ii | <p>Given an array <code>nums</code>, you can perform the following operation any number of times:</p>
<ul>
<li>Select the <strong>adjacent</strong> pair with the <strong>minimum</strong> sum in <code>nums</code>. If multiple such pairs exist, choose the leftmost one.</li>
<li>Replace the pair with their sum.</li>
</... | Hard | 2K | 16.7K | 1,984 | 16,715 | 11.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumPairRemoval(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumPairRemoval(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [5,2,3,1] | {
"name": "minimumPairRemoval",
"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', 'Linked List', 'Heap (Priority Queue)', 'Simulation', 'Doubly-Linked List', 'Ordered Set'] |
3,511 | Make a Positive Array | make-a-positive-array | null | Medium | 207 | 539 | 207 | 539 | 38.4% | [] | [] | Algorithms | null | [-10,15,-12] | {
"name": "makeArrayPositive",
"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', 'Prefix Sum'] |
1,684 | Count the Number of Consistent Strings | count-the-number-of-consistent-strings | <p>You are given a string <code>allowed</code> consisting of <strong>distinct</strong> characters and an array of strings <code>words</code>. A string is <strong>consistent </strong>if all characters in the string appear in the string <code>allowed</code>.</p>
<p>Return<em> the number of <strong>consistent</strong> st... | Easy | 389.3K | 441.2K | 389,301 | 441,226 | 88.2% | ['count-pairs-of-similar-strings'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countConsistentStrings(string allowed, vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countConsistentStrings(String allowed, String[] words) {\n ... | "ab"
["ad","bd","aaab","baa","badab"] | {
"name": "countConsistentStrings",
"params": [
{
"name": "allowed",
"type": "string"
},
{
"type": "string[]",
"name": "words"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Bit Manipulation', 'Counting'] |
1,982 | Find Array Given Subset Sums | find-array-given-subset-sums | <p>You are given an integer <code>n</code> representing the length of an unknown array that you are trying to recover. You are also given an array <code>sums</code> containing the values of all <code>2<sup>n</sup></code> <strong>subset sums</strong> of the unknown array (in no particular order).</p>
<p>Return <em>the ... | Hard | 6.6K | 13.6K | 6,586 | 13,572 | 48.5% | ['subsets', 'subsets-ii', 'recover-the-original-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> recoverArray(int n, vector<int>& sums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] recoverArray(int n, int[] sums) {\n \n }\n}"}, {"value": "python", "... | 3
[-3,-2,-1,0,0,1,2,3] | {
"name": "recoverArray",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[]",
"name": "sums"
}
],
"return": {
"type": "integer[]"
},
"manual": false
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Divide and Conquer'] |
2,269 | Find the K-Beauty of a Number | find-the-k-beauty-of-a-number | <p>The <strong>k-beauty</strong> of an integer <code>num</code> is defined as the number of <strong>substrings</strong> of <code>num</code> when it is read as a string that meet the following conditions:</p>
<ul>
<li>It has a length of <code>k</code>.</li>
<li>It is a divisor of <code>num</code>.</li>
</ul>
<p>Give... | Easy | 73.5K | 119.8K | 73,494 | 119,804 | 61.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int divisorSubstrings(int num, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int divisorSubstrings(int num, int k) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | 240
2 | {
"name": "divisorSubstrings",
"params": [
{
"name": "num",
"type": "integer"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'String', 'Sliding Window'] |
2,270 | Number of Ways to Split Array | number-of-ways-to-split-array | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> of length <code>n</code>.</p>
<p><code>nums</code> contains a <strong>valid split</strong> at index <code>i</code> if the following are true:</p>
<ul>
<li>The sum of the first <code>i + 1</code> elements is <strong>greater than or equal to... | Medium | 212.2K | 378.3K | 212,195 | 378,285 | 56.1% | ['split-array-largest-sum', 'find-pivot-index', 'ways-to-split-array-into-three-subarrays', 'find-the-middle-index-in-array', 'partition-array-into-two-arrays-to-minimize-sum-difference', 'minimum-average-difference'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int waysToSplitArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int waysToSplitArray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [10,4,-8,7] | {
"name": "waysToSplitArray",
"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', 'Prefix Sum'] |
2,273 | Find Resultant Array After Removing Anagrams | find-resultant-array-after-removing-anagrams | <p>You are given a <strong>0-indexed</strong> string array <code>words</code>, where <code>words[i]</code> consists of lowercase English letters.</p>
<p>In one operation, select any index <code>i</code> such that <code>0 < i < words.length</code> and <code>words[i - 1]</code> and <code>words[i]</code> are <stron... | Easy | 74.5K | 125.9K | 74,544 | 125,885 | 59.2% | ['group-anagrams', 'valid-anagram'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> removeAnagrams(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> removeAnagrams(String[] words) {\n \n }\n}"}, {"value": "py... | ["abba","baba","bbaa","cd","cd"] | {
"name": "removeAnagrams",
"params": [
{
"name": "words",
"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', 'Sorting'] |
2,275 | Largest Combination With Bitwise AND Greater Than Zero | largest-combination-with-bitwise-and-greater-than-zero | <p>The <strong>bitwise AND</strong> of an array <code>nums</code> is the bitwise AND of all integers in <code>nums</code>.</p>
<ul>
<li>For example, for <code>nums = [1, 5, 3]</code>, the bitwise AND is equal to <code>1 & 5 & 3 = 1</code>.</li>
<li>Also, for <code>nums = [7]</code>, the bitwise AND is <code>... | Medium | 149.7K | 185K | 149,733 | 185,042 | 80.9% | ['count-number-of-maximum-bitwise-or-subsets'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largestCombination(vector<int>& candidates) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largestCombination(int[] candidates) {\n \n }\n}"}, {"value": "python", "... | [16,17,71,62,12,24,14] | {
"name": "largestCombination",
"params": [
{
"name": "candidates",
"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', 'Counting'] |
2,276 | Count Integers in Intervals | count-integers-in-intervals | <p>Given an <strong>empty</strong> set of intervals, implement a data structure that can:</p>
<ul>
<li><strong>Add</strong> an interval to the set of intervals.</li>
<li><strong>Count</strong> the number of integers that are present in <strong>at least one</strong> interval.</li>
</ul>
<p>Implement the <code>CountI... | Hard | 22.6K | 62.8K | 22,645 | 62,831 | 36.0% | ['merge-intervals', 'insert-interval', 'data-stream-as-disjoint-intervals', 'my-calendar-iii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class CountIntervals {\npublic:\n CountIntervals() {\n \n }\n \n void add(int left, int right) {\n \n }\n \n int count() {\n \n }\n};\n\n/**\n * Your CountIntervals object will be instantiated and called as such:\n * CountInte... | ["CountIntervals","add","add","count","add","count"]
[[],[2,3],[7,10],[],[5,8],[]] | {
"classname": "CountIntervals",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "left"
},
{
"type": "integer",
"name": "right"
}
],
"name": "add",
"return": {
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Design', 'Segment Tree', 'Ordered Set'] |
2,488 | Count Subarrays With Median K | count-subarrays-with-median-k | <p>You are given an array <code>nums</code> of size <code>n</code> consisting of <strong>distinct </strong>integers from <code>1</code> to <code>n</code> and a positive integer <code>k</code>.</p>
<p>Return <em>the number of non-empty subarrays in </em><code>nums</code><em> that have a <strong>median</strong> equal to... | Hard | 14.8K | 32.9K | 14,778 | 32,857 | 45.0% | ['number-of-subarrays-with-bounded-maximum', 'number-of-sub-arrays-of-size-k-and-average-greater-than-or-equal-to-threshold', 'sum-of-imbalance-numbers-of-all-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSubarrays(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSubarrays(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text":... | [3,2,1,4,5]
4 | {
"name": "countSubarrays",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Prefix Sum'] |
2,653 | Sliding Subarray Beauty | sliding-subarray-beauty | <p>Given an integer array <code>nums</code> containing <code>n</code> integers, find the <strong>beauty</strong> of each subarray of size <code>k</code>.</p>
<p>The <strong>beauty</strong> of a subarray is the <code>x<sup>th</sup></code><strong> smallest integer </strong>in the subarray if it is <strong>negative</stro... | Medium | 25.8K | 76.8K | 25,770 | 76,807 | 33.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getSubarrayBeauty(vector<int>& nums, int k, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getSubarrayBeauty(int[] nums, int k, int x) {\n \n }\n}"... | [1,-1,-3,-2,3]
3
2 | {
"name": "getSubarrayBeauty",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
},
{
"type": "integer",
"name": "x"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sliding Window'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.