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
401
Binary Watch
binary-watch
<p>A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent&nbsp;the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.</p> <ul> <li>For example, the below binary watch reads <code>&quot;4:51&quot;</code>.</li> </ul> <p><im...
Easy
162.9K
289.9K
162,855
289,933
56.2%
['letter-combinations-of-a-phone-number', 'number-of-1-bits']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> readBinaryWatch(int turnedOn) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> readBinaryWatch(int turnedOn) {\n \n }\n}"}, {"value": "python", "t...
1
{ "name": "readBinaryWatch", "params": [ { "name": "turnedOn", "type": "integer" } ], "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...
['Backtracking', 'Bit Manipulation']
402
Remove K Digits
remove-k-digits
<p>Given string num representing a non-negative integer <code>num</code>, and an integer <code>k</code>, return <em>the smallest possible integer after removing</em> <code>k</code> <em>digits from</em> <code>num</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong>...
Medium
577K
1.7M
576,998
1,668,038
34.6%
['create-maximum-number', 'monotone-increasing-digits', 'find-the-most-competitive-subsequence', 'append-k-integers-with-minimal-sum', 'remove-digit-from-number-to-maximize-result', 'minimum-operations-to-make-a-special-number']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string removeKdigits(string num, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String removeKdigits(String num, int k) {\n \n }\n}"}, {"value": "python", "text": "P...
"1432219" 3
{ "name": "removeKdigits", "params": [ { "name": "num", "type": "string" }, { "name": "k", "type": "integer" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Stack', 'Greedy', 'Monotonic Stack']
403
Frog Jump
frog-jump
<p>A frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.</p> <p>Given a list of <code>stones</code>&nbsp;positions (in units) in sorted <strong>ascending order</strong>, determ...
Hard
294.2K
633.5K
294,209
633,486
46.4%
['minimum-sideway-jumps', 'solving-questions-with-brainpower', 'maximum-number-of-jumps-to-reach-the-last-index']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canCross(vector<int>& stones) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canCross(int[] stones) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau...
[0,1,3,5,6,8,12,17]
{ "name": "canCross", "params": [ { "name": "stones", "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', 'Dynamic Programming']
404
Sum of Left Leaves
sum-of-left-leaves
<p>Given the <code>root</code> of a binary tree, return <em>the sum of all left leaves.</em></p> <p>A <strong>leaf</strong> is a node with no children. A <strong>left leaf</strong> is a leaf that is the left child of another node.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" src="h...
Easy
694.9K
1.1M
694,861
1,130,877
61.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...
[3,9,20,null,null,15,7]
{ "name": "sumOfLeftLeaves", "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', 'Breadth-First Search', 'Binary Tree']
405
Convert a Number to Hexadecimal
convert-a-number-to-hexadecimal
<p>Given a 32-bit integer <code>num</code>, return <em>a string representing its hexadecimal representation</em>. For negative integers, <a href="https://en.wikipedia.org/wiki/Two%27s_complement" target="_blank">two&rsquo;s complement</a> method is used.</p> <p>All the letters in the answer string should be lowercase ...
Easy
172.9K
342.4K
172,927
342,409
50.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string toHex(int num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String toHex(int num) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Soluti...
26
{ "name": "toHex", "params": [ { "name": "num", "type": "integer" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Bit Manipulation']
406
Queue Reconstruction by Height
queue-reconstruction-by-height
<p>You are given an array of people, <code>people</code>, which are the attributes of some people in a queue (not necessarily in order). Each <code>people[i] = [h<sub>i</sub>, k<sub>i</sub>]</code> represents the <code>i<sup>th</sup></code> person of height <code>h<sub>i</sub></code> with <strong>exactly</strong> <code...
Medium
321.5K
434.2K
321,549
434,218
74.1%
['count-of-smaller-numbers-after-self', 'reward-top-k-students']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> reconstructQueue(vector<vector<int>>& people) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] reconstructQueue(int[][] people) {\n \n }\n}"}, {"v...
[[7,0],[4,4],[7,1],[5,0],[6,1],[5,2]]
{ "name": "reconstructQueue", "params": [ { "name": "people", "type": "integer[][]" } ], "return": { "type": "integer[][]", "colsize": "2" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Indexed Tree', 'Segment Tree', 'Sorting']
407
Trapping Rain Water II
trapping-rain-water-ii
<p>Given an <code>m x n</code> integer matrix <code>heightMap</code> representing the height of each unit cell in a 2D elevation map, return <em>the volume of water it can trap after raining</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" src="https://assets.leetcode.com/uploads/...
Hard
177.1K
301.5K
177,118
301,523
58.7%
['trapping-rain-water', 'maximum-number-of-points-from-grid-queries']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int trapRainWater(vector<vector<int>>& heightMap) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int trapRainWater(int[][] heightMap) {\n \n }\n}"}, {"value": "python", "te...
[[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]]
{ "name": "trapRainWater", "params": [ { "name": "heightMap", "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', 'Heap (Priority Queue)', 'Matrix']
408
Valid Word Abbreviation
valid-word-abbreviation
null
Easy
295.7K
805.5K
295,725
805,536
36.7%
['minimum-unique-word-abbreviation', 'word-abbreviation', 'check-if-an-original-string-exists-given-two-encoded-strings']
[]
Algorithms
null
"internationalization" "i12iz4n"
{ "name": "validWordAbbreviation", "params": [ { "name": "word", "type": "string" }, { "name": "abbr", "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']
409
Longest Palindrome
longest-palindrome
<p>Given a string <code>s</code> which consists of lowercase or uppercase letters, return the length of the <strong>longest <span data-keyword="palindrome-string">palindrome</span></strong>&nbsp;that can be built with those letters.</p> <p>Letters are <strong>case sensitive</strong>, for example, <code>&quot;Aa&quot;<...
Easy
902K
1.6M
902,024
1,625,707
55.5%
['palindrome-permutation', 'longest-palindrome-by-concatenating-two-letter-words', 'largest-palindromic-number']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestPalindrome(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestPalindrome(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "default...
"abccccdd"
{ "name": "longestPalindrome", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Greedy']
410
Split Array Largest Sum
split-array-largest-sum
<p>Given an integer array <code>nums</code> and an integer <code>k</code>, split <code>nums</code> into <code>k</code> non-empty subarrays such that the largest sum of any subarray is <strong>minimized</strong>.</p> <p>Return <em>the minimized largest sum of the split</em>.</p> <p>A <strong>subarray</strong> is a con...
Hard
456.3K
792K
456,316
792,006
57.6%
['capacity-to-ship-packages-within-d-days', 'divide-chocolate', 'fair-distribution-of-cookies', 'subsequence-of-size-k-with-the-largest-even-sum', 'maximum-total-beauty-of-the-gardens', 'number-of-ways-to-split-array', 'minimum-cost-to-split-an-array', 'distribute-elements-into-two-arrays-i', 'distribute-elements-into-...
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int splitArray(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int splitArray(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Python...
[7,2,5,10,8] 2
{ "name": "splitArray", "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', 'Binary Search', 'Dynamic Programming', 'Greedy', 'Prefix Sum']
411
Minimum Unique Word Abbreviation
minimum-unique-word-abbreviation
null
Hard
15.2K
38K
15,237
37,990
40.1%
['generalized-abbreviation', 'valid-word-abbreviation', 'word-abbreviation']
[]
Algorithms
null
"apple" ["blade"]
{ "name": "minAbbreviation", "params": [ { "name": "target", "type": "string" }, { "name": "dictionary", "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', 'Backtracking', 'Bit Manipulation']
412
Fizz Buzz
fizz-buzz
<p>Given an integer <code>n</code>, return <em>a string array </em><code>answer</code><em> (<strong>1-indexed</strong>) where</em>:</p> <ul> <li><code>answer[i] == &quot;FizzBuzz&quot;</code> if <code>i</code> is divisible by <code>3</code> and <code>5</code>.</li> <li><code>answer[i] == &quot;Fizz&quot;</code> if <...
Easy
1.5M
2M
1,474,815
1,990,629
74.1%
['fizz-buzz-multithreaded', 'categorize-box-according-to-criteria']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> fizzBuzz(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> fizzBuzz(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode...
3
{ "name": "fizzBuzz", "params": [ { "name": "n", "type": "integer" } ], "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...
['Math', 'String', 'Simulation']
413
Arithmetic Slices
arithmetic-slices
<p>An integer array is called arithmetic if it consists of <strong>at least three elements</strong> and if the difference between any two consecutive elements is the same.</p> <ul> <li>For example, <code>[1,3,5,7,9]</code>, <code>[7,7,7,7]</code>, and <code>[3,-1,-5,-9]</code> are arithmetic sequences.</li> </ul> <p...
Medium
330.4K
509.6K
330,424
509,604
64.8%
['arithmetic-slices-ii-subsequence', 'arithmetic-subarrays', 'number-of-zero-filled-subarrays', 'length-of-the-longest-alphabetical-continuous-substring']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfArithmeticSlices(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfArithmeticSlices(int[] nums) {\n \n }\n}"}, {"value": "python", "...
[1,2,3,4]
{ "name": "numberOfArithmeticSlices", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Sliding Window']
414
Third Maximum Number
third-maximum-number
<p>Given an integer array <code>nums</code>, return <em>the <strong>third distinct maximum</strong> number in this array. If the third maximum does not exist, return the <strong>maximum</strong> number</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> nums = [3,2...
Easy
661.1K
1.8M
661,133
1,794,759
36.8%
['kth-largest-element-in-an-array', 'neither-minimum-nor-maximum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int thirdMax(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int thirdMax(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ...
[3,2,1]
{ "name": "thirdMax", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting']
415
Add Strings
add-strings
<p>Given two non-negative integers, <code>num1</code> and <code>num2</code> represented as string, return <em>the sum of</em> <code>num1</code> <em>and</em> <code>num2</code> <em>as a string</em>.</p> <p>You must solve the problem without using any built-in library for handling large integers (such as <code>BigInteger...
Easy
794.5K
1.5M
794,470
1,534,022
51.8%
['add-two-numbers', 'multiply-strings', 'add-to-array-form-of-integer']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string addStrings(string num1, string num2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String addStrings(String num1, String num2) {\n \n }\n}"}, {"value": "python", "t...
"11" "123"
{ "name": "addStrings", "params": [ { "name": "num1", "type": "string" }, { "name": "num2", "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...
['Math', 'String', 'Simulation']
416
Partition Equal Subset Sum
partition-equal-subset-sum
<p>Given an integer array <code>nums</code>, return <code>true</code> <em>if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or </em><code>false</code><em> otherwise</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:<...
Medium
1.2M
2.4M
1,178,597
2,445,904
48.2%
['partition-to-k-equal-sum-subsets', 'minimize-the-difference-between-target-and-chosen-elements', 'maximum-number-of-ways-to-partition-an-array', 'partition-array-into-two-arrays-to-minimize-sum-difference', 'find-subarrays-with-equal-sum', 'number-of-great-partitions', 'split-with-minimum-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canPartition(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canPartition(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
[1,5,11,5]
{ "name": "canPartition", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
417
Pacific Atlantic Water Flow
pacific-atlantic-water-flow
<p>There is an <code>m x n</code> rectangular island that borders both the <strong>Pacific Ocean</strong> and <strong>Atlantic Ocean</strong>. The <strong>Pacific Ocean</strong> touches the island&#39;s left and top edges, and the <strong>Atlantic Ocean</strong> touches the island&#39;s right and bottom edges.</p> <p>...
Medium
580.1K
1M
580,118
1,015,716
57.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> pacificAtlantic(vector<vector<int>>& heights) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> pacificAtlantic(int[][] heights) {\n \n ...
[[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]]
{ "name": "pacificAtlantic", "params": [ { "name": "heights", "type": "integer[][]" } ], "return": { "type": "list<list<integer>>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Depth-First Search', 'Breadth-First Search', 'Matrix']
418
Sentence Screen Fitting
sentence-screen-fitting
null
Medium
104.7K
288.4K
104,745
288,401
36.3%
['minimum-cost-to-separate-sentence-into-rows', 'split-message-based-on-limit']
[]
Algorithms
null
["hello","world"] 2 8
{ "name": "wordsTyping", "params": [ { "name": "sentence", "type": "string[]" }, { "name": "rows", "type": "integer" }, { "name": "cols", "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', 'String', 'Dynamic Programming']
419
Battleships in a Board
battleships-in-a-board
<p>Given an <code>m x n</code> matrix <code>board</code> where each cell is a battleship <code>&#39;X&#39;</code> or empty <code>&#39;.&#39;</code>, return <em>the number of the <strong>battleships</strong> on</em> <code>board</code>.</p> <p><strong>Battleships</strong> can only be placed horizontally or vertically on...
Medium
238.8K
312.9K
238,849
312,866
76.3%
['number-of-islands', 'walls-and-gates', 'max-area-of-island', 'rotting-oranges']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countBattleships(vector<vector<char>>& board) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countBattleships(char[][] board) {\n \n }\n}"}, {"value": "python", "te...
[["X",".",".","X"],[".",".",".","X"],[".",".",".","X"]]
{ "name": "countBattleships", "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', 'Depth-First Search', 'Matrix']
420
Strong Password Checker
strong-password-checker
<p>A password is considered strong if the below conditions are all met:</p> <ul> <li>It has at least <code>6</code> characters and at most <code>20</code> characters.</li> <li>It contains at least <strong>one lowercase</strong> letter, at least <strong>one uppercase</strong> letter, and at least <strong>one digit</s...
Hard
47.7K
329.7K
47,676
329,651
14.5%
['strong-password-checker-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int strongPasswordChecker(string password) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int strongPasswordChecker(String password) {\n \n }\n}"}, {"value": "python", "tex...
"a"
{ "name": "strongPasswordChecker", "params": [ { "name": "password", "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', 'Greedy', 'Heap (Priority Queue)']
421
Maximum XOR of Two Numbers in an Array
maximum-xor-of-two-numbers-in-an-array
<p>Given an integer array <code>nums</code>, return <em>the maximum result of </em><code>nums[i] XOR nums[j]</code>, where <code>0 &lt;= i &lt;= j &lt; n</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> nums = [3,10,5,25,2,8] <strong>Output:</strong> 28 <stron...
Medium
186.8K
351.1K
186,769
351,126
53.2%
['maximum-xor-with-an-element-from-array', 'maximum-xor-after-operations', 'sum-of-prefix-scores-of-strings', 'minimize-xor', 'maximum-strong-pair-xor-i', 'maximum-strong-pair-xor-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMaximumXOR(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMaximumXOR(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
[3,10,5,25,2,8]
{ "name": "findMaximumXOR", "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', 'Trie']
422
Valid Word Square
valid-word-square
null
Easy
64.2K
153.1K
64,158
153,091
41.9%
['word-squares', 'toeplitz-matrix']
[]
Algorithms
null
["abcd","bnrt","crmy","dtye"]
{ "name": "validWordSquare", "params": [ { "name": "words", "type": "list<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', 'Matrix']
423
Reconstruct Original Digits from English
reconstruct-original-digits-from-english
<p>Given a string <code>s</code> containing an out-of-order English representation of digits <code>0-9</code>, return <em>the digits in <strong>ascending</strong> order</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre><strong>Input:</strong> s = "owoztneoer" <strong>Output:</strong> "012...
Medium
87.6K
170.1K
87,638
170,114
51.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string originalDigits(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String originalDigits(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "default...
"owoztneoer"
{ "name": "originalDigits", "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...
['Hash Table', 'Math', 'String']
424
Longest Repeating Character Replacement
longest-repeating-character-replacement
<p>You are given a string <code>s</code> and an integer <code>k</code>. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most <code>k</code> times.</p> <p>Return <em>the length of the longest substring containing the same letter you ca...
Medium
1.1M
1.9M
1,059,353
1,868,684
56.7%
['longest-substring-with-at-most-k-distinct-characters', 'max-consecutive-ones-iii', 'minimum-number-of-operations-to-make-array-continuous', 'maximize-the-confusion-of-an-exam', 'longest-substring-of-one-repeating-character']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int characterReplacement(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int characterReplacement(String s, int k) {\n \n }\n}"}, {"value": "python", "text"...
"ABAB" 2
{ "name": "characterReplacement", "params": [ { "name": "s", "type": "string" }, { "name": "k", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Sliding Window']
425
Word Squares
word-squares
null
Hard
78.1K
145.1K
78,138
145,112
53.8%
['valid-word-square']
[]
Algorithms
null
["area","lead","wall","lady","ball"]
{ "name": "wordSquares", "params": [ { "name": "words", "type": "string[]" } ], "return": { "type": "list<list<string>>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'Backtracking', 'Trie']
426
Convert Binary Search Tree to Sorted Doubly Linked List
convert-binary-search-tree-to-sorted-doubly-linked-list
null
Medium
348.1K
532.2K
348,099
532,172
65.4%
['binary-tree-inorder-traversal']
[]
Algorithms
null
[4,2,5,1,3]
{ "name": "treeToDoublyList", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "ListNode" }, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3", "kotlin", "ruby", "scala", "c", "golang", "...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List', 'Stack', 'Tree', 'Depth-First Search', 'Binary Search Tree', 'Binary Tree', 'Doubly-Linked List']
427
Construct Quad Tree
construct-quad-tree
<p>Given a <code>n * n</code> matrix <code>grid</code> of <code>0&#39;s</code> and <code>1&#39;s</code> only. We want to represent <code>grid</code> with a Quad-Tree.</p> <p>Return <em>the root of the Quad-Tree representing </em><code>grid</code>.</p> <p>A Quad-Tree is a tree data structure in which each internal nod...
Medium
158.3K
206.1K
158,298
206,140
76.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/*\n// Definition for a QuadTree node.\nclass Node {\npublic:\n bool val;\n bool isLeaf;\n Node* topLeft;\n Node* topRight;\n Node* bottomLeft;\n Node* bottomRight;\n \n Node() {\n val = false;\n isLeaf = false;\n topLeft = NU...
[[0,1],[1,0]]
{ "name": "construct", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "list<list<integer>>" }, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3", "kotlin", "ruby", "scala", "swift", "gol...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Tree', 'Matrix']
428
Serialize and Deserialize N-ary Tree
serialize-and-deserialize-n-ary-tree
null
Hard
94.6K
138.9K
94,611
138,852
68.1%
['serialize-and-deserialize-binary-tree', 'serialize-and-deserialize-bst', 'encode-n-ary-tree-to-binary-tree']
[]
Algorithms
null
[1,null,2,3,4,5,null,null,6,7,null,8,null,9,10,null,null,11,null,12,null,13,null,null,14]
{ "name": "CodecDriver", "params": [ { "name": "root", "type": "integer" } ], "return": { "type": "integer" }, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3", "golang", "kotlin", "ruby", "scala", "php", "swift...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Tree', 'Depth-First Search', 'Breadth-First Search']
429
N-ary Tree Level Order Traversal
n-ary-tree-level-order-traversal
<p>Given an n-ary tree, return the <em>level order</em> traversal of its nodes&#39; values.</p> <p><em>Nary-Tree input serialization is represented in their level order traversal, each group of children is separated by the null value (See examples).</em></p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong...
Medium
335.2K
470.9K
335,227
470,895
71.2%
['binary-tree-level-order-traversal', 'n-ary-tree-preorder-traversal', 'n-ary-tree-postorder-traversal', 'the-time-when-the-network-becomes-idle']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/*\n// Definition for a Node.\nclass Node {\npublic:\n int val;\n vector<Node*> children;\n\n Node() {}\n\n Node(int _val) {\n val = _val;\n }\n\n Node(int _val, vector<Node*> _children) {\n val = _val;\n children = _children;\n ...
[1,null,3,2,4,null,5,6]
{ "name": "levelOrder", "params": [ { "name": "root", "type": "integer" } ], "return": { "type": "list<list<integer>>" }, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3", "golang", "ruby", "c", "kotlin", "scala", ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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']
430
Flatten a Multilevel Doubly Linked List
flatten-a-multilevel-doubly-linked-list
<p>You are given a doubly linked list, which contains nodes that have a next pointer, a previous pointer, and an additional <strong>child pointer</strong>. This child pointer may or may not point to a separate doubly linked list, also containing these special nodes. These child lists may have one or more children of th...
Medium
368.4K
603.3K
368,442
603,305
61.1%
['flatten-binary-tree-to-linked-list', 'correct-a-binary-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/*\n// Definition for a Node.\nclass Node {\npublic:\n int val;\n Node* prev;\n Node* next;\n Node* child;\n};\n*/\n\nclass Solution {\npublic:\n Node* flatten(Node* head) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "/*\n// D...
[1,2,3,4,5,6,null,null,null,7,8,9,10,null,null,11,12]
{ "name": "flatten", "params": [ { "name": "head", "type": "ListNode" } ], "return": { "type": "ListNode" }, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3", "kotlin", "ruby", "scala", "golang", "swift", "php",...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List', 'Depth-First Search', 'Doubly-Linked List']
431
Encode N-ary Tree to Binary Tree
encode-n-ary-tree-to-binary-tree
null
Hard
23.4K
29.2K
23,398
29,224
80.1%
['serialize-and-deserialize-n-ary-tree']
[]
Algorithms
null
[1,null,3,2,4,null,5,6]
{ "name": "CodecDriver", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "TreeNode" }, "languages": [ "cpp", "java", "python", "csharp", "python3", "javascript", "golang", "kotlin", "ruby", "scala", "php", "swi...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Design', 'Binary Tree']
432
All O`one Data Structure
all-oone-data-structure
<p>Design a data structure to store the strings&#39; count with the ability to return the strings with minimum and maximum counts.</p> <p>Implement the <code>AllOne</code> class:</p> <ul> <li><code>AllOne()</code> Initializes the object of the data structure.</li> <li><code>inc(String key)</code> Increments the cou...
Hard
174.5K
389.9K
174,494
389,927
44.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class AllOne {\npublic:\n AllOne() {\n \n }\n \n void inc(string key) {\n \n }\n \n void dec(string key) {\n \n }\n \n string getMaxKey() {\n \n }\n \n string getMinKey() {\n \n }\n};\n\n/**\n *...
["AllOne","inc","inc","getMaxKey","getMinKey","inc","getMaxKey","getMinKey"] [[],["hello"],["hello"],[],[],["leet"],[],[]]
{ "classname": "AllOne", "constructor": { "params": [] }, "methods": [ { "params": [ { "type": "string", "name": "key" } ], "return": { "type": "void" }, "name": "inc" }, { "params": [ { "type": "st...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Linked List', 'Design', 'Doubly-Linked List']
433
Minimum Genetic Mutation
minimum-genetic-mutation
<p>A gene string can be represented by an 8-character long string, with choices from <code>&#39;A&#39;</code>, <code>&#39;C&#39;</code>, <code>&#39;G&#39;</code>, and <code>&#39;T&#39;</code>.</p> <p>Suppose we need to investigate a mutation from a gene string <code>startGene</code> to a gene string <code>endGene</cod...
Medium
221.1K
400.7K
221,122
400,664
55.2%
['word-ladder']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minMutation(string startGene, string endGene, vector<string>& bank) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minMutation(String startGene, String endGene, String[] bank...
"AACCGGTT" "AACCGGTA" ["AACCGGTA"]
{ "name": "minMutation", "params": [ { "name": "startGene", "type": "string" }, { "name": "endGene", "type": "string" }, { "name": "bank", "type": "string[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Breadth-First Search']
434
Number of Segments in a String
number-of-segments-in-a-string
<p>Given a string <code>s</code>, return <em>the number of segments in the string</em>.</p> <p>A <strong>segment</strong> is defined to be a contiguous sequence of <strong>non-space characters</strong>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> s = &quot;Hello...
Easy
221K
608.7K
220,997
608,675
36.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSegments(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSegments(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
"Hello, my name is John"
{ "name": "countSegments", "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']
435
Non-overlapping Intervals
non-overlapping-intervals
<p>Given an array of intervals <code>intervals</code> where <code>intervals[i] = [start<sub>i</sub>, end<sub>i</sub>]</code>, return <em>the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping</em>.</p> <p><strong>Note</strong> that intervals which only touch at a point are...
Medium
754.9K
1.4M
754,916
1,369,073
55.1%
['minimum-number-of-arrows-to-burst-balloons', 'determine-if-two-events-have-conflict']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int eraseOverlapIntervals(vector<vector<int>>& intervals) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int eraseOverlapIntervals(int[][] intervals) {\n \n }\n}"}, {"value...
[[1,2],[2,3],[3,4],[1,3]]
{ "name": "eraseOverlapIntervals", "params": [ { "name": "intervals", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Greedy', 'Sorting']
436
Find Right Interval
find-right-interval
<p>You are given an array of <code>intervals</code>, where <code>intervals[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> and each <code>start<sub>i</sub></code> is <strong>unique</strong>.</p> <p>The <strong>right interval</strong> for an interval <code>i</code> is an interval <code>j</code> such that <code>start<s...
Medium
133.4K
249.2K
133,388
249,226
53.5%
['data-stream-as-disjoint-intervals']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findRightInterval(vector<vector<int>>& intervals) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findRightInterval(int[][] intervals) {\n \n }\n}"}, {"val...
[[1,2]]
{ "name": "findRightInterval", "params": [ { "name": "intervals", "type": "integer[][]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Sorting']
437
Path Sum III
path-sum-iii
<p>Given the <code>root</code> of a binary tree and an integer <code>targetSum</code>, return <em>the number of paths where the sum of the values&nbsp;along the path equals</em>&nbsp;<code>targetSum</code>.</p> <p>The path does not need to start or end at the root or a leaf, but it must go downwards (i.e., traveling o...
Medium
677.6K
1.5M
677,590
1,471,530
46.0%
['path-sum', 'path-sum-ii', 'path-sum-iv', 'longest-univalue-path']
[]
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,-3,3,2,null,11,3,-2,null,1] 8
{ "name": "pathSum", "params": [ { "name": "root", "type": "TreeNode" }, { "name": "targetSum", "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 Tree']
438
Find All Anagrams in a String
find-all-anagrams-in-a-string
<p>Given two strings <code>s</code> and <code>p</code>, return an array of all the start indices of <code>p</code>&#39;s <span data-keyword="anagram">anagrams</span> in <code>s</code>. You may return the answer in <strong>any order</strong>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <...
Medium
997.4K
1.9M
997,404
1,919,661
52.0%
['valid-anagram', 'permutation-in-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findAnagrams(string s, string p) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> findAnagrams(String s, String p) {\n \n }\n}"}, {"value": "python"...
"cbaebabacd" "abc"
{ "name": "findAnagrams", "params": [ { "name": "s", "type": "string" }, { "name": "p", "type": "string" } ], "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', 'String', 'Sliding Window']
439
Ternary Expression Parser
ternary-expression-parser
null
Medium
36.1K
58.4K
36,125
58,373
61.9%
['mini-parser', 'remove-comments', 'parse-lisp-expression']
[]
Algorithms
null
"T?2:3"
{ "name": "parseTernary", "params": [ { "name": "expression", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Stack', 'Recursion']
440
K-th Smallest in Lexicographical Order
k-th-smallest-in-lexicographical-order
<p>Given two integers <code>n</code> and <code>k</code>, return <em>the</em> <code>k<sup>th</sup></code> <em>lexicographically smallest integer in the range</em> <code>[1, n]</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> n = 13, k = 2 <strong>Output:</stron...
Hard
98.2K
234K
98,201
233,994
42.0%
['count-special-integers']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findKthNumber(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findKthNumber(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "default...
13 2
{ "name": "findKthNumber", "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...
['Trie']
441
Arranging Coins
arranging-coins
<p>You have <code>n</code> coins and you want to build a staircase with these coins. The staircase consists of <code>k</code> rows where the <code>i<sup>th</sup></code> row has exactly <code>i</code> coins. The last row of the staircase <strong>may be</strong> incomplete.</p> <p>Given the integer <code>n</code>, retur...
Easy
520.4K
1.1M
520,449
1,102,357
47.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int arrangeCoins(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int arrangeCoins(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So...
5
{ "name": "arrangeCoins", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Binary Search']
442
Find All Duplicates in an Array
find-all-duplicates-in-an-array
<p>Given an integer array <code>nums</code> of length <code>n</code> where all the integers of <code>nums</code> are in the range <code>[1, n]</code> and each integer appears <strong>at most</strong> <strong>twice</strong>, return <em>an array of all the integers that appears <strong>twice</strong></em>.</p> <p>You mu...
Medium
891.5K
1.2M
891,491
1,168,427
76.3%
['find-all-numbers-disappeared-in-an-array', 'sum-of-distances', 'the-two-sneaky-numbers-of-digitville']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findDuplicates(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> findDuplicates(int[] nums) {\n \n }\n}"}, {"value": "python", "te...
[4,3,2,7,8,2,3,1]
{ "name": "findDuplicates", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "list<integer>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table']
443
String Compression
string-compression
<p>Given an array of characters <code>chars</code>, compress it using the following algorithm:</p> <p>Begin with an empty string <code>s</code>. For each group of <strong>consecutive repeating characters</strong> in <code>chars</code>:</p> <ul> <li>If the group&#39;s length is <code>1</code>, append the character to...
Medium
826.4K
1.4M
826,432
1,434,940
57.6%
['count-and-say', 'encode-and-decode-strings', 'design-compressed-string-iterator', 'decompress-run-length-encoded-list', 'string-compression-iii', 'better-compression-of-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int compress(vector<char>& chars) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int compress(char[] chars) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
["a","a","b","b","c","c","c"]
{ "name": "compress", "params": [ { "name": "chars", "type": "character[]" } ], "return": { "type": "integer" }, "output": { "paramindex": 0, "size": "ret" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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']
444
Sequence Reconstruction
sequence-reconstruction
null
Medium
59.5K
203.5K
59,542
203,465
29.3%
['course-schedule-ii']
[]
Algorithms
null
[1,2,3] [[1,2],[1,3]]
{ "name": "sequenceReconstruction", "params": [ { "name": "nums", "type": "integer[]" }, { "name": "sequences", "type": "list<list<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', 'Graph', 'Topological Sort']
445
Add Two Numbers II
add-two-numbers-ii
<p>You are given two <strong>non-empty</strong> linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.</p> <p>You may assume the two numbers do not contain any leading zero, ex...
Medium
519.5K
843.2K
519,460
843,190
61.6%
['add-two-numbers', 'add-two-polynomials-represented-as-linked-lists']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ...
[7,2,4,3] [5,6,4]
{ "name": "addTwoNumbers", "params": [ { "name": "l1", "type": "ListNode", "dealloc": false }, { "name": "l2", "type": "ListNode", "dealloc": false } ], "return": { "type": "ListNode", "dealloc": true } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List', 'Math', 'Stack']
446
Arithmetic Slices II - Subsequence
arithmetic-slices-ii-subsequence
<p>Given an integer array <code>nums</code>, return <em>the number of all the <strong>arithmetic subsequences</strong> of</em> <code>nums</code>.</p> <p>A sequence of numbers is called arithmetic if it consists of <strong>at least three elements</strong> and if the difference between any two consecutive elements is th...
Hard
157.3K
288.4K
157,255
288,408
54.5%
['arithmetic-slices', 'destroy-sequential-targets', 'count-palindromic-subsequences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfArithmeticSlices(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfArithmeticSlices(int[] nums) {\n \n }\n}"}, {"value": "python", "...
[2,4,6,8,10]
{ "name": "numberOfArithmeticSlices", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
447
Number of Boomerangs
number-of-boomerangs
<p>You are given <code>n</code> <code>points</code> in the plane that are all <strong>distinct</strong>, where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>. A <strong>boomerang</strong> is a tuple of points <code>(i, j, k)</code> such that the distance between <code>i</code> and <code>j</code> equals the dis...
Medium
107.9K
191.8K
107,865
191,795
56.2%
['line-reflection']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfBoomerangs(vector<vector<int>>& points) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfBoomerangs(int[][] points) {\n \n }\n}"}, {"value": "python",...
[[0,0],[1,0],[2,0]]
{ "name": "numberOfBoomerangs", "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']
448
Find All Numbers Disappeared in an Array
find-all-numbers-disappeared-in-an-array
<p>Given an array <code>nums</code> of <code>n</code> integers where <code>nums[i]</code> is in the range <code>[1, n]</code>, return <em>an array of all the integers in the range</em> <code>[1, n]</code> <em>that do not appear in</em> <code>nums</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong>...
Easy
1.1M
1.7M
1,059,890
1,705,448
62.1%
['first-missing-positive', 'find-all-duplicates-in-an-array', 'find-unique-binary-string', 'append-k-integers-with-minimal-sum', 'replace-elements-in-an-array', 'maximum-number-of-integers-to-choose-from-a-range-i', 'maximum-number-of-integers-to-choose-from-a-range-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findDisappearedNumbers(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> findDisappearedNumbers(int[] nums) {\n \n }\n}"}, {"value...
[4,3,2,7,8,2,3,1]
{ "name": "findDisappearedNumbers", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "list<integer>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table']
449
Serialize and Deserialize BST
serialize-and-deserialize-bst
<p>Serialization is converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment.</p> <p>Design an algorithm to serialize and deserialize a <b>bina...
Medium
252.2K
431.6K
252,174
431,617
58.4%
['serialize-and-deserialize-binary-tree', 'find-duplicate-subtrees', 'serialize-and-deserialize-n-ary-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(int x) : val(x), left(NULL), right(NULL) {}\n * };\n */\nclass Codec {\npublic:\n\n // Encodes a tree to a single string...
[2,1,3]
{ "name": "CodecDriver", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "TreeNode" }, "manual": true }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Design', 'Binary Search Tree', 'Binary Tree']
450
Delete Node in a BST
delete-node-in-a-bst
<p>Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return <em>the <strong>root node reference</strong> (possibly updated) of the BST</em>.</p> <p>Basically, the deletion can be divided into two stages:</p> <ol> <li>Search for a node to remove.</li> <li>If the node is f...
Medium
670.3K
1.3M
670,329
1,271,849
52.7%
['split-bst']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[5,3,6,2,4,null,7] 3
{ "name": "deleteNode", "params": [ { "name": "root", "type": "TreeNode", "dealloc": false }, { "name": "key", "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 Search Tree', 'Binary Tree']
451
Sort Characters By Frequency
sort-characters-by-frequency
<p>Given a string <code>s</code>, sort it in <strong>decreasing order</strong> based on the <strong>frequency</strong> of the characters. The <strong>frequency</strong> of a character is the number of times it appears in the string.</p> <p>Return <em>the sorted string</em>. If there are multiple answers, return <em>an...
Medium
886.6K
1.2M
886,612
1,201,537
73.8%
['top-k-frequent-elements', 'first-unique-character-in-a-string', 'sort-array-by-increasing-frequency', 'percentage-of-letter-in-string', 'maximum-number-of-pairs-in-array', 'node-with-highest-edge-score', 'most-frequent-even-element', 'count-pairs-of-similar-strings']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string frequencySort(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String frequencySort(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo...
"tree"
{ "name": "frequencySort", "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...
['Hash Table', 'String', 'Sorting', 'Heap (Priority Queue)', 'Bucket Sort', 'Counting']
452
Minimum Number of Arrows to Burst Balloons
minimum-number-of-arrows-to-burst-balloons
<p>There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array <code>points</code> where <code>points[i] = [x<sub>start</sub>, x<sub>end</sub>]</code> denotes a balloon whose <strong>horizontal diameter</strong> stretches between <code>x<sub>...
Medium
648K
1.1M
648,039
1,077,201
60.2%
['meeting-rooms-ii', 'non-overlapping-intervals']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMinArrowShots(vector<vector<int>>& points) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMinArrowShots(int[][] points) {\n \n }\n}"}, {"value": "python", "...
[[10,16],[2,8],[1,6],[7,12]]
{ "name": "findMinArrowShots", "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', 'Greedy', 'Sorting']
453
Minimum Moves to Equal Array Elements
minimum-moves-to-equal-array-elements
<p>Given an integer array <code>nums</code> of size <code>n</code>, return <em>the minimum number of moves required to make all array elements equal</em>.</p> <p>In one move, you can increment <code>n - 1</code> elements of the array by <code>1</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong><...
Medium
193.9K
336.7K
193,923
336,692
57.6%
['minimum-moves-to-equal-array-elements-ii', 'maximum-running-time-of-n-computers', 'pour-water-between-buckets-to-make-water-levels-equal', 'divide-players-into-teams-of-equal-skill', 'find-minimum-operations-to-make-all-elements-divisible-by-three']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minMoves(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minMoves(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ...
[1,2,3]
{ "name": "minMoves", "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']
454
4Sum II
4sum-ii
<p>Given four integer arrays <code>nums1</code>, <code>nums2</code>, <code>nums3</code>, and <code>nums4</code> all of length <code>n</code>, return the number of tuples <code>(i, j, k, l)</code> such that:</p> <ul> <li><code>0 &lt;= i, j, k, l &lt; n</code></li> <li><code>nums1[i] + nums2[j] + nums3[k] + nums4[l] =...
Medium
353.6K
614.9K
353,626
614,862
57.5%
['4sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int fourSumCount(int[] nums1, int[] nu...
[1,2] [-2,-1] [-1,2] [0,2]
{ "name": "fourSumCount", "params": [ { "name": "nums1", "type": "integer[]" }, { "name": "nums2", "type": "integer[]" }, { "name": "nums3", "type": "integer[]" }, { "name": "nums4", "type": "integer[]" } ], "return": { "type": ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table']
455
Assign Cookies
assign-cookies
<p>Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.</p> <p>Each child <code>i</code> has a greed factor <code>g[i]</code>, which is the minimum size of a cookie that the child will be content with; and each cookie <code>j</code> has a siz...
Easy
647.9K
1.2M
647,915
1,209,146
53.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findContentChildren(vector<int>& g, vector<int>& s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findContentChildren(int[] g, int[] s) {\n \n }\n}"}, {"value": "p...
[1,2,3] [1,1]
{ "name": "findContentChildren", "params": [ { "name": "g", "type": "integer[]" }, { "name": "s", "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']
456
132 Pattern
132-pattern
<p>Given an array of <code>n</code> integers <code>nums</code>, a <strong>132 pattern</strong> is a subsequence of three integers <code>nums[i]</code>, <code>nums[j]</code> and <code>nums[k]</code> such that <code>i &lt; j &lt; k</code> and <code>nums[i] &lt; nums[k] &lt; nums[j]</code>.</p> <p>Return <code>true</code...
Medium
285K
839.5K
284,980
839,503
33.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool find132pattern(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean find132pattern(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python"...
[1,2,3,4]
{ "name": "find132pattern", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Stack', 'Monotonic Stack', 'Ordered Set']
457
Circular Array Loop
circular-array-loop
<p>You are playing a game involving a <strong>circular</strong> array of non-zero integers <code>nums</code>. Each <code>nums[i]</code> denotes the number of indices forward/backward you must move if you are located at index <code>i</code>:</p> <ul> <li>If <code>nums[i]</code> is positive, move <code>nums[i]</code> s...
Medium
91.6K
259.4K
91,628
259,393
35.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool circularArrayLoop(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean circularArrayLoop(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "P...
[2,-1,1,2,2]
{ "name": "circularArrayLoop", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Two Pointers']
458
Poor Pigs
poor-pigs
<p>There are <code>buckets</code> buckets of liquid, where <strong>exactly one</strong> of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die or not. Unfortunately, you only have <code>minutesToTest</code> minutes to determine whic...
Hard
124.6K
210.2K
124,563
210,162
59.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int poorPigs(int buckets, int minutesToDie, int minutesToTest) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int poorPigs(int buckets, int minutesToDie, int minutesToTest) {\n ...
4 15 15
{ "name": "poorPigs", "params": [ { "name": "buckets", "type": "integer" }, { "name": "minutesToDie", "type": "integer" }, { "name": "minutesToTest", "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']
459
Repeated Substring Pattern
repeated-substring-pattern
<p>Given a string <code>s</code>, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> s = &quot;abab&quot; <strong>Output:</strong> true <strong>Explanatio...
Easy
516.8K
1.1M
516,828
1,106,616
46.7%
['find-the-index-of-the-first-occurrence-in-a-string', 'repeated-string-match']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool repeatedSubstringPattern(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean repeatedSubstringPattern(String s) {\n \n }\n}"}, {"value": "python", "text":...
"abab"
{ "name": "repeatedSubstringPattern", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'String Matching']
460
LFU Cache
lfu-cache
<p>Design and implement a data structure for a <a href="https://en.wikipedia.org/wiki/Least_frequently_used" target="_blank">Least Frequently Used (LFU)</a> cache.</p> <p>Implement the <code>LFUCache</code> class:</p> <ul> <li><code>LFUCache(int capacity)</code> Initializes the object with the <code>capacity</code> ...
Hard
296.3K
642.9K
296,251
642,911
46.1%
['lru-cache', 'design-in-memory-file-system']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class LFUCache {\npublic:\n LFUCache(int capacity) {\n \n }\n \n int get(int key) {\n \n }\n \n void put(int key, int value) {\n \n }\n};\n\n/**\n * Your LFUCache object will be instantiated and called as such:\n * LFUCache* o...
["LFUCache","put","put","get","put","get","get","put","get","get","get"] [[2],[1,1],[2,2],[1],[3,3],[2],[3],[4,4],[1],[3],[4]]
{ "classname": "LFUCache", "maxbytesperline": 200000, "constructor": { "params": [ { "type": "integer", "name": "capacity" } ] }, "methods": [ { "name" : "get", "params": [ { ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Linked List', 'Design', 'Doubly-Linked List']
461
Hamming Distance
hamming-distance
<p>The <a href="https://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> between two integers is the number of positions at which the corresponding bits are different.</p> <p>Given two integers <code>x</code> and <code>y</code>, return <em>the <strong>Hamming distance</strong> between them<...
Easy
623.1K
820.6K
623,127
820,607
75.9%
['number-of-1-bits', 'total-hamming-distance']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int hammingDistance(int x, int y) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int hammingDistance(int x, int y) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
1 4
{ "name": "hammingDistance", "params": [ { "name": "x", "type": "integer" }, { "name": "y", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Bit Manipulation']
462
Minimum Moves to Equal Array Elements II
minimum-moves-to-equal-array-elements-ii
<p>Given an integer array <code>nums</code> of size <code>n</code>, return <em>the minimum number of moves required to make all array elements equal</em>.</p> <p>In one move, you can increment or decrement an element of the array by <code>1</code>.</p> <p>Test cases are designed so that the answer will fit in a <stro...
Medium
202.2K
332.4K
202,237
332,436
60.8%
['best-meeting-point', 'minimum-moves-to-equal-array-elements', 'minimum-operations-to-make-a-uni-value-grid', 'removing-minimum-number-of-magic-beans', 'minimum-cost-to-make-array-equal', 'minimum-operations-to-make-all-array-elements-equal', 'minimum-cost-to-make-array-equalindromic', 'minimum-operations-to-make-suba...
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minMoves2(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minMoves2(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode"...
[1,2,3]
{ "name": "minMoves2", "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', 'Sorting']
463
Island Perimeter
island-perimeter
<p>You are given <code>row x col</code> <code>grid</code> representing a map where <code>grid[i][j] = 1</code> represents&nbsp;land and <code>grid[i][j] = 0</code> represents water.</p> <p>Grid cells are connected <strong>horizontally/vertically</strong> (not diagonally). The <code>grid</code> is completely surrounded...
Easy
713.6K
972.5K
713,567
972,495
73.4%
['max-area-of-island', 'flood-fill', 'coloring-a-border']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int islandPerimeter(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int islandPerimeter(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "...
[[0,1,0,0],[1,1,1,0],[0,1,0,0],[1,1,0,0]]
{ "name": "islandPerimeter", "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']
464
Can I Win
can-i-win
<p>In the &quot;100 game&quot; two players take turns adding, to a running total, any integer from <code>1</code> to <code>10</code>. The player who first causes the running total to <strong>reach or exceed</strong> 100 wins.</p> <p>What if we change the game so that players <strong>cannot</strong> re-use integers?</p...
Medium
107.6K
356K
107,599
356,006
30.2%
['flip-game-ii', 'guess-number-higher-or-lower-ii', 'predict-the-winner', 'find-the-winning-player-in-coin-game', 'find-the-number-of-winning-players']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canIWin(int maxChoosableInteger, int desiredTotal) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canIWin(int maxChoosableInteger, int desiredTotal) {\n \n }\n...
10 11
{ "name": "canIWin", "params": [ { "name": "maxChoosableInteger", "type": "integer" }, { "name": "desiredTotal", "type": "integer" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Dynamic Programming', 'Bit Manipulation', 'Memoization', 'Game Theory', 'Bitmask']
465
Optimal Account Balancing
optimal-account-balancing
null
Hard
102.5K
205.9K
102,459
205,887
49.8%
[]
[]
Algorithms
null
[[0,1,10],[2,0,5]]
{ "name": "minTransfers", "params": [ { "name": "transactions", "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', 'Backtracking', 'Bit Manipulation', 'Bitmask']
466
Count The Repetitions
count-the-repetitions
<p>We define <code>str = [s, n]</code> as the string <code>str</code> which consists of the string <code>s</code> concatenated <code>n</code> times.</p> <ul> <li>For example, <code>str == [&quot;abc&quot;, 3] ==&quot;abcabcabc&quot;</code>.</li> </ul> <p>We define that string <code>s1</code> can be obtained from str...
Hard
22.2K
70.6K
22,227
70,593
31.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getMaxRepetitions(string s1, int n1, string s2, int n2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getMaxRepetitions(String s1, int n1, String s2, int n2) {\n \n ...
"acb" 4 "ab" 2
{ "name": "getMaxRepetitions", "params": [ { "name": "s1", "type": "string" }, { "name": "n1", "type": "integer" }, { "name": "s2", "type": "string" }, { "name": "n2", "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...
['String', 'Dynamic Programming']
467
Unique Substrings in Wraparound String
unique-substrings-in-wraparound-string
<p>We define the string <code>base</code> to be the infinite wraparound string of <code>&quot;abcdefghijklmnopqrstuvwxyz&quot;</code>, so <code>base</code> will look like this:</p> <ul> <li><code>&quot;...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....&quot;</code>.</li> </ul> <p>Given a string <code>s...
Medium
49.6K
121.2K
49,594
121,181
40.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findSubstringInWraproundString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findSubstringInWraproundString(String s) {\n \n }\n}"}, {"value": "python", ...
"a"
{ "name": "findSubstringInWraproundString", "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']
468
Validate IP Address
validate-ip-address
<p>Given a string <code>queryIP</code>, return <code>&quot;IPv4&quot;</code> if IP is a valid IPv4 address, <code>&quot;IPv6&quot;</code> if IP is a valid IPv6 address or <code>&quot;Neither&quot;</code> if IP is not a correct IP of any type.</p> <p><strong>A valid IPv4</strong> address is an IP in the form <code>&quo...
Medium
182.8K
659.3K
182,810
659,332
27.7%
['ip-to-cidr', 'strong-password-checker-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string validIPAddress(string queryIP) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String validIPAddress(String queryIP) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
"172.16.254.1"
{ "name": "validIPAddress", "params": [ { "name": "queryIP", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
469
Convex Polygon
convex-polygon
null
Medium
11.2K
28.1K
11,194
28,124
39.8%
[]
[]
Algorithms
null
[[0,0],[0,5],[5,5],[5,0]]
{ "name": "isConvex", "params": [ { "name": "points", "type": "list<list<integer>>" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Geometry']
470
Implement Rand10() Using Rand7()
implement-rand10-using-rand7
<p>Given the <strong>API</strong> <code>rand7()</code> that generates a uniform random integer in the range <code>[1, 7]</code>, write a function <code>rand10()</code> that generates a uniform random integer in the range <code>[1, 10]</code>. You can only call the API <code>rand7()</code>, and you shouldn&#39;t call an...
Medium
95K
207.3K
95,013
207,313
45.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "// The rand7() API is already defined for you.\n// int rand7();\n// @return a random integer in the range 1 to 7\n\nclass Solution {\npublic:\n int rand10() {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "/**\n * The rand7() API is already ...
1
{ "name": "rand10", "params": [ { "name": "n", "type": "integer" } ], "manual": true, "typescriptCustomType":"function rand7(): number {\n return Math.floor(Math.random() * (7)) + 1;\n}" }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Rejection Sampling', 'Randomized', 'Probability and Statistics']
471
Encode String with Shortest Length
encode-string-with-shortest-length
null
Hard
31.5K
62.4K
31,484
62,382
50.5%
['decode-string', 'number-of-atoms']
[]
Algorithms
null
"aaa"
{ "name": "encode", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming']
472
Concatenated Words
concatenated-words
<p>Given an array of strings <code>words</code> (<strong>without duplicates</strong>), return <em>all the <strong>concatenated words</strong> in the given list of</em> <code>words</code>.</p> <p>A <strong>concatenated word</strong> is defined as a string that is comprised entirely of at least two shorter words (not ne...
Hard
244.4K
495K
244,411
494,954
49.4%
['word-break-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> findAllConcatenatedWordsInADict(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> findAllConcatenatedWordsInADict(String[] words) {\n ...
["cat","cats","catsdogcats","dog","dogcatsdog","hippopotamuses","rat","ratcatdogcat"]
{ "name": "findAllConcatenatedWordsInADict", "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', 'String', 'Dynamic Programming', 'Depth-First Search', 'Trie']
473
Matchsticks to Square
matchsticks-to-square
<p>You are given an integer array <code>matchsticks</code> where <code>matchsticks[i]</code> is the length of the <code>i<sup>th</sup></code> matchstick. You want to use <strong>all the matchsticks</strong> to make one square. You <strong>should not break</strong> any stick, but you can link them up, and each matchstic...
Medium
186K
456.2K
185,986
456,162
40.8%
['maximum-rows-covered-by-columns']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool makesquare(vector<int>& matchsticks) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean makesquare(int[] matchsticks) {\n \n }\n}"}, {"value": "python", "text": "P...
[1,1,2,2,2]
{ "name": "makesquare", "params": [ { "name": "matchsticks", "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', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Bitmask']
474
Ones and Zeroes
ones-and-zeroes
<p>You are given an array of binary strings <code>strs</code> and two integers <code>m</code> and <code>n</code>.</p> <p>Return <em>the size of the largest subset of <code>strs</code> such that there are <strong>at most</strong> </em><code>m</code><em> </em><code>0</code><em>&#39;s and </em><code>n</code><em> </em><co...
Medium
233.4K
480.4K
233,374
480,393
48.6%
['count-subarrays-with-more-ones-than-zeros', 'non-negative-integers-without-consecutive-ones', 'all-divisions-with-the-highest-score-of-a-binary-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMaxForm(vector<string>& strs, int m, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMaxForm(String[] strs, int m, int n) {\n \n }\n}"}, {"value": "py...
["10","0001","111001","1","0"] 5 3
{ "name": "findMaxForm", "params": [ { "name": "strs", "type": "string[]" }, { "name": "m", "type": "integer" }, { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'Dynamic Programming']
475
Heaters
heaters
<p>Winter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm all the houses.</p> <p>Every house can be warmed, as long as the house is within the heater&#39;s warm radius range.&nbsp;</p> <p>Given the positions of <code>houses</code> and <code>heaters</code> ...
Medium
139.6K
352.6K
139,609
352,628
39.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findRadius(vector<int>& houses, vector<int>& heaters) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findRadius(int[] houses, int[] heaters) {\n \n }\n}"}, {"value"...
[1,2,3] [2]
{ "name": "findRadius", "params": [ { "name": "houses", "type": "integer[]" }, { "name": "heaters", "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', 'Binary Search', 'Sorting']
476
Number Complement
number-complement
<p>The <strong>complement</strong> of an integer is the integer you get when you flip all the <code>0</code>&#39;s to <code>1</code>&#39;s and all the <code>1</code>&#39;s to <code>0</code>&#39;s in its binary representation.</p> <ul> <li>For example, The integer <code>5</code> is <code>&quot;101&quot;</code> in bina...
Easy
497.8K
708.1K
497,757
708,085
70.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findComplement(int num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findComplement(int num) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
5
{ "name": "findComplement", "params": [ { "name": "num", "type": "integer" } ], "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...
['Bit Manipulation']
477
Total Hamming Distance
total-hamming-distance
<p>The <a href="https://en.wikipedia.org/wiki/Hamming_distance" target="_blank">Hamming distance</a> between two integers is the number of positions at which the corresponding bits are different.</p> <p>Given an integer array <code>nums</code>, return <em>the sum of <strong>Hamming distances</strong> between all the p...
Medium
120.6K
225K
120,569
225,021
53.6%
['hamming-distance', 'sum-of-digit-differences-of-all-pairs']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int totalHammingDistance(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int totalHammingDistance(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "...
[4,14,2]
{ "name": "totalHammingDistance", "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', 'Bit Manipulation']
478
Generate Random Point in a Circle
generate-random-point-in-a-circle
<p>Given the radius and the position of the center of a circle, implement the function <code>randPoint</code> which generates a uniform random point inside the circle.</p> <p>Implement the <code>Solution</code> class:</p> <ul> <li><code>Solution(double radius, double x_center, double y_center)</code> initializes the...
Medium
45.6K
112.1K
45,627
112,086
40.7%
['random-point-in-non-overlapping-rectangles']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n Solution(double radius, double x_center, double y_center) {\n \n }\n \n vector<double> randPoint() {\n \n }\n};\n\n/**\n * Your Solution object will be instantiated and called as such:\n * Solution* obj = new Solut...
["Solution","randPoint","randPoint","randPoint"] [[1.0,0.0,0.0],[],[],[]]
{ "classname": "Solution", "maxbytesperline": 200000, "constructor": { "params": [ { "name": "radius", "type": "double" }, { "name": "x_center", "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...
['Math', 'Geometry', 'Rejection Sampling', 'Randomized']
479
Largest Palindrome Product
largest-palindrome-product
<p>Given an integer n, return <em>the <strong>largest palindromic integer</strong> that can be represented as the product of two <code>n</code>-digits integers</em>. Since the answer can be very large, return it <strong>modulo</strong> <code>1337</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong>...
Hard
27.5K
79.1K
27,487
79,098
34.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largestPalindrome(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largestPalindrome(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":...
2
{ "name": "largestPalindrome", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Enumeration']
480
Sliding Window Median
sliding-window-median
<p>The <strong>median</strong> is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle values.</p> <ul> <li>For examples, if <code>arr = [2,<u>3</u>,4]</code>, the median is <code>3</code>.</li> <li>For examples, if <code>...
Hard
177.1K
459K
177,060
459,043
38.6%
['find-median-from-data-stream', 'minimum-operations-to-make-median-of-array-equal-to-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<double> medianSlidingWindow(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double[] medianSlidingWindow(int[] nums, int k) {\n \n }\n}"}, {...
[1,3,-1,-3,5,3,6,7] 3
{ "name": "medianSlidingWindow", "params": [ { "name": "nums", "type": "integer[]" }, { "name": "k", "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', 'Hash Table', 'Sliding Window', 'Heap (Priority Queue)']
481
Magical String
magical-string
<p>A magical string <code>s</code> consists of only <code>&#39;1&#39;</code> and <code>&#39;2&#39;</code> and obeys the following rules:</p> <ul> <li>The string s is magical because concatenating the number of contiguous occurrences of characters <code>&#39;1&#39;</code> and <code>&#39;2&#39;</code> generates the str...
Medium
42.5K
81.5K
42,510
81,462
52.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int magicalString(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int magicalString(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class ...
6
{ "name": "magicalString", "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...
['Two Pointers', 'String']
482
License Key Formatting
license-key-formatting
<p>You are given a license key represented as a string <code>s</code> that consists of only alphanumeric characters and dashes. The string is separated into <code>n + 1</code> groups by <code>n</code> dashes. You are also given an integer <code>k</code>.</p> <p>We want to reformat the string <code>s</code> such that e...
Easy
313.4K
703.5K
313,373
703,541
44.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string licenseKeyFormatting(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String licenseKeyFormatting(String s, int k) {\n \n }\n}"}, {"value": "python", ...
"5F3Z-2e-9-w" 4
{ "name": "licenseKeyFormatting", "params": [ { "name": "s", "type": "string" }, { "name": "k", "type": "integer" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
483
Smallest Good Base
smallest-good-base
<p>Given an integer <code>n</code> represented as a string, return <em>the smallest <strong>good base</strong> of</em> <code>n</code>.</p> <p>We call <code>k &gt;= 2</code> a <strong>good base</strong> of <code>n</code>, if all digits of <code>n</code> base <code>k</code> are <code>1</code>&#39;s.</p> <p>&nbsp;</p> <...
Hard
25.9K
60.3K
25,899
60,334
42.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string smallestGoodBase(string n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String smallestGoodBase(String n) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
"13"
{ "name": "smallestGoodBase", "params": [ { "name": "n", "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...
['Math', 'Binary Search']
484
Find Permutation
find-permutation
null
Medium
41.4K
61.8K
41,358
61,801
66.9%
['using-a-robot-to-print-the-lexicographically-smallest-string']
[]
Algorithms
null
"I"
{ "name": "findPermutation", "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', 'String', 'Stack', 'Greedy']
485
Max Consecutive Ones
max-consecutive-ones
<p>Given a binary array <code>nums</code>, return <em>the maximum number of consecutive </em><code>1</code><em>&#39;s in the array</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> nums = [1,1,0,1,1,1] <strong>Output:</strong> 3 <strong>Explanation:</strong> The ...
Easy
1.6M
2.6M
1,584,367
2,554,709
62.0%
['max-consecutive-ones-ii', 'max-consecutive-ones-iii', 'consecutive-characters', 'longer-contiguous-segments-of-ones-than-zeros', 'length-of-the-longest-alphabetical-continuous-substring', 'maximum-enemy-forts-that-can-be-captured']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMaxConsecutiveOnes(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMaxConsecutiveOnes(int[] nums) {\n \n }\n}"}, {"value": "python", "text...
[1,1,0,1,1,1]
{ "name": "findMaxConsecutiveOnes", "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']
486
Predict the Winner
predict-the-winner
<p>You are given an integer array <code>nums</code>. Two players are playing a game with this array: player 1 and player 2.</p> <p>Player 1 and player 2 take turns, with player 1 starting first. Both players start the game with a score of <code>0</code>. At each turn, the player takes one of the numbers from either en...
Medium
259.3K
466.3K
259,252
466,278
55.6%
['can-i-win', 'find-the-winning-player-in-coin-game', 'find-the-number-of-winning-players', 'count-the-number-of-winning-sequences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool predictTheWinner(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean predictTheWinner(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Pyt...
[1,5,2]
{ "name": "predictTheWinner", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Dynamic Programming', 'Recursion', 'Game Theory']
487
Max Consecutive Ones II
max-consecutive-ones-ii
null
Medium
168.8K
328.4K
168,825
328,382
51.4%
['max-consecutive-ones', 'max-consecutive-ones-iii', 'all-divisions-with-the-highest-score-of-a-binary-array']
[]
Algorithms
null
[1,0,1,1,0]
{ "name": "findMaxConsecutiveOnes", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Sliding Window']
488
Zuma Game
zuma-game
<p>You are playing a variation of the game Zuma.</p> <p>In this variation of Zuma, there is a <strong>single row</strong> of colored balls on a board, where each ball can be colored red <code>&#39;R&#39;</code>, yellow <code>&#39;Y&#39;</code>, blue <code>&#39;B&#39;</code>, green <code>&#39;G&#39;</code>, or white <c...
Hard
26K
81.7K
25,958
81,738
31.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMinStep(string board, string hand) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMinStep(String board, String hand) {\n \n }\n}"}, {"value": "python", "tex...
"WRRBBW" "RB"
{ "name": "findMinStep", "params": [ { "name": "board", "type": "string" }, { "name": "hand", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming', 'Stack', 'Breadth-First Search', 'Memoization']
489
Robot Room Cleaner
robot-room-cleaner
null
Hard
186.3K
240.9K
186,285
240,930
77.3%
['walls-and-gates', 'shortest-path-in-a-hidden-grid', 'minimum-path-cost-in-a-hidden-grid', 'number-of-spaces-cleaning-robot-cleaned']
[]
Algorithms
null
[[1,1,1,1,1,0,1,1],[1,1,1,1,1,0,1,1],[1,0,1,1,1,1,1,1],[0,0,0,1,0,0,0,0],[1,1,1,1,1,1,1,1]] 1 3
{ "name": "cleanRoom", "params": [ { "name": "room", "type": "integer[][]" }, { "name": "row", "type": "integer" }, { "name": "col", "type": "integer" } ], "return": { "type": "void" }, "languages": [ "cpp", "java", "python", "c...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Interactive']
490
The Maze
the-maze
null
Medium
189.7K
320.4K
189,740
320,416
59.2%
['the-maze-iii', 'the-maze-ii']
[]
Algorithms
null
[[0,0,1,0,0],[0,0,0,0,0],[0,0,0,1,0],[1,1,0,1,1],[0,0,0,0,0]] [0,4] [4,4]
{ "name": "hasPath", "params": [ { "name": "maze", "type": "integer[][]" }, { "name": "start", "type": "integer[]" }, { "name": "destination", "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', 'Depth-First Search', 'Breadth-First Search', 'Matrix']
491
Non-decreasing Subsequences
non-decreasing-subsequences
<p>Given an integer array <code>nums</code>, return <em>all the different possible non-decreasing subsequences of the given array with at least two elements</em>. You may return the answer in <strong>any order</strong>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong>...
Medium
186.5K
303.3K
186,474
303,322
61.5%
['maximum-length-of-pair-chain']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> findSubsequences(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> findSubsequences(int[] nums) {\n \n }\n}"}, {"val...
[4,6,7,7]
{ "name": "findSubsequences", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "list<list<integer>>", "dealloc": true } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Backtracking', 'Bit Manipulation']
492
Construct the Rectangle
construct-the-rectangle
<p>A web developer needs to know how to design a web page&#39;s size. So, given a specific rectangular web page&rsquo;s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:</p> <ol> <li>The area of the rectangular web page you designed must equal to...
Easy
139.2K
231.3K
139,243
231,335
60.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> constructRectangle(int area) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] constructRectangle(int area) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
4
{ "name": "constructRectangle", "params": [ { "name": "area", "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']
493
Reverse Pairs
reverse-pairs
<p>Given an integer array <code>nums</code>, return <em>the number of <strong>reverse pairs</strong> in the array</em>.</p> <p>A <strong>reverse pair</strong> is a pair <code>(i, j)</code> where:</p> <ul> <li><code>0 &lt;= i &lt; j &lt; nums.length</code> and</li> <li><code>nums[i] &gt; 2 * nums[j]</code>.</li> </u...
Hard
251K
788.6K
250,963
788,579
31.8%
['count-of-smaller-numbers-after-self', 'count-of-range-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int reversePairs(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int reversePairs(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[1,3,2,3,1]
{ "name": "reversePairs", "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', 'Binary Search', 'Divide and Conquer', 'Binary Indexed Tree', 'Segment Tree', 'Merge Sort', 'Ordered Set']
494
Target Sum
target-sum
<p>You are given an integer array <code>nums</code> and an integer <code>target</code>.</p> <p>You want to build an <strong>expression</strong> out of nums by adding one of the symbols <code>&#39;+&#39;</code> and <code>&#39;-&#39;</code> before each integer in nums and then concatenate all the integers.</p> <ul> <l...
Medium
857K
1.7M
856,988
1,698,630
50.5%
['expression-add-operators', 'ways-to-express-an-integer-as-sum-of-powers']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findTargetSumWays(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findTargetSumWays(int[] nums, int target) {\n \n }\n}"}, {"value": "...
[1,1,1,1,1] 3
{ "name": "findTargetSumWays", "params": [ { "name": "nums", "type": "integer[]" }, { "name": "target", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Backtracking']
495
Teemo Attacking
teemo-attacking
<p>Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly <code>duration</code> seconds. More formally, an attack at second <code>t</code> will mean Ashe is poisoned during the <strong>inclusive</strong> time interval <code>[t, t + duration - 1]</code>. ...
Easy
180.7K
317.8K
180,706
317,757
56.9%
['merge-intervals', 'can-place-flowers', 'dota2-senate']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findPoisonedDuration(vector<int>& timeSeries, int duration) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findPoisonedDuration(int[] timeSeries, int duration) {\n \n ...
[1,4] 2
{ "name": "findPoisonedDuration", "params": [ { "name": "timeSeries", "type": "integer[]" }, { "name": "duration", "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']
496
Next Greater Element I
next-greater-element-i
<p>The <strong>next greater element</strong> of some element <code>x</code> in an array is the <strong>first greater</strong> element that is <strong>to the right</strong> of <code>x</code> in the same array.</p> <p>You are given two <strong>distinct 0-indexed</strong> integer arrays <code>nums1</code> and <code>nums2...
Easy
994.1K
1.3M
994,103
1,341,275
74.1%
['next-greater-element-ii', 'next-greater-element-iii', 'daily-temperatures', 'sum-of-subarray-ranges', 'sum-of-total-strength-of-wizards', 'next-greater-element-iv', 'remove-nodes-from-linked-list', 'smallest-missing-integer-greater-than-sequential-prefix-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] nextGreaterElement(int[] nums1, int[] nums2) {\n \n...
[4,1,2] [1,3,4,2]
{ "name": "nextGreaterElement", "params": [ { "name": "nums1", "type": "integer[]" }, { "name": "nums2", "type": "integer[]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Stack', 'Monotonic Stack']
497
Random Point in Non-overlapping Rectangles
random-point-in-non-overlapping-rectangles
<p>You are given an array of non-overlapping axis-aligned rectangles <code>rects</code> where <code>rects[i] = [a<sub>i</sub>, b<sub>i</sub>, x<sub>i</sub>, y<sub>i</sub>]</code> indicates that <code>(a<sub>i</sub>, b<sub>i</sub>)</code> is the bottom-left corner point of the <code>i<sup>th</sup></code> rectangle and <...
Medium
46K
113.7K
46,021
113,733
40.5%
['random-pick-with-weight', 'generate-random-point-in-a-circle']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n Solution(vector<vector<int>>& rects) {\n \n }\n \n vector<int> pick() {\n \n }\n};\n\n/**\n * Your Solution object will be instantiated and called as such:\n * Solution* obj = new Solution(rects);\n * vector<int> p...
["Solution","pick","pick","pick","pick","pick"] [[[[-2,-2,1,1],[2,2,4,6]]],[],[],[],[],[]]
{ "classname": "Solution", "maxbytesperline": 200000, "constructor": { "params": [ { "name": "rects", "type": "integer[][]" }, { "type": "integer", "name": "rectsSize", "lang": "c", ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Binary Search', 'Reservoir Sampling', 'Prefix Sum', 'Ordered Set', 'Randomized']
498
Diagonal Traverse
diagonal-traverse
<p>Given an <code>m x n</code> matrix <code>mat</code>, return <em>an array of all the elements of the array in a diagonal order</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" src="https://assets.leetcode.com/uploads/2021/04/10/diag1-grid.jpg" style="width: 334px; height: 334px;...
Medium
377.5K
601.8K
377,453
601,755
62.7%
['decode-the-slanted-ciphertext']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findDiagonalOrder(vector<vector<int>>& mat) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findDiagonalOrder(int[][] mat) {\n \n }\n}"}, {"value": "python...
[[1,2,3],[4,5,6],[7,8,9]]
{ "name": "findDiagonalOrder", "params": [ { "name": "mat", "type": "integer[][]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Matrix', 'Simulation']
499
The Maze III
the-maze-iii
null
Hard
35.5K
70.4K
35,485
70,414
50.4%
['the-maze', 'the-maze-ii']
[]
Algorithms
null
[[0,0,0,0,0],[1,1,0,0,1],[0,0,0,0,0],[0,1,0,0,1],[0,1,0,0,0]] [4,3] [0,1]
{ "name": "findShortestWay", "params": [ { "name": "maze", "type": "integer[][]" }, { "name": "ball", "type": "integer[]" }, { "name": "hole", "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', 'Depth-First Search', 'Breadth-First Search', 'Graph', 'Heap (Priority Queue)', 'Matrix', 'Shortest Path']
500
Keyboard Row
keyboard-row
<p>Given an array of strings <code>words</code>, return <em>the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below</em>.</p> <p><strong>Note</strong> that the strings are <strong>case-insensitive</strong>, both lowercased and uppercased of the same letter ar...
Easy
273.8K
379.1K
273,807
379,136
72.2%
['find-the-sequence-of-strings-appeared-on-the-screen', 'find-the-original-typed-string-i', 'find-the-original-typed-string-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> findWords(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String[] findWords(String[] words) {\n \n }\n}"}, {"value": "python", "text":...
["Hello","Alaska","Dad","Peace"]
{ "name": "findWords", "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', 'Hash Table', 'String']