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
101
Symmetric Tree
symmetric-tree
<p>Given the <code>root</code> of a binary tree, <em>check whether it is a mirror of itself</em> (i.e., symmetric around its center).</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" src="https://assets.leetcode.com/uploads/2021/02/19/symtree1.jpg" style="width: 354px; height: 291px;" /...
Easy
2.4M
4.1M
2,392,757
4,064,961
58.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[1,2,2,3,4,4,3]
{ "name": "isSymmetric", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
102
Binary Tree Level Order Traversal
binary-tree-level-order-traversal
<p>Given the <code>root</code> of a binary tree, return <em>the level order traversal of its nodes&#39; values</em>. (i.e., from left to right, level by level).</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" src="https://assets.leetcode.com/uploads/2021/02/19/tree1.jpg" style="width: ...
Medium
2.7M
3.9M
2,749,829
3,922,746
70.1%
['binary-tree-zigzag-level-order-traversal', 'binary-tree-level-order-traversal-ii', 'minimum-depth-of-binary-tree', 'binary-tree-vertical-order-traversal', 'average-of-levels-in-binary-tree', 'n-ary-tree-level-order-traversal', 'cousins-in-binary-tree', 'minimum-number-of-operations-to-sort-a-binary-tree-by-level', 'd...
[]
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": "levelOrder", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "list<list<integer>>", "dealloc": true } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Breadth-First Search', 'Binary Tree']
103
Binary Tree Zigzag Level Order Traversal
binary-tree-zigzag-level-order-traversal
<p>Given the <code>root</code> of a binary tree, return <em>the zigzag level order traversal of its nodes&#39; values</em>. (i.e., from left to right, then right to left for the next level and alternate between).</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" src="https://assets.leetc...
Medium
1.4M
2.4M
1,440,082
2,351,198
61.2%
['binary-tree-level-order-traversal', 'zigzag-grid-traversal-with-skip']
[]
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": "zigzagLevelOrder", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "list<list<integer>>", "dealloc": true } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Breadth-First Search', 'Binary Tree']
104
Maximum Depth of Binary Tree
maximum-depth-of-binary-tree
<p>Given the <code>root</code> of a binary tree, return <em>its maximum depth</em>.</p> <p>A binary tree&#39;s <strong>maximum depth</strong>&nbsp;is the number of nodes along the longest path from the root node down to the farthest leaf node.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img ...
Easy
3.9M
5M
3,873,471
5,037,169
76.9%
['balanced-binary-tree', 'minimum-depth-of-binary-tree', 'maximum-depth-of-n-ary-tree', 'time-needed-to-inform-all-employees', 'amount-of-time-for-binary-tree-to-be-infected', 'height-of-binary-tree-after-subtree-removal-queries']
[]
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": "maxDepth", "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']
105
Construct Binary Tree from Preorder and Inorder Traversal
construct-binary-tree-from-preorder-and-inorder-traversal
<p>Given two integer arrays <code>preorder</code> and <code>inorder</code> where <code>preorder</code> is the preorder traversal of a binary tree and <code>inorder</code> is the inorder traversal of the same tree, construct and return <em>the binary tree</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</s...
Medium
1.5M
2.3M
1,518,910
2,288,403
66.4%
['construct-binary-tree-from-inorder-and-postorder-traversal']
[]
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,15,7] [9,3,15,20,7]
{ "name": "buildTree", "params": [ { "name": "preorder", "type": "integer[]" }, { "name": "inorder", "type": "integer[]" } ], "return": { "type": "TreeNode", "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', 'Divide and Conquer', 'Tree', 'Binary Tree']
106
Construct Binary Tree from Inorder and Postorder Traversal
construct-binary-tree-from-inorder-and-postorder-traversal
<p>Given two integer arrays <code>inorder</code> and <code>postorder</code> where <code>inorder</code> is the inorder traversal of a binary tree and <code>postorder</code> is the postorder traversal of the same tree, construct and return <em>the binary tree</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:...
Medium
780.6K
1.2M
780,596
1,184,497
65.9%
['construct-binary-tree-from-preorder-and-inorder-traversal']
[]
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...
[9,3,15,20,7] [9,15,7,20,3]
{ "name": "buildTree", "params": [ { "name": "inorder", "type": "integer[]" }, { "name": "postorder", "type": "integer[]" } ], "return": { "type": "TreeNode", "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', 'Divide and Conquer', 'Tree', 'Binary Tree']
107
Binary Tree Level Order Traversal II
binary-tree-level-order-traversal-ii
<p>Given the <code>root</code> of a binary tree, return <em>the bottom-up level order traversal of its nodes&#39; values</em>. (i.e., from left to right, level by level from leaf to root).</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" src="https://assets.leetcode.com/uploads/2021/02/...
Medium
722.8K
1.1M
722,780
1,102,090
65.6%
['binary-tree-level-order-traversal', 'average-of-levels-in-binary-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[3,9,20,null,null,15,7]
{ "name": "levelOrderBottom", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "list<list<integer>>", "dealloc": true } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Breadth-First Search', 'Binary Tree']
108
Convert Sorted Array to Binary Search Tree
convert-sorted-array-to-binary-search-tree
<p>Given an integer array <code>nums</code> where the elements are sorted in <strong>ascending order</strong>, convert <em>it to a </em><span data-keyword="height-balanced"><strong><em>height-balanced</em></strong></span> <em>binary search tree</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p>...
Easy
1.4M
2M
1,441,221
1,954,057
73.8%
['convert-sorted-list-to-binary-search-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[-10,-3,0,5,9]
{ "name": "sortedArrayToBST", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "TreeNode", "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', 'Divide and Conquer', 'Tree', 'Binary Search Tree', 'Binary Tree']
109
Convert Sorted List to Binary Search Tree
convert-sorted-list-to-binary-search-tree
<p>Given the <code>head</code> of a singly linked list where elements are sorted in <strong>ascending order</strong>, convert <em>it to a </em><span data-keyword="height-balanced"><strong><em>height-balanced</em></strong></span> <em>binary search tree</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</stro...
Medium
594.8K
928.5K
594,828
928,471
64.1%
['convert-sorted-array-to-binary-search-tree', 'create-binary-tree-from-descriptions']
[]
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 * ...
[-10,-3,0,5,9]
{ "name": "sortedListToBST", "params": [ { "name": "head", "type": "ListNode" } ], "return": { "type": "TreeNode", "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', 'Divide and Conquer', 'Tree', 'Binary Search Tree', 'Binary Tree']
110
Balanced Binary Tree
balanced-binary-tree
<p>Given a binary tree, determine if it is <span data-keyword="height-balanced"><strong>height-balanced</strong></span>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" src="https://assets.leetcode.com/uploads/2020/10/06/balance_1.jpg" style="width: 342px; height: 221px;" /> <pre> <str...
Easy
1.9M
3.4M
1,882,623
3,431,760
54.9%
['maximum-depth-of-binary-tree', 'k-th-largest-perfect-subtree-size-in-binary-tree', 'check-balanced-string']
[]
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": "isBalanced", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Binary Tree']
111
Minimum Depth of Binary Tree
minimum-depth-of-binary-tree
<p>Given a binary tree, find its minimum depth.</p> <p>The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.</p> <p><strong>Note:</strong>&nbsp;A leaf is a node with no children.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt...
Easy
1.4M
2.8M
1,400,818
2,788,358
50.2%
['binary-tree-level-order-traversal', 'maximum-depth-of-binary-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[3,9,20,null,null,15,7]
{ "name": "minDepth", "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']
112
Path Sum
path-sum
<p>Given the <code>root</code> of a binary tree and an integer <code>targetSum</code>, return <code>true</code> if the tree has a <strong>root-to-leaf</strong> path such that adding up all the values along the path equals <code>targetSum</code>.</p> <p>A <strong>leaf</strong> is a node with no children.</p> <p>&nbsp;...
Easy
1.8M
3.4M
1,767,966
3,360,901
52.6%
['path-sum-ii', 'binary-tree-maximum-path-sum', 'sum-root-to-leaf-numbers', 'path-sum-iii', 'path-sum-iv']
[]
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,4,8,11,null,13,4,7,2,null,null,null,1] 22
{ "name": "hasPathSum", "params": [ { "name": "root", "type": "TreeNode" }, { "name": "targetSum", "type": "integer" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
113
Path Sum II
path-sum-ii
<p>Given the <code>root</code> of a binary tree and an integer <code>targetSum</code>, return <em>all <strong>root-to-leaf</strong> paths where the sum of the node values in the path equals </em><code>targetSum</code><em>. Each path should be returned as a list of the node <strong>values</strong>, not node references</...
Medium
995.2K
1.7M
995,250
1,654,035
60.2%
['path-sum', 'binary-tree-paths', 'path-sum-iii', 'path-sum-iv', 'step-by-step-directions-from-a-binary-tree-node-to-another']
[]
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,4,8,11,null,13,4,7,2,null,null,5,1] 22
{ "name": "pathSum", "params": [ { "name": "root", "type": "TreeNode" }, { "name": "targetSum", "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...
['Backtracking', 'Tree', 'Depth-First Search', 'Binary Tree']
114
Flatten Binary Tree to Linked List
flatten-binary-tree-to-linked-list
<p>Given the <code>root</code> of a binary tree, flatten the tree into a &quot;linked list&quot;:</p> <ul> <li>The &quot;linked list&quot; should use the same <code>TreeNode</code> class where the <code>right</code> child pointer points to the next node in the list and the <code>left</code> child pointer is always <c...
Medium
1.2M
1.7M
1,154,374
1,698,333
68.0%
['flatten-a-multilevel-doubly-linked-list', 'correct-a-binary-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[1,2,5,3,4,null,6]
{ "name": "flatten", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "void" }, "output": { "paramindex": 0 } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List', 'Stack', 'Tree', 'Depth-First Search', 'Binary Tree']
115
Distinct Subsequences
distinct-subsequences
<p>Given two strings s and t, return <i>the number of distinct</i> <b><i>subsequences</i></b><i> of </i>s<i> which equals </i>t.</p> <p>The test cases are generated so that the answer fits on a 32-bit signed integer.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> s...
Hard
521.5K
1.1M
521,513
1,050,114
49.7%
['number-of-unique-good-subsequences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numDistinct(string s, string t) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numDistinct(String s, String t) {\n \n }\n}"}, {"value": "python", "text": "Python", ...
"rabbbit" "rabbit"
{ "name": "numDistinct", "params": [ { "name": "s", "type": "string" }, { "name": "t", "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']
116
Populating Next Right Pointers in Each Node
populating-next-right-pointers-in-each-node
<p>You are given a <strong>perfect binary tree</strong> where all leaves are on the same level, and every parent has two children. The binary tree has the following definition:</p> <pre> struct Node { int val; Node *left; Node *right; Node *next; } </pre> <p>Populate each next pointer to point to its next rig...
Medium
1.2M
1.8M
1,183,685
1,819,130
65.1%
['populating-next-right-pointers-in-each-node-ii', 'binary-tree-right-side-view', 'cycle-length-queries-in-a-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/*\n// Definition for a Node.\nclass Node {\npublic:\n int val;\n Node* left;\n Node* right;\n Node* next;\n\n Node() : val(0), left(NULL), right(NULL), next(NULL) {}\n\n Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}\n\n Node(int...
[1,2,3,4,5,6,7]
{ "name": "connect", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "TreeNode" }, "structures": [ { "name": "TreeNode", "comment": "Definition for a Node.", "members": [ { "name": "val", "type": "integer" ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
117
Populating Next Right Pointers in Each Node II
populating-next-right-pointers-in-each-node-ii
<p>Given a binary tree</p> <pre> struct Node { int val; Node *left; Node *right; Node *next; } </pre> <p>Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to <code>NULL</code>.</p> <p>Initially, all next pointers are set to <code>NULL</...
Medium
735.2K
1.3M
735,156
1,333,388
55.1%
['populating-next-right-pointers-in-each-node']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/*\n// Definition for a Node.\nclass Node {\npublic:\n int val;\n Node* left;\n Node* right;\n Node* next;\n\n Node() : val(0), left(NULL), right(NULL), next(NULL) {}\n\n Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}\n\n Node(int...
[1,2,3,4,5,null,7]
{ "name": "connect", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "TreeNode" }, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3", "golang", "swift", "kotlin", "ruby", "c", "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...
['Linked List', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
118
Pascal's Triangle
pascals-triangle
<p>Given an integer <code>numRows</code>, return the first numRows of <strong>Pascal&#39;s triangle</strong>.</p> <p>In <strong>Pascal&#39;s triangle</strong>, each number is the sum of the two numbers directly above it as shown:</p> <img alt="" src="https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAn...
Easy
2.1M
2.7M
2,061,764
2,690,378
76.6%
['pascals-triangle-ii', 'check-if-digits-are-equal-in-string-after-operations-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> generate(int numRows) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> generate(int numRows) {\n \n }\n}"}, {"value": "python", "text"...
5
{ "name": "generate", "params": [ { "name": "numRows", "type": "integer" } ], "return": { "type": "list<list<integer>>", "dealloc": true, "rowsize": "param_1" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
119
Pascal's Triangle II
pascals-triangle-ii
<p>Given an integer <code>rowIndex</code>, return the <code>rowIndex<sup>th</sup></code> (<strong>0-indexed</strong>) row of the <strong>Pascal&#39;s triangle</strong>.</p> <p>In <strong>Pascal&#39;s triangle</strong>, each number is the sum of the two numbers directly above it as shown:</p> <img alt="" src="https://u...
Easy
1M
1.6M
1,027,393
1,564,826
65.7%
['pascals-triangle', 'find-triangular-sum-of-an-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getRow(int rowIndex) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> getRow(int rowIndex) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
3
{ "name": "getRow", "params": [ { "name": "rowIndex", "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', 'Dynamic Programming']
120
Triangle
triangle
<p>Given a <code>triangle</code> array, return <em>the minimum path sum from top to bottom</em>.</p> <p>For each step, you may move to an adjacent number of the row below. More formally, if you are on index <code>i</code> on the current row, you may move to either index <code>i</code> or index <code>i + 1</code> on th...
Medium
954.4K
1.6M
954,413
1,622,286
58.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumTotal(vector<vector<int>>& triangle) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumTotal(List<List<Integer>> triangle) {\n \n }\n}"}, {"value": "pyth...
[[2],[3,4],[6,5,7],[4,1,8,3]]
{ "name": "minimumTotal", "params": [ { "name": "triangle", "type": "list<list<integer>>" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
121
Best Time to Buy and Sell Stock
best-time-to-buy-and-sell-stock
<p>You are given an array <code>prices</code> where <code>prices[i]</code> is the price of a given stock on the <code>i<sup>th</sup></code> day.</p> <p>You want to maximize your profit by choosing a <strong>single day</strong> to buy one stock and choosing a <strong>different day in the future</strong> to sell that st...
Easy
6.2M
11.2M
6,166,143
11,225,960
54.9%
['maximum-subarray', 'best-time-to-buy-and-sell-stock-ii', 'best-time-to-buy-and-sell-stock-iii', 'best-time-to-buy-and-sell-stock-iv', 'best-time-to-buy-and-sell-stock-with-cooldown', 'sum-of-beauty-in-the-array', 'maximum-difference-between-increasing-elements', 'maximum-profit-from-trading-stocks']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxProfit(vector<int>& prices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxProfit(int[] prices) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC...
[7,1,5,3,6,4]
{ "name": "maxProfit", "params": [ { "name": "prices", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
122
Best Time to Buy and Sell Stock II
best-time-to-buy-and-sell-stock-ii
<p>You are given an integer array <code>prices</code> where <code>prices[i]</code> is the price of a given stock on the <code>i<sup>th</sup></code> day.</p> <p>On each day, you may decide to buy and/or sell the stock. You can only hold <strong>at most one</strong> share of the stock at any time. However, you can buy i...
Medium
2.4M
3.5M
2,444,167
3,537,471
69.1%
['best-time-to-buy-and-sell-stock', 'best-time-to-buy-and-sell-stock-iii', 'best-time-to-buy-and-sell-stock-iv', 'best-time-to-buy-and-sell-stock-with-cooldown', 'best-time-to-buy-and-sell-stock-with-transaction-fee', 'maximum-profit-from-trading-stocks']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxProfit(vector<int>& prices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxProfit(int[] prices) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC...
[7,1,5,3,6,4]
{ "name": "maxProfit", "params": [ { "name": "prices", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Greedy']
123
Best Time to Buy and Sell Stock III
best-time-to-buy-and-sell-stock-iii
<p>You are given an array <code>prices</code> where <code>prices[i]</code> is the price of a given stock on the <code>i<sup>th</sup></code> day.</p> <p>Find the maximum profit you can achieve. You may complete <strong>at most two transactions</strong>.</p> <p><strong>Note:</strong> You may not engage in multiple tran...
Hard
754.9K
1.5M
754,944
1,494,550
50.5%
['best-time-to-buy-and-sell-stock', 'best-time-to-buy-and-sell-stock-ii', 'best-time-to-buy-and-sell-stock-iv', 'maximum-sum-of-3-non-overlapping-subarrays', 'maximum-profit-from-trading-stocks', 'maximize-win-from-two-segments']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxProfit(vector<int>& prices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxProfit(int[] prices) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC...
[3,3,5,0,0,3,1,4]
{ "name": "maxProfit", "params": [ { "name": "prices", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
124
Binary Tree Maximum Path Sum
binary-tree-maximum-path-sum
<p>A <strong>path</strong> in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence <strong>at most once</strong>. Note that the path does not need to pass through the root.</p> <p>The <strong>path sum</strong> of a pa...
Hard
1.5M
3.7M
1,531,666
3,733,397
41.0%
['path-sum', 'sum-root-to-leaf-numbers', 'path-sum-iv', 'longest-univalue-path', 'time-needed-to-inform-all-employees', 'difference-between-maximum-and-minimum-price-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[1,2,3]
{ "name": "maxPathSum", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Dynamic Programming', 'Tree', 'Depth-First Search', 'Binary Tree']
125
Valid Palindrome
valid-palindrome
<p>A phrase is a <strong>palindrome</strong> if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers.</p> <p>Given a string <code>s</code>, return <code>true</code><em> if...
Easy
4.1M
8.1M
4,072,539
8,071,065
50.5%
['palindrome-linked-list', 'valid-palindrome-ii', 'maximum-product-of-the-length-of-two-palindromic-subsequences', 'find-first-palindromic-string-in-the-array', 'valid-palindrome-iv', 'maximum-palindromes-after-operations']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isPalindrome(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isPalindrome(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode"...
"A man, a plan, a canal: Panama"
{ "name": "isPalindrome", "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...
['Two Pointers', 'String']
126
Word Ladder II
word-ladder-ii
<p>A <strong>transformation sequence</strong> from word <code>beginWord</code> to word <code>endWord</code> using a dictionary <code>wordList</code> is a sequence of words <code>beginWord -&gt; s<sub>1</sub> -&gt; s<sub>2</sub> -&gt; ... -&gt; s<sub>k</sub></code> such that:</p> <ul> <li>Every adjacent pair of words ...
Hard
403.5K
1.5M
403,483
1,487,089
27.1%
['word-ladder', 'groups-of-strings']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<string>> findLadders(string beginWord, string endWord, vector<string>& wordList) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<String>> findLadders(String be...
"hit" "cog" ["hot","dot","dog","lot","log","cog"]
{ "name": "findLadders", "params": [ { "name": "beginWord", "type": "string" }, { "name": "endWord", "type": "string" }, { "name": "wordList", "type": "list<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...
['Hash Table', 'String', 'Backtracking', 'Breadth-First Search']
127
Word Ladder
word-ladder
<p>A <strong>transformation sequence</strong> from word <code>beginWord</code> to word <code>endWord</code> using a dictionary <code>wordList</code> is a sequence of words <code>beginWord -&gt; s<sub>1</sub> -&gt; s<sub>2</sub> -&gt; ... -&gt; s<sub>k</sub></code> such that:</p> <ul> <li>Every adjacent pair of words ...
Hard
1.3M
3.1M
1,310,978
3,107,096
42.2%
['word-ladder-ii', 'minimum-genetic-mutation', 'words-within-two-edits-of-dictionary']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int ladderLength(string beginWord, string endWord, vector<string>& wordList) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int ladderLength(String beginWord, String endWord, List<St...
"hit" "cog" ["hot","dot","dog","lot","log","cog"]
{ "name": "ladderLength", "params": [ { "name": "beginWord", "type": "string" }, { "name": "endWord", "type": "string" }, { "name": "wordList", "type": "list<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']
128
Longest Consecutive Sequence
longest-consecutive-sequence
<p>Given an unsorted array of integers <code>nums</code>, return <em>the length of the longest consecutive elements sequence.</em></p> <p>You must write an algorithm that runs in&nbsp;<code>O(n)</code>&nbsp;time.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> nums ...
Medium
2.4M
5.2M
2,444,676
5,187,522
47.1%
['binary-tree-longest-consecutive-sequence', 'find-three-consecutive-integers-that-sum-to-a-given-number', 'maximum-consecutive-floors-without-special-floors', 'length-of-the-longest-alphabetical-continuous-substring', 'find-the-maximum-number-of-elements-in-subset']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestConsecutive(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestConsecutive(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Pyth...
[100,4,200,1,3,2]
{ "name": "longestConsecutive", "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', 'Union Find']
129
Sum Root to Leaf Numbers
sum-root-to-leaf-numbers
<p>You are given the <code>root</code> of a binary tree containing digits from <code>0</code> to <code>9</code> only.</p> <p>Each root-to-leaf path in the tree represents a number.</p> <ul> <li>For example, the root-to-leaf path <code>1 -&gt; 2 -&gt; 3</code> represents the number <code>123</code>.</li> </ul> <p>Re...
Medium
1.1M
1.6M
1,077,988
1,581,841
68.1%
['path-sum', 'binary-tree-maximum-path-sum', 'smallest-string-starting-from-leaf']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[1,2,3]
{ "name": "sumNumbers", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Binary Tree']
130
Surrounded Regions
surrounded-regions
<p>You are given an <code>m x n</code> matrix <code>board</code> containing <strong>letters</strong> <code>&#39;X&#39;</code> and <code>&#39;O&#39;</code>, <strong>capture regions</strong> that are <strong>surrounded</strong>:</p> <ul> <li><strong>Connect</strong>: A cell is connected to adjacent cells horizontally o...
Medium
916.8K
2.2M
916,818
2,165,030
42.3%
['number-of-islands', 'walls-and-gates']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n void solve(vector<vector<char>>& board) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public void solve(char[][] board) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[["X","X","X","X"],["X","O","O","X"],["X","X","O","X"],["X","O","X","X"]]
{ "name": "solve", "params": [ { "name": "board", "type": "character[][]" } ], "return": { "type": "void" }, "output": { "paramindex": 0 } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix']
131
Palindrome Partitioning
palindrome-partitioning
<p>Given a string <code>s</code>, partition <code>s</code> such that every <span data-keyword="substring-nonempty">substring</span> of the partition is a <span data-keyword="palindrome-string"><strong>palindrome</strong></span>. Return <em>all possible palindrome partitioning of </em><code>s</code>.</p> <p>&nbsp;</p> ...
Medium
1.1M
1.5M
1,082,287
1,510,973
71.6%
['palindrome-partitioning-ii', 'palindrome-partitioning-iv', 'maximum-number-of-non-overlapping-palindrome-substrings']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<string>> partition(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<String>> partition(String s) {\n \n }\n}"}, {"value": "python", "text": ...
"aab"
{ "name": "partition", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "list<list<string>>", "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...
['String', 'Dynamic Programming', 'Backtracking']
132
Palindrome Partitioning II
palindrome-partitioning-ii
<p>Given a string <code>s</code>, partition <code>s</code> such that every <span data-keyword="substring-nonempty">substring</span> of the partition is a <span data-keyword="palindrome-string">palindrome</span>.</p> <p>Return <em>the <strong>minimum</strong> cuts needed for a palindrome partitioning of</em> <code>s</c...
Hard
329.9K
942.7K
329,856
942,660
35.0%
['palindrome-partitioning', 'palindrome-partitioning-iv', 'maximum-number-of-non-overlapping-palindrome-substrings', 'number-of-great-partitions']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minCut(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minCut(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solution...
"aab"
{ "name": "minCut", "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']
133
Clone Graph
clone-graph
<p>Given a reference of a node in a <strong><a href="https://en.wikipedia.org/wiki/Connectivity_(graph_theory)#Connected_graph" target="_blank">connected</a></strong> undirected graph.</p> <p>Return a <a href="https://en.wikipedia.org/wiki/Object_copying#Deep_copy" target="_blank"><strong>deep copy</strong></a> (clone...
Medium
1.5M
2.5M
1,541,557
2,501,938
61.6%
['copy-list-with-random-pointer', 'clone-binary-tree-with-random-pointer', 'clone-n-ary-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/*\n// Definition for a Node.\nclass Node {\npublic:\n int val;\n vector<Node*> neighbors;\n Node() {\n val = 0;\n neighbors = vector<Node*>();\n }\n Node(int _val) {\n val = _val;\n neighbors = vector<Node*>();\n }\n Node...
[[2,4],[1,3],[2,4],[1,3]]
{ "name": "cloneGraph", "params": [ { "name": "edges", "type": "integer[][]" } ], "return": { "type": "boolean" }, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3", "golang", "swift", "kotlin", "ruby", "c", "sca...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Depth-First Search', 'Breadth-First Search', 'Graph']
134
Gas Station
gas-station
<p>There are <code>n</code> gas stations along a circular route, where the amount of gas at the <code>i<sup>th</sup></code> station is <code>gas[i]</code>.</p> <p>You have a car with an unlimited gas tank and it costs <code>cost[i]</code> of gas to travel from the <code>i<sup>th</sup></code> station to its next <code>...
Medium
1.1M
2.3M
1,061,734
2,303,048
46.1%
['maximize-the-topmost-element-after-k-moves']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int canCompleteCircuit(vector<int>& gas, vector<int>& cost) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int canCompleteCircuit(int[] gas, int[] cost) {\n \n }\n}"}, {"va...
[1,2,3,4,5] [3,4,5,1,2]
{ "name": "canCompleteCircuit", "params": [ { "name": "gas", "type": "integer[]" }, { "name": "cost", "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']
135
Candy
candy
<p>There are <code>n</code> children standing in a line. Each child is assigned a rating value given in the integer array <code>ratings</code>.</p> <p>You are giving candies to these children subjected to the following requirements:</p> <ul> <li>Each child must have at least one candy.</li> <li>Children with a high...
Hard
726.3K
1.6M
726,275
1,631,640
44.5%
['minimize-maximum-value-in-a-grid', 'minimum-number-of-operations-to-satisfy-conditions', 'check-if-grid-satisfies-conditions']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int candy(vector<int>& ratings) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int candy(int[] ratings) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ...
[1,0,2]
{ "name": "candy", "params": [ { "name": "ratings", "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']
136
Single Number
single-number
<p>Given a <strong>non-empty</strong>&nbsp;array of integers <code>nums</code>, every element appears <em>twice</em> except for one. Find that single one.</p> <p>You must&nbsp;implement a solution with a linear runtime complexity and use&nbsp;only constant&nbsp;extra space.</p> <p>&nbsp;</p> <p><strong class="example...
Easy
3.6M
4.7M
3,571,883
4,726,735
75.6%
['single-number-ii', 'single-number-iii', 'missing-number', 'find-the-duplicate-number', 'find-the-difference', 'find-the-xor-of-numbers-which-appear-twice']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int singleNumber(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int singleNumber(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[2,2,1]
{ "name": "singleNumber", "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', 'Bit Manipulation']
137
Single Number II
single-number-ii
<p>Given an integer array <code>nums</code> where&nbsp;every element appears <strong>three times</strong> except for one, which appears <strong>exactly once</strong>. <em>Find the single element and return it</em>.</p> <p>You must&nbsp;implement a solution with a linear runtime complexity and use&nbsp;only constant&nb...
Medium
717.6K
1.1M
717,553
1,106,074
64.9%
['single-number', 'single-number-iii', 'find-the-xor-of-numbers-which-appear-twice']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int singleNumber(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int singleNumber(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[2,2,3,2]
{ "name": "singleNumber", "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', 'Bit Manipulation']
138
Copy List with Random Pointer
copy-list-with-random-pointer
<p>A linked list of length <code>n</code> is given such that each node contains an additional random pointer, which could point to any node in the list, or <code>null</code>.</p> <p>Construct a <a href="https://en.wikipedia.org/wiki/Object_copying#Deep_copy" target="_blank"><strong>deep copy</strong></a> of the list. ...
Medium
1.6M
2.6M
1,561,342
2,607,400
59.9%
['clone-graph', 'clone-binary-tree-with-random-pointer', 'clone-n-ary-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/*\n// Definition for a Node.\nclass Node {\npublic:\n int val;\n Node* next;\n Node* random;\n \n Node(int _val) {\n val = _val;\n next = NULL;\n random = NULL;\n }\n};\n*/\n\nclass Solution {\npublic:\n Node* copyRandomList(Nod...
[[7,null],[13,0],[11,4],[10,2],[1,0]]
{ "name": "copyRandomList", "params": [ { "name": "head", "type": "ListNode" } ], "return": { "type": "ListNode" }, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3", "golang", "swift", "kotlin", "ruby", "c", "sc...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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']
139
Word Break
word-break
<p>Given a string <code>s</code> and a dictionary of strings <code>wordDict</code>, return <code>true</code> if <code>s</code> can be segmented into a space-separated sequence of one or more dictionary words.</p> <p><strong>Note</strong> that the same word in the dictionary may be reused multiple times in the segmenta...
Medium
2M
4.2M
2,007,166
4,179,628
48.0%
['word-break-ii', 'extra-characters-in-a-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool wordBreak(string s, vector<string>& wordDict) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean wordBreak(String s, List<String> wordDict) {\n \n }\n}"}, {"value"...
"leetcode" ["leet","code"]
{ "name": "wordBreak", "params": [ { "name": "s", "type": "string" }, { "name": "wordDict", "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', 'Hash Table', 'String', 'Dynamic Programming', 'Trie', 'Memoization']
140
Word Break II
word-break-ii
<p>Given a string <code>s</code> and a dictionary of strings <code>wordDict</code>, add spaces in <code>s</code> to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in <strong>any order</strong>.</p> <p><strong>Note</strong> that the same word in the dictionary may be...
Hard
733.9K
1.4M
733,883
1,379,863
53.2%
['word-break', 'concatenated-words']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> wordBreak(string s, vector<string>& wordDict) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> wordBreak(String s, List<String> wordDict) {\n \n }...
"catsanddog" ["cat","cats","and","sand","dog"]
{ "name": "wordBreak", "params": [ { "name": "s", "type": "string" }, { "name": "wordDict", "type": "list<string>" } ], "return": { "type": "list<string>", "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', 'String', 'Dynamic Programming', 'Backtracking', 'Trie', 'Memoization']
141
Linked List Cycle
linked-list-cycle
<p>Given <code>head</code>, the head of a linked list, determine if the linked list has a cycle in it.</p> <p>There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the&nbsp;<code>next</code>&nbsp;pointer. Internally, <code>pos</code>&nbsp;is used to den...
Easy
3.8M
7.3M
3,802,205
7,286,384
52.2%
['linked-list-cycle-ii', 'happy-number']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode(int x) : val(x), next(NULL) {}\n * };\n */\nclass Solution {\npublic:\n bool hasCycle(ListNode *head) {\n \n }\n};"}, {"value": "java",...
[3,2,0,-4] 1
{ "name": "hasCycle", "params": [ { "name": "head", "type": "ListNode" }, { "name": "pos", "type": "integer" } ], "return": { "type": "boolean" }, "manual": true, "languages": [ "cpp", "java", "python", "c", "csharp", "javascript", "r...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Linked List', 'Two Pointers']
142
Linked List Cycle II
linked-list-cycle-ii
<p>Given the <code>head</code> of a linked list, return <em>the node where the cycle begins. If there is no cycle, return </em><code>null</code>.</p> <p>There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the <code>next</code> pointer. Internally, <co...
Medium
1.6M
2.9M
1,588,130
2,923,673
54.3%
['linked-list-cycle', 'find-the-duplicate-number']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode(int x) : val(x), next(NULL) {}\n * };\n */\nclass Solution {\npublic:\n ListNode *detectCycle(ListNode *head) {\n \n }\n};"}, {"value":...
[3,2,0,-4] 1
{ "name": "detectCycle", "params": [ { "name": "head", "type": "ListNode" }, { "name": "pos", "type": "integer" } ], "return": { "type": "ListNode" }, "languages": [ "cpp", "java", "python", "c", "csharp", "javascript", "golang", "p...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Two Pointers']
143
Reorder List
reorder-list
<p>You are given the head of a singly linked-list. The list can be represented as:</p> <pre> L<sub>0</sub> &rarr; L<sub>1</sub> &rarr; &hellip; &rarr; L<sub>n - 1</sub> &rarr; L<sub>n</sub> </pre> <p><em>Reorder the list to be on the following form:</em></p> <pre> L<sub>0</sub> &rarr; L<sub>n</sub> &rarr; L<sub>1</s...
Medium
1.2M
2M
1,210,959
1,955,663
61.9%
['delete-the-middle-node-of-a-linked-list', 'take-k-of-each-character-from-left-and-right']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ...
[1,2,3,4]
{ "name": "reorderList", "params": [ { "name": "head", "type": "ListNode" } ], "return": { "type": "void" }, "output": { "paramindex": 0 } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List', 'Two Pointers', 'Stack', 'Recursion']
144
Binary Tree Preorder Traversal
binary-tree-preorder-traversal
<p>Given the <code>root</code> of a binary tree, return <em>the preorder traversal of its nodes&#39; values</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <div class="example-block"> <p><strong>Input:</strong> <span class="example-io">root = [1,null,2,3]</span></p> <p><strong>Output:</str...
Easy
2M
2.7M
1,973,399
2,716,823
72.6%
['binary-tree-inorder-traversal', 'verify-preorder-sequence-in-binary-search-tree', 'n-ary-tree-preorder-traversal', 'kth-largest-sum-in-a-binary-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[1,null,2,3]
{ "name": "preorderTraversal", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "list<integer>", "dealloc": true } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Stack', 'Tree', 'Depth-First Search', 'Binary Tree']
145
Binary Tree Postorder Traversal
binary-tree-postorder-traversal
<p>Given the <code>root</code> of a&nbsp;binary tree, return <em>the postorder traversal of its nodes&#39; values</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <div class="example-block"> <p><strong>Input:</strong> <span class="example-io">root = [1,null,2,3]</span></p> <p><strong>Output...
Easy
1.6M
2.1M
1,585,459
2,108,576
75.2%
['binary-tree-inorder-traversal', 'n-ary-tree-postorder-traversal', 'minimum-fuel-cost-to-report-to-the-capital']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[1,null,2,3]
{ "name": "postorderTraversal", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "list<integer>", "dealloc": true } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Stack', 'Tree', 'Depth-First Search', 'Binary Tree']
146
LRU Cache
lru-cache
<p>Design a data structure that follows the constraints of a <strong><a href="https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU" target="_blank">Least Recently Used (LRU) cache</a></strong>.</p> <p>Implement the <code>LRUCache</code> class:</p> <ul> <li><code>LRUCache(int capacity)</code> Initialize the L...
Medium
2M
4.6M
2,040,940
4,563,711
44.7%
['lfu-cache', 'design-in-memory-file-system', 'design-compressed-string-iterator', 'design-most-recently-used-queue']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class LRUCache {\npublic:\n LRUCache(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 LRUCache object will be instantiated and called as such:\n * LRUCache* o...
["LRUCache","put","put","get","put","get","put","get","get","get"] [[2],[1,1],[2,2],[1],[3,3],[2],[4,4],[1],[3],[4]]
{ "classname": "LRUCache", "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']
147
Insertion Sort List
insertion-sort-list
<p>Given the <code>head</code> of a singly linked list, sort the list using <strong>insertion sort</strong>, and return <em>the sorted list&#39;s head</em>.</p> <p>The steps of the <strong>insertion sort</strong> algorithm:</p> <ol> <li>Insertion sort iterates, consuming one input element each repetition and growing...
Medium
419.8K
749.4K
419,780
749,379
56.0%
['sort-list', 'insert-into-a-sorted-circular-linked-list']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ...
[4,2,1,3]
{ "name": "insertionSortList", "params": [ { "name": "head", "type": "ListNode", "dealloc": false } ], "return": { "type": "ListNode", "dealloc": true } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List', 'Sorting']
148
Sort List
sort-list
<p>Given the <code>head</code> of a linked list, return <em>the list after sorting it in <strong>ascending order</strong></em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" src="https://assets.leetcode.com/uploads/2020/09/14/sort_list_1.jpg" style="width: 450px; height: 194px;" /> <...
Medium
1M
1.6M
1,000,903
1,635,511
61.2%
['merge-two-sorted-lists', 'sort-colors', 'insertion-sort-list', 'sort-linked-list-already-sorted-using-absolute-values']
[]
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 * ...
[4,2,1,3]
{ "name": "sortList", "params": [ { "name": "head", "type": "ListNode", "dealloc": false } ], "return": { "type": "ListNode", "dealloc": true } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List', 'Two Pointers', 'Divide and Conquer', 'Sorting', 'Merge Sort']
149
Max Points on a Line
max-points-on-a-line
<p>Given an array of <code>points</code> where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> represents a point on the <strong>X-Y</strong> plane, return <em>the maximum number of points that lie on the same straight line</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" ...
Hard
454.1K
1.6M
454,101
1,586,697
28.6%
['line-reflection', 'minimum-number-of-lines-to-cover-points', 'minimum-lines-to-represent-a-line-chart', 'count-special-subsequences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxPoints(vector<vector<int>>& points) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxPoints(int[][] points) {\n \n }\n}"}, {"value": "python", "text": "Python",...
[[1,1],[2,2],[3,3]]
{ "name": "maxPoints", "params": [ { "name": "points", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Math', 'Geometry']
150
Evaluate Reverse Polish Notation
evaluate-reverse-polish-notation
<p>You are given an array of strings <code>tokens</code> that represents an arithmetic expression in a <a href="http://en.wikipedia.org/wiki/Reverse_Polish_notation" target="_blank">Reverse Polish Notation</a>.</p> <p>Evaluate the expression. Return <em>an integer that represents the value of the expression</em>.</p> ...
Medium
1.3M
2.5M
1,343,131
2,469,704
54.4%
['basic-calculator', 'expression-add-operators']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int evalRPN(vector<string>& tokens) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int evalRPN(String[] tokens) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
["2","1","+","3","*"]
{ "name": "evalRPN", "params": [ { "name": "tokens", "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', 'Math', 'Stack']
151
Reverse Words in a String
reverse-words-in-a-string
<p>Given an input string <code>s</code>, reverse the order of the <strong>words</strong>.</p> <p>A <strong>word</strong> is defined as a sequence of non-space characters. The <strong>words</strong> in <code>s</code> will be separated by at least one space.</p> <p>Return <em>a string of the words in reverse order conc...
Medium
2.3M
4.4M
2,255,505
4,438,750
50.8%
['reverse-words-in-a-string-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string reverseWords(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String reverseWords(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode...
"the sky is blue"
{ "name": "reverseWords", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Two Pointers', 'String']
152
Maximum Product Subarray
maximum-product-subarray
<p>Given an integer array <code>nums</code>, find a <span data-keyword="subarray-nonempty">subarray</span> that has the largest product, and return <em>the product</em>.</p> <p>The test cases are generated so that the answer will fit in a <strong>32-bit</strong> integer.</p> <p>&nbsp;</p> <p><strong class="example">E...
Medium
1.6M
4.6M
1,586,220
4,574,804
34.7%
['maximum-subarray', 'house-robber', 'product-of-array-except-self', 'maximum-product-of-three-numbers', 'subarray-product-less-than-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxProduct(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxProduct(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[2,3,-2,4]
{ "name": "maxProduct", "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']
153
Find Minimum in Rotated Sorted Array
find-minimum-in-rotated-sorted-array
<p>Suppose an array of length <code>n</code> sorted in ascending order is <strong>rotated</strong> between <code>1</code> and <code>n</code> times. For example, the array <code>nums = [0,1,2,4,5,6,7]</code> might become:</p> <ul> <li><code>[4,5,6,7,0,1,2]</code> if it was rotated <code>4</code> times.</li> <li><code...
Medium
2.3M
4.5M
2,344,592
4,480,301
52.3%
['search-in-rotated-sorted-array', 'find-minimum-in-rotated-sorted-array-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMin(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMin(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "c...
[3,4,5,1,2]
{ "name": "findMin", "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']
154
Find Minimum in Rotated Sorted Array II
find-minimum-in-rotated-sorted-array-ii
<p>Suppose an array of length <code>n</code> sorted in ascending order is <strong>rotated</strong> between <code>1</code> and <code>n</code> times. For example, the array <code>nums = [0,1,4,4,5,6,7]</code> might become:</p> <ul> <li><code>[4,5,6,7,0,1,4]</code> if it was rotated <code>4</code> times.</li> <li><code...
Hard
518.9K
1.2M
518,867
1,178,132
44.0%
['find-minimum-in-rotated-sorted-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMin(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMin(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "c...
[1,3,5]
{ "name": "findMin", "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']
155
Min Stack
min-stack
<p>Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.</p> <p>Implement the <code>MinStack</code> class:</p> <ul> <li><code>MinStack()</code> initializes the stack object.</li> <li><code>void push(int val)</code> pushes the element <code>val</code> onto the stack.</li> ...
Medium
2.1M
3.8M
2,119,793
3,777,710
56.1%
['sliding-window-maximum', 'max-stack']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class MinStack {\npublic:\n MinStack() {\n \n }\n \n void push(int val) {\n \n }\n \n void pop() {\n \n }\n \n int top() {\n \n }\n \n int getMin() {\n \n }\n};\n\n/**\n * Your MinStack object w...
["MinStack","push","push","push","getMin","pop","top","getMin"] [[],[-2],[0],[-3],[],[],[],[]]
{ "classname": "MinStack", "constructor": { "params": [] }, "methods": [ { "params": [ { "type": "integer", "name": "val" } ], "return": { "type": "void" }, "name": "push" }, { "params": [], "return": { ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Stack', 'Design']
156
Binary Tree Upside Down
binary-tree-upside-down
null
Medium
110.9K
172.5K
110,925
172,534
64.3%
['reverse-linked-list']
[]
Algorithms
null
[1,2,3,4,5]
{ "name": "upsideDownBinaryTree", "params": [ { "name": "root", "type": "TreeNode", "dealloc": false } ], "return": { "type": "TreeNode", "dealloc": true }, "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...
['Tree', 'Depth-First Search', 'Binary Tree']
157
Read N Characters Given Read4
read-n-characters-given-read4
null
Easy
201.3K
477.6K
201,264
477,619
42.1%
['read-n-characters-given-read4-ii-call-multiple-times']
[]
Algorithms
null
"abc" 4
{ "name": "read", "params": [ { "name": "file", "type": "string" }, { "name": "n", "type": "integer" } ], "return": { "type": "string" }, "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...
['Array', 'Simulation', 'Interactive']
158
Read N Characters Given read4 II - Call Multiple Times
read-n-characters-given-read4-ii-call-multiple-times
null
Hard
190.6K
445.5K
190,648
445,495
42.8%
['read-n-characters-given-read4']
[]
Algorithms
null
"abc" [1,2,1]
{ "name": "read", "params": [ { "name": "file", "type": "string" }, { "name": "queries", "type": "integer[]" } ], "return": { "type": "list<string>", "dealloc": true }, "manual": true, "languages": [ "cpp", "java", "python", "c", "csharp"...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Simulation', 'Interactive']
159
Longest Substring with At Most Two Distinct Characters
longest-substring-with-at-most-two-distinct-characters
null
Medium
279.8K
498.1K
279,754
498,064
56.2%
['longest-substring-without-repeating-characters', 'sliding-window-maximum', 'longest-substring-with-at-most-k-distinct-characters', 'subarrays-with-k-different-integers']
[]
Algorithms
null
"eceba"
{ "name": "lengthOfLongestSubstringTwoDistinct", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Sliding Window']
160
Intersection of Two Linked Lists
intersection-of-two-linked-lists
<p>Given the heads of two singly linked-lists <code>headA</code> and <code>headB</code>, return <em>the node at which the two lists intersect</em>. If the two linked lists have no intersection at all, return <code>null</code>.</p> <p>For example, the following two linked lists begin to intersect at node <code>c1</code...
Easy
1.9M
3.2M
1,918,537
3,167,941
60.6%
['minimum-index-sum-of-two-lists']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode(int x) : val(x), next(NULL) {}\n * };\n */\nclass Solution {\npublic:\n ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {\n ...
8 [4,1,8,4,5] [5,6,1,8,4,5] 2 3
{ "name": "getIntersectionNode", "params": [ { "name": "intersectVal", "type": "integer" }, { "name": "listA", "type": "ListNode" }, { "name": "listB", "type": "ListNode" }, { "name": "skipA", "type": "integer" }, { "name": "s...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Linked List', 'Two Pointers']
161
One Edit Distance
one-edit-distance
null
Medium
223.4K
648.1K
223,365
648,149
34.5%
['edit-distance']
[]
Algorithms
null
"ab" "acb"
{ "name": "isOneEditDistance", "params": [ { "name": "s", "type": "string" }, { "name": "t", "type": "string" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Two Pointers', 'String']
162
Find Peak Element
find-peak-element
<p>A peak element is an element that is strictly greater than its neighbors.</p> <p>Given a <strong>0-indexed</strong> integer array <code>nums</code>, find a peak element, and return its index. If the array contains multiple peaks, return the index to <strong>any of the peaks</strong>.</p> <p>You may imagine that <c...
Medium
1.9M
4M
1,857,558
4,003,327
46.4%
['peak-index-in-a-mountain-array', 'find-a-peak-element-ii', 'pour-water-between-buckets-to-make-water-levels-equal', 'count-hills-and-valleys-in-an-array', 'find-the-peaks']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findPeakElement(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findPeakElement(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[1,2,3,1]
{ "name": "findPeakElement", "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']
163
Missing Ranges
missing-ranges
null
Easy
285.5K
813.7K
285,486
813,718
35.1%
['summary-ranges', 'find-maximal-uncovered-ranges']
[]
Algorithms
null
[0,1,3,50,75] 0 99
{ "name": "findMissingRanges", "params": [ { "name": "nums", "type": "integer[]" }, { "name": "lower", "type": "integer" }, { "name": "upper", "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']
164
Maximum Gap
maximum-gap
<p>Given an integer array <code>nums</code>, return <em>the maximum difference between two successive elements in its sorted form</em>. If the array contains less than two elements, return <code>0</code>.</p> <p>You must write an algorithm that runs in linear time and uses linear extra space.</p> <p>&nbsp;</p> <p><st...
Medium
266.2K
545.1K
266,175
545,076
48.8%
['widest-vertical-area-between-two-points-containing-no-points', 'maximum-consecutive-floors-without-special-floors']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumGap(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumGap(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[3,6,9,1]
{ "name": "maximumGap", "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', 'Bucket Sort', 'Radix Sort']
165
Compare Version Numbers
compare-version-numbers
<p>Given two <strong>version strings</strong>, <code>version1</code> and <code>version2</code>, compare them. A version string consists of <strong>revisions</strong> separated by dots <code>&#39;.&#39;</code>. The <strong>value of the revision</strong> is its <strong>integer conversion</strong> ignoring leading zeros.<...
Medium
539.7K
1.3M
539,673
1,282,305
42.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int compareVersion(string version1, string version2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int compareVersion(String version1, String version2) {\n \n }\n}"}, {"va...
"1.2" "1.10"
{ "name": "compareVersion", "params": [ { "name": "version1", "type": "string" }, { "name": "version2", "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...
['Two Pointers', 'String']
166
Fraction to Recurring Decimal
fraction-to-recurring-decimal
<p>Given two integers representing the <code>numerator</code> and <code>denominator</code> of a fraction, return <em>the fraction in string format</em>.</p> <p>If the fractional part is repeating, enclose the repeating part in parentheses.</p> <p>If multiple answers are possible, return <strong>any of them</strong>.<...
Medium
251.6K
967.2K
251,562
967,239
26.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string fractionToDecimal(int numerator, int denominator) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String fractionToDecimal(int numerator, int denominator) {\n \n }\n}...
1 2
{ "name": "fractionToDecimal", "params": [ { "name": "numerator", "type": "integer" }, { "name": "denominator", "type": "integer" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Math', 'String']
167
Two Sum II - Input Array Is Sorted
two-sum-ii-input-array-is-sorted
<p>Given a <strong>1-indexed</strong> array of integers <code>numbers</code> that is already <strong><em>sorted in non-decreasing order</em></strong>, find two numbers such that they add up to a specific <code>target</code> number. Let these two numbers be <code>numbers[index<sub>1</sub>]</code> and <code>numbers[index...
Medium
2.6M
4.1M
2,616,307
4,148,766
63.1%
['two-sum', 'two-sum-iv-input-is-a-bst', 'two-sum-less-than-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> twoSum(vector<int>& numbers, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] twoSum(int[] numbers, int target) {\n \n }\n}"}, {"value": "python...
[2,7,11,15] 9
{ "name": "twoSum", "params": [ { "name": "numbers", "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', 'Two Pointers', 'Binary Search']
168
Excel Sheet Column Title
excel-sheet-column-title
<p>Given an integer <code>columnNumber</code>, return <em>its corresponding column title as it appears in an Excel sheet</em>.</p> <p>For example:</p> <pre> A -&gt; 1 B -&gt; 2 C -&gt; 3 ... Z -&gt; 26 AA -&gt; 27 AB -&gt; 28 ... </pre> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong...
Easy
614K
1.4M
614,033
1,425,322
43.1%
['excel-sheet-column-number', 'cells-in-a-range-on-an-excel-sheet', 'design-spreadsheet']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string convertToTitle(int columnNumber) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String convertToTitle(int columnNumber) {\n \n }\n}"}, {"value": "python", "text": "P...
1
{ "name": "convertToTitle", "params": [ { "name": "columnNumber", "type": "integer" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'String']
169
Majority Element
majority-element
<p>Given an array <code>nums</code> of size <code>n</code>, return <em>the majority element</em>.</p> <p>The majority element is the element that appears more than <code>&lfloor;n / 2&rfloor;</code> times. You may assume that the majority element always exists in the array.</p> <p>&nbsp;</p> <p><strong class="example...
Easy
4.1M
6.3M
4,116,357
6,277,583
65.6%
['majority-element-ii', 'check-if-a-number-is-majority-element-in-a-sorted-array', 'most-frequent-even-element', 'minimum-index-of-a-valid-split', 'minimum-operations-to-exceed-threshold-value-i', 'find-valid-pair-of-adjacent-digits-in-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int majorityElement(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int majorityElement(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[3,2,3]
{ "name": "majorityElement", "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', 'Divide and Conquer', 'Sorting', 'Counting']
170
Two Sum III - Data structure design
two-sum-iii-data-structure-design
null
Easy
168K
435.2K
167,981
435,159
38.6%
['two-sum', 'unique-word-abbreviation', 'two-sum-iv-input-is-a-bst']
[]
Algorithms
null
["TwoSum","add","add","add","find","find"] [[],[1],[3],[5],[4],[7]]
{ "classname": "TwoSum", "constructor": { "params": [] }, "methods": [ { "params": [ { "type": "integer", "name": "number" } ], "return": { "type": "void" }, "name": "add" }, { "params": [ { "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', 'Two Pointers', 'Design', 'Data Stream']
171
Excel Sheet Column Number
excel-sheet-column-number
<p>Given a string <code>columnTitle</code> that represents the column title as appears in an Excel sheet, return <em>its corresponding column number</em>.</p> <p>For example:</p> <pre> A -&gt; 1 B -&gt; 2 C -&gt; 3 ... Z -&gt; 26 AA -&gt; 27 AB -&gt; 28 ... </pre> <p>&nbsp;</p> <p><strong class="example">Example 1:...
Easy
777.2K
1.2M
777,235
1,187,859
65.4%
['excel-sheet-column-title', 'cells-in-a-range-on-an-excel-sheet']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int titleToNumber(string columnTitle) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int titleToNumber(String columnTitle) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
"A"
{ "name": "titleToNumber", "params": [ { "name": "columnTitle", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'String']
172
Factorial Trailing Zeroes
factorial-trailing-zeroes
<p>Given an integer <code>n</code>, return <em>the number of trailing zeroes in </em><code>n!</code>.</p> <p>Note that <code>n! = n * (n - 1) * (n - 2) * ... * 3 * 2 * 1</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> n = 3 <strong>Output:</strong> 0 <strong...
Medium
544.5K
1.2M
544,509
1,221,371
44.6%
['number-of-digit-one', 'preimage-size-of-factorial-zeroes-function', 'abbreviating-the-product-of-a-range', 'maximum-trailing-zeros-in-a-cornered-path']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int trailingZeroes(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int trailingZeroes(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "clas...
3
{ "name": "trailingZeroes", "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']
173
Binary Search Tree Iterator
binary-search-tree-iterator
<p>Implement the <code>BSTIterator</code> class that represents an iterator over the <strong><a href="https://en.wikipedia.org/wiki/Tree_traversal#In-order_(LNR)" target="_blank">in-order traversal</a></strong> of a binary search tree (BST):</p> <ul> <li><code>BSTIterator(TreeNode root)</code> Initializes an object o...
Medium
935.4K
1.3M
935,385
1,255,667
74.5%
['binary-tree-inorder-traversal', 'flatten-2d-vector', 'zigzag-iterator', 'peeking-iterator', 'inorder-successor-in-bst', 'binary-search-tree-iterator-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
["BSTIterator","next","next","hasNext","next","hasNext","next","hasNext","next","hasNext"] [[[7,3,15,null,null,9,20]],[],[],[],[],[],[],[],[],[]]
{ "classname": "BSTIterator", "maxbytesperline": 200000, "constructor": { "params": [ { "type": "TreeNode", "name": "root" } ] }, "methods": [ { "params": [], "name": "next", "return": { "type": "integer" } }, { "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...
['Stack', 'Tree', 'Design', 'Binary Search Tree', 'Binary Tree', 'Iterator']
174
Dungeon Game
dungeon-game
<p>The demons had captured the princess and imprisoned her in <strong>the bottom-right corner</strong> of a <code>dungeon</code>. The <code>dungeon</code> consists of <code>m x n</code> rooms laid out in a 2D grid. Our valiant knight was initially positioned in <strong>the top-left room</strong> and must fight his way ...
Hard
253.6K
646.2K
253,578
646,169
39.2%
['unique-paths', 'minimum-path-sum', 'cherry-pickup', 'minimum-path-cost-in-a-grid', 'minimum-health-to-beat-game', 'paths-in-matrix-whose-sum-is-divisible-by-k', 'check-if-there-is-a-path-with-equal-number-of-0s-and-1s']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int calculateMinimumHP(vector<vector<int>>& dungeon) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int calculateMinimumHP(int[][] dungeon) {\n \n }\n}"}, {"value": "python...
[[-2,-3,3],[-5,-10,1],[10,30,-5]]
{ "name": "calculateMinimumHP", "params": [ { "name": "dungeon", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Matrix']
175
Combine Two Tables
combine-two-tables
<p>Table: <code>Person</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | personId | int | | lastName | varchar | | firstName | varchar | +-------------+---------+ personId is the primary key (column with unique values) for this table. This table contains infor...
Easy
1.2M
1.6M
1,237,963
1,592,473
77.7%
['employee-bonus']
['Create table If Not Exists Person (personId int, firstName varchar(255), lastName varchar(255))', 'Create table If Not Exists Address (addressId int, personId int, city varchar(255), state varchar(255))', 'Truncate table Person', "insert into Person (personId, lastName, firstName) values ('1', 'Wang', 'Allen')", "ins...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers":{"Person":["personId","lastName","firstName"],"Address":["addressId","personId","city","state"]},"rows":{"Person":[[1,"Wang","Allen"],[2,"Alice","Bob"]],"Address":[[1,2,"New York City","New York"],[2,3,"Leetcode","California"]]}}
{"mysql": ["Create table If Not Exists Person (personId int, firstName varchar(255), lastName varchar(255))", "Create table If Not Exists Address (addressId int, personId int, city varchar(255), state varchar(255))"], "mssql": ["Create table Person (personId int, firstName varchar(255), lastName varchar(255))", "Create...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
176
Second Highest Salary
second-highest-salary
<p>Table: <code>Employee</code></p> <pre> +-------------+------+ | Column Name | Type | +-------------+------+ | id | int | | salary | int | +-------------+------+ id is the primary key (column with unique values) for this table. Each row of this table contains information about the salary of an employ...
Medium
1.1M
2.5M
1,101,106
2,545,903
43.3%
[]
['Create table If Not Exists Employee (id int, salary int)', 'Truncate table Employee', "insert into Employee (id, salary) values ('1', '100')", "insert into Employee (id, salary) values ('2', '200')", "insert into Employee (id, salary) values ('3', '300')"]
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers":{"Employee":["id","salary"]},"rows":{"Employee":[[1,100],[2,200],[3,300]]}}
{"mysql": ["Create table If Not Exists Employee (id int, salary int)"], "mssql": ["Create table Employee (id int, salary int)"], "oraclesql": ["Create table Employee (id int, salary int)"], "database": true, "name": "second_highest_salary", "pythondata": ["Employee = pd.DataFrame([], columns=['id', 'salary']).astype({'...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
177
Nth Highest Salary
nth-highest-salary
<p>Table: <code>Employee</code></p> <pre> +-------------+------+ | Column Name | Type | +-------------+------+ | id | int | | salary | int | +-------------+------+ id is the primary key (column with unique values) for this table. Each row of this table contains information about the salary of an employ...
Medium
474K
1.3M
474,047
1,251,723
37.9%
['the-number-of-users-that-are-eligible-for-discount']
['Create table If Not Exists Employee (Id int, Salary int)', 'Truncate table Employee', "insert into Employee (id, salary) values ('1', '100')", "insert into Employee (id, salary) values ('2', '200')", "insert into Employee (id, salary) values ('3', '300')"]
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT\nBEGIN\n RETURN (\n # Write your MySQL query statement below.\n\n );\nEND"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "CREATE FUNCTION getNthHighestSalary(@N INT) RETURNS INT AS\nBEGIN\n ...
{"headers": {"Employee": ["id", "salary"]}, "argument": 2, "rows": {"Employee": [[1, 100], [2, 200], [3, 300]]}}
{"mysql": ["Create table If Not Exists Employee (Id int, Salary int)"], "mssql": ["Create table Employee (Id int, Salary int)"], "oraclesql": ["Create table Employee (Id int, Salary int)"], "database": true, "manual": true, "name": "nth_highest_salary", "pythondata": ["Employee = pd.DataFrame([], columns=['Id', 'Salary...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
178
Rank Scores
rank-scores
<p>Table: <code>Scores</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | score | decimal | +-------------+---------+ id is the primary key (column with unique values) for this table. Each row of this table contains the score of a game. Scor...
Medium
476.3K
735.3K
476,305
735,251
64.8%
[]
['Create table If Not Exists Scores (id int, score DECIMAL(3,2))', 'Truncate table Scores', "insert into Scores (id, score) values ('1', '3.5')", "insert into Scores (id, score) values ('2', '3.65')", "insert into Scores (id, score) values ('3', '4.0')", "insert into Scores (id, score) values ('4', '3.85')", "insert in...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers": {"Scores": ["id", "score"]}, "rows": {"Scores": [[1, 3.50], [2, 3.65], [3, 4.00], [4, 3.85], [5, 4.00], [6, 3.65]]}}
{"mysql": ["Create table If Not Exists Scores (id int, score DECIMAL(3,2))"], "mssql": ["Create table Scores (id int, score DECIMAL(3,2))"], "oraclesql": ["Create table Scores (id int, score DECIMAL(3,2))"], "database": true, "name": "order_scores", "pythondata": ["Scores = pd.DataFrame([], columns=['id', 'score']).ast...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
179
Largest Number
largest-number
<p>Given a list of non-negative integers <code>nums</code>, arrange them such that they form the largest number and return it.</p> <p>Since the result may be very large, so you need to return a string instead of an integer.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</st...
Medium
705K
1.7M
705,026
1,719,695
41.0%
['smallest-value-of-the-rearranged-number', 'find-the-key-of-the-numbers']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string largestNumber(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String largestNumber(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",...
[10,2]
{ "name": "largestNumber", "params": [ { "name": "nums", "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', 'Greedy', 'Sorting']
180
Consecutive Numbers
consecutive-numbers
<p>Table: <code>Logs</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | num | varchar | +-------------+---------+ In SQL, id is the primary key for this table. id is an autoincrement column starting from 1. </pre> <p>&nbsp;</p> <p>Find a...
Medium
529K
1.2M
528,981
1,158,726
45.7%
[]
['Create table If Not Exists Logs (id int, num int)', 'Truncate table Logs', "insert into Logs (id, num) values ('1', '1')", "insert into Logs (id, num) values ('2', '1')", "insert into Logs (id, num) values ('3', '1')", "insert into Logs (id, num) values ('4', '2')", "insert into Logs (id, num) values ('5', '1')", "in...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers":{"Logs":["id","num"]},"rows":{"Logs":[[1,1],[2,1],[3,1],[4,2],[5,1],[6,2],[7,2]]}}
{"mysql": ["Create table If Not Exists Logs (id int, num int)"], "mssql": ["Create table Logs (id int, num int)"], "oraclesql": ["Create table Logs (id int, num int)"], "database": true, "name": "consecutive_numbers", "pythondata": ["Logs = pd.DataFrame([], columns=['id', 'num']).astype({'id':'Int64', 'num':'Int64'})"]...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
181
Employees Earning More Than Their Managers
employees-earning-more-than-their-managers
<p>Table: <code>Employee</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | name | varchar | | salary | int | | managerId | int | +-------------+---------+ id is the primary key (column with unique values) for this table. Eac...
Easy
784K
1.1M
783,967
1,100,973
71.2%
[]
['Create table If Not Exists Employee (id int, name varchar(255), salary int, managerId int)', 'Truncate table Employee', "insert into Employee (id, name, salary, managerId) values ('1', 'Joe', '70000', '3')", "insert into Employee (id, name, salary, managerId) values ('2', 'Henry', '80000', '4')", "insert into Employe...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers": {"Employee": ["id", "name", "salary", "managerId"]}, "rows": {"Employee": [[1, "Joe", 70000, 3], [2, "Henry", 80000, 4], [3, "Sam", 60000, null], [4, "Max", 90000, null]]}}
{"mysql": ["Create table If Not Exists Employee (id int, name varchar(255), salary int, managerId int)"], "mssql": ["Create table Employee (id int, name varchar(255), salary int, managerId int)"], "oraclesql": ["Create table Employee (id int, name varchar(255), salary int, managerId int)"], "database": true, "name": "f...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
182
Duplicate Emails
duplicate-emails
<p>Table: <code>Person</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | email | varchar | +-------------+---------+ id is the primary key (column with unique values) for this table. Each row of this table contains an email. The emails will...
Easy
816.6K
1.1M
816,564
1,130,857
72.2%
[]
['Create table If Not Exists Person (id int, email varchar(255))', 'Truncate table Person', "insert into Person (id, email) values ('1', '[email protected]')", "insert into Person (id, email) values ('2', '[email protected]')", "insert into Person (id, email) values ('3', '[email protected]')"]
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers": {"Person": ["id", "email"]}, "rows": {"Person": [[1, "[email protected]"], [2, "[email protected]"], [3, "[email protected]"]]}}
{"mysql": ["Create table If Not Exists Person (id int, email varchar(255))"], "mssql": ["Create table Person (id int, email varchar(255))"], "oraclesql": ["Create table Person (id int, email varchar(255))"], "database": true, "name": "duplicate_emails", "pythondata": ["Person = pd.DataFrame([], columns=['id', 'email'])...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
183
Customers Who Never Order
customers-who-never-order
<p>Table: <code>Customers</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | name | varchar | +-------------+---------+ id is the primary key (column with unique values) for this table. Each row of this table indicates the ID and name of a ...
Easy
971.7K
1.4M
971,704
1,379,694
70.4%
[]
['Create table If Not Exists Customers (id int, name varchar(255))', 'Create table If Not Exists Orders (id int, customerId int)', 'Truncate table Customers', "insert into Customers (id, name) values ('1', 'Joe')", "insert into Customers (id, name) values ('2', 'Henry')", "insert into Customers (id, name) values ('3', ...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers": {"Customers": ["id", "name"], "Orders": ["id", "customerId"]}, "rows": {"Customers": [[1, "Joe"], [2, "Henry"], [3, "Sam"], [4, "Max"]], "Orders": [[1, 3], [2, 1]]}}
{"mysql": ["Create table If Not Exists Customers (id int, name varchar(255))", "Create table If Not Exists Orders (id int, customerId int)"], "mssql": ["Create table Customers (id int, name varchar(255))", "Create table Orders (id int, customerId int)"], "oraclesql": ["Create table Customers (id int, name varchar(255))...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
184
Department Highest Salary
department-highest-salary
<p>Table: <code>Employee</code></p> <pre> +--------------+---------+ | Column Name | Type | +--------------+---------+ | id | int | | name | varchar | | salary | int | | departmentId | int | +--------------+---------+ id is the primary key (column with unique values) for this ta...
Medium
472.3K
872K
472,253
872,022
54.2%
['highest-grade-for-each-student']
['Create table If Not Exists Employee (id int, name varchar(255), salary int, departmentId int)', 'Create table If Not Exists Department (id int, name varchar(255))', 'Truncate table Employee', "insert into Employee (id, name, salary, departmentId) values ('1', 'Joe', '70000', '1')", "insert into Employee (id, name, sa...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers": {"Employee": ["id", "name", "salary", "departmentId"], "Department": ["id", "name"]}, "rows": {"Employee": [[1, "Joe", 70000, 1], [2, "Jim", 90000, 1], [3, "Henry", 80000, 2], [4, "Sam", 60000, 2], [5, "Max", 90000, 1]], "Department": [[1, "IT"], [2, "Sales"]]}}
{"mysql": ["Create table If Not Exists Employee (id int, name varchar(255), salary int, departmentId int)", "Create table If Not Exists Department (id int, name varchar(255))"], "mssql": ["Create table Employee (id int, name varchar(255), salary int, departmentId int)", "Create table Department (id int, name varchar(25...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
185
Department Top Three Salaries
department-top-three-salaries
<p>Table: <code>Employee</code></p> <pre> +--------------+---------+ | Column Name | Type | +--------------+---------+ | id | int | | name | varchar | | salary | int | | departmentId | int | +--------------+---------+ id is the primary key (column with unique values) for this ta...
Hard
465.2K
814.1K
465,207
814,076
57.1%
[]
['Create table If Not Exists Employee (id int, name varchar(255), salary int, departmentId int)', 'Create table If Not Exists Department (id int, name varchar(255))', 'Truncate table Employee', "insert into Employee (id, name, salary, departmentId) values ('1', 'Joe', '85000', '1')", "insert into Employee (id, name, sa...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers": {"Employee": ["id", "name", "salary", "departmentId"], "Department": ["id", "name"]}, "rows": {"Employee": [[1, "Joe", 85000, 1], [2, "Henry", 80000, 2], [3, "Sam", 60000, 2], [4, "Max", 90000, 1], [5, "Janet", 69000, 1], [6, "Randy", 85000, 1], [7, "Will", 70000, 1]], "Department": [[1, "IT"], [2, "Sales"]...
{"mysql": ["Create table If Not Exists Employee (id int, name varchar(255), salary int, departmentId int)", "Create table If Not Exists Department (id int, name varchar(255))"], "mssql": ["Create table Employee (id int, name varchar(255), salary int, departmentId int)", "Create table Department (id int, name varchar(25...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
186
Reverse Words in a String II
reverse-words-in-a-string-ii
null
Medium
172.8K
309.2K
172,768
309,175
55.9%
['reverse-words-in-a-string', 'rotate-array']
[]
Algorithms
null
["t","h","e"," ","s","k","y"," ","i","s"," ","b","l","u","e"]
{ "name": "reverseWords", "params": [ { "name": "s", "type": "character[]" } ], "return": { "type": "void" }, "output": { "paramindex": 0 } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Two Pointers', 'String']
187
Repeated DNA Sequences
repeated-dna-sequences
<p>The <strong>DNA sequence</strong> is composed of a series of nucleotides abbreviated as <code>&#39;A&#39;</code>, <code>&#39;C&#39;</code>, <code>&#39;G&#39;</code>, and <code>&#39;T&#39;</code>.</p> <ul> <li>For example, <code>&quot;ACGAATTCCG&quot;</code> is a <strong>DNA sequence</strong>.</li> </ul> <p>When s...
Medium
441.4K
866.7K
441,412
866,693
50.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> findRepeatedDnaSequences(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> findRepeatedDnaSequences(String s) {\n \n }\n}"}, {"value": "p...
"AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"
{ "name": "findRepeatedDnaSequences", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "list<string>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Bit Manipulation', 'Sliding Window', 'Rolling Hash', 'Hash Function']
188
Best Time to Buy and Sell Stock IV
best-time-to-buy-and-sell-stock-iv
<p>You are given an integer array <code>prices</code> where <code>prices[i]</code> is the price of a given stock on the <code>i<sup>th</sup></code> day, and an integer <code>k</code>.</p> <p>Find the maximum profit you can achieve. You may complete at most <code>k</code> transactions: i.e. you may buy at most <code>k<...
Hard
569.3K
1.2M
569,253
1,227,669
46.4%
['best-time-to-buy-and-sell-stock', 'best-time-to-buy-and-sell-stock-ii', 'best-time-to-buy-and-sell-stock-iii', 'maximum-profit-from-trading-stocks']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxProfit(int k, vector<int>& prices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxProfit(int k, int[] prices) {\n \n }\n}"}, {"value": "python", "text": "Pyth...
2 [2,4,1]
{ "name": "maxProfit", "params": [ { "name": "k", "type": "integer" }, { "name": "prices", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
189
Rotate Array
rotate-array
<p>Given an integer array <code>nums</code>, rotate the array to the right by <code>k</code> steps, where <code>k</code> is non-negative.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> nums = [1,2,3,4,5,6,7], k = 3 <strong>Output:</strong> [5,6,7,1,2,3,4] <strong>Ex...
Medium
3M
7.1M
3,018,879
7,077,343
42.7%
['rotate-list', 'reverse-words-in-a-string-ii', 'make-k-subarray-sums-equal', 'maximum-number-of-matching-indices-after-right-shifts']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n void rotate(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public void rotate(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
[1,2,3,4,5,6,7] 3
{ "name": "rotate", "params": [ { "name": "nums", "type": "integer[]" }, { "name": "k", "type": "integer" } ], "return": { "type": "void" }, "output": { "paramindex": 0 } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Two Pointers']
190
Reverse Bits
reverse-bits
<p>Reverse bits of a given 32 bits unsigned integer.</p> <p><strong>Note:</strong></p> <ul> <li>Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer&#39;s in...
Easy
973.8K
1.6M
973,774
1,557,109
62.5%
['reverse-integer', 'number-of-1-bits', 'a-number-after-a-double-reversal']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n uint32_t reverseBits(uint32_t n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "public class Solution {\n // you need treat n as an unsigned value\n public int reverseBits(int n) {\n \n }\n}"}, {...
00000010100101000001111010011100
{ "name": "reverseBits", "params": [ { "name": "n", "type": "string" } ], "return": { "type": "integer" }, "manual": true }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Divide and Conquer', 'Bit Manipulation']
191
Number of 1 Bits
number-of-1-bits
<p>Given a positive integer <code>n</code>, write a function that returns the number of <span data-keyword="set-bit">set bits</span> in its binary representation (also known as the <a href="http://en.wikipedia.org/wiki/Hamming_weight" target="_blank">Hamming weight</a>).</p> <p>&nbsp;</p> <p><strong class="example">Ex...
Easy
1.8M
2.4M
1,755,076
2,370,978
74.0%
['reverse-bits', 'power-of-two', 'counting-bits', 'binary-watch', 'hamming-distance', 'binary-number-with-alternating-bits', 'prime-number-of-set-bits-in-binary-representation', 'convert-date-to-binary']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int hammingWeight(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int hammingWeight(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class ...
11
{ "name": "hammingWeight", "params": [ { "name": "n", "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...
['Divide and Conquer', 'Bit Manipulation']
192
Word Frequency
word-frequency
<p>Write a bash script to calculate the <span data-keyword="frequency-textfile">frequency</span> of each word in a text file <code>words.txt</code>.</p> <p>For simplicity sake, you may assume:</p> <ul> <li><code>words.txt</code> contains only lowercase characters and space <code>&#39; &#39;</code> characters.</li> ...
Medium
60.9K
225.7K
60,930
225,715
27.0%
['top-k-frequent-elements']
[]
Shell
[{"value": "bash", "text": "Bash", "defaultCode": "# Read from the file words.txt and output the word frequency list to stdout.\n"}]
a
{ "shell": true, "manual": true }
{"bash": ["Bash", "<p><code>Bash 5.2.21</code>.</p>"]}
['Shell']
193
Valid Phone Numbers
valid-phone-numbers
<p>Given a text file <code>file.txt</code> that contains a list of phone numbers (one per line), write a one-liner bash script to print all valid phone numbers.</p> <p>You may assume that a valid phone number must appear in one of the following two formats: (xxx) xxx-xxxx or xxx-xxx-xxxx. (x means a digit)</p> <p>You...
Easy
100.4K
370.4K
100,444
370,382
27.1%
[]
[]
Shell
[{"value": "bash", "text": "Bash", "defaultCode": "# Read from the file file.txt and output all valid phone numbers to stdout.\n"}]
0
{ "shell": true, "manual": true }
{"bash": ["Bash", "<p><code>Bash 5.2.21</code>.</p>"]}
['Shell']
194
Transpose File
transpose-file
<p>Given a text file <code>file.txt</code>, transpose its content.</p> <p>You may assume that each row has the same number of columns, and each field is separated by the <code>&#39; &#39;</code> character.</p> <p><strong class="example">Example:</strong></p> <p>If <code>file.txt</code> has the following content:</p>...
Medium
31.7K
112.8K
31,709
112,803
28.1%
[]
[]
Shell
[{"value": "bash", "text": "Bash", "defaultCode": "# Read from the file file.txt and print its transposed content to stdout.\n"}]
a
{ "shell": true, "manual": true }
{"bash": ["Bash", "<p><code>Bash 5.2.21</code>.</p>"]}
['Shell']
195
Tenth Line
tenth-line
<p>Given a text file&nbsp;<code>file.txt</code>, print&nbsp;just the 10th line of the&nbsp;file.</p> <p><strong class="example">Example:</strong></p> <p>Assume that <code>file.txt</code> has the following content:</p> <pre> Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9 Line 10 </pre> <p>Your script...
Easy
126.5K
368.6K
126,504
368,649
34.3%
[]
[]
Shell
[{"value": "bash", "text": "Bash", "defaultCode": "# Read from the file file.txt and output the tenth line to stdout.\n"}]
Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nLine 8\nLine 9\nLine 10
{ "shell": true, "manual": true }
{"bash": ["Bash", "<p><code>Bash 5.2.21</code>.</p>"]}
['Shell']
196
Delete Duplicate Emails
delete-duplicate-emails
<p>Table: <code>Person</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | email | varchar | +-------------+---------+ id is the primary key (column with unique values) for this table. Each row of this table contains an email. The emails will...
Easy
692.6K
1.1M
692,633
1,082,588
64.0%
[]
['Create table If Not Exists Person (Id int, Email varchar(255))', 'Truncate table Person', "insert into Person (id, email) values ('1', '[email protected]')", "insert into Person (id, email) values ('2', '[email protected]')", "insert into Person (id, email) values ('3', '[email protected]')"]
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers": {"Person": ["id", "email"]}, "rows": {"Person": [[1, "[email protected]"], [2, "[email protected]"], [3, "[email protected]"]]}}
{"mysql": ["Create table If Not Exists Person (Id int, Email varchar(255))"], "mssql": ["Create table Person (Id int, Email varchar(255))"], "oraclesql": ["Create table Person (Id int, Email varchar(255))"], "database": true, "manual": true, "name": "delete_duplicate_emails", "pythondata": ["Person = pd.DataFrame([], c...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
197
Rising Temperature
rising-temperature
<p>Table: <code>Weather</code></p> <pre> +---------------+---------+ | Column Name | Type | +---------------+---------+ | id | int | | recordDate | date | | temperature | int | +---------------+---------+ id is the column with unique values for this table. There are no different rows wi...
Easy
1M
2.1M
1,048,789
2,098,992
50.0%
[]
['Create table If Not Exists Weather (id int, recordDate date, temperature int)', 'Truncate table Weather', "insert into Weather (id, recordDate, temperature) values ('1', '2015-01-01', '10')", "insert into Weather (id, recordDate, temperature) values ('2', '2015-01-02', '25')", "insert into Weather (id, recordDate, te...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers": {"Weather": ["id", "recordDate", "temperature"]}, "rows": {"Weather": [[1, "2015-01-01", 10], [2, "2015-01-02", 25], [3, "2015-01-03", 20], [4, "2015-01-04", 30]]}}
{"mysql": ["Create table If Not Exists Weather (id int, recordDate date, temperature int)"], "mssql": ["Create table Weather (id int, recordDate date, temperature int)"], "oraclesql": ["Create table Weather (id int, recordDate date, temperature int)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD'"], "database": true,...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
198
House Robber
house-robber
<p>You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and <b>it will automatically contact the police if two adjacent houses were broken ...
Medium
2.8M
5.4M
2,807,559
5,389,110
52.1%
['maximum-product-subarray', 'house-robber-ii', 'paint-house', 'paint-fence', 'house-robber-iii', 'non-negative-integers-without-consecutive-ones', 'coin-path', 'delete-and-earn', 'solving-questions-with-brainpower', 'count-number-of-ways-to-place-houses', 'house-robber-iv', 'mice-and-cheese', 'largest-element-in-an-ar...
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int rob(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int rob(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Sol...
[1,2,3,1]
{ "name": "rob", "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']
199
Binary Tree Right Side View
binary-tree-right-side-view
<p>Given the <code>root</code> of a binary tree, imagine yourself standing on the <strong>right side</strong> of it, return <em>the values of the nodes you can see ordered from top to bottom</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <div class="example-block"> <p><strong>Input:</stron...
Medium
1.8M
2.7M
1,754,853
2,650,991
66.2%
['populating-next-right-pointers-in-each-node', 'boundary-of-binary-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[1,2,3,null,5,null,4]
{ "name": "rightSideView", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "list<integer>", "dealloc": true } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
200
Number of Islands
number-of-islands
<p>Given an <code>m x n</code> 2D binary grid <code>grid</code> which represents a map of <code>&#39;1&#39;</code>s (land) and <code>&#39;0&#39;</code>s (water), return <em>the number of islands</em>.</p> <p>An <strong>island</strong> is surrounded by water and is formed by connecting adjacent lands horizontally or ve...
Medium
3.3M
5.4M
3,348,963
5,413,257
61.9%
['surrounded-regions', 'walls-and-gates', 'number-of-islands-ii', 'number-of-connected-components-in-an-undirected-graph', 'battleships-in-a-board', 'number-of-distinct-islands', 'max-area-of-island', 'count-sub-islands', 'find-all-groups-of-farmland', 'count-unreachable-pairs-of-nodes-in-an-undirected-graph', 'maximum...
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numIslands(vector<vector<char>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numIslands(char[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python",...
[["1","1","1","1","0"],["1","1","0","1","0"],["1","1","0","0","0"],["0","0","0","0","0"]]
{ "name": "numIslands", "params": [ { "name": "grid", "type": "character[][]" } ], "return": { "type": "integer" }, "manual": true }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix']