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
1,201
Ugly Number III
ugly-number-iii
<p>An <strong>ugly number</strong> is a positive integer that is divisible by <code>a</code>, <code>b</code>, or <code>c</code>.</p> <p>Given four integers <code>n</code>, <code>a</code>, <code>b</code>, and <code>c</code>, return the <code>n<sup>th</sup></code> <strong>ugly number</strong>.</p> <p>&nbsp;</p> <p><str...
Medium
37.4K
123.4K
37,359
123,417
30.3%
['ugly-number-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int nthUglyNumber(int n, int a, int b, int c) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int nthUglyNumber(int n, int a, int b, int c) {\n \n }\n}"}, {"value": "python"...
3 2 3 5
{ "name": "nthUglyNumber", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "a" }, { "type": "integer", "name": "b" }, { "type": "integer", "name": "c" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Binary Search', 'Combinatorics', 'Number Theory']
1,202
Smallest String With Swaps
smallest-string-with-swaps
<p>You are given a string <code>s</code>, and an array of pairs of indices in the string&nbsp;<code>pairs</code>&nbsp;where&nbsp;<code>pairs[i] =&nbsp;[a, b]</code>&nbsp;indicates 2 indices(0-indexed) of the string.</p> <p>You can&nbsp;swap the characters at any pair of indices in the given&nbsp;<code>pairs</code>&nbs...
Medium
129.5K
218.8K
129,481
218,787
59.2%
['minimize-hamming-distance-after-swap-operations', 'process-restricted-friend-requests', 'largest-number-after-digit-swaps-by-parity', 'lexicographically-smallest-beautiful-string', 'make-lexicographically-smallest-array-by-swapping-elements']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string smallestStringWithSwaps(string s, vector<vector<int>>& pairs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String smallestStringWithSwaps(String s, List<List<Integer>> pairs...
"dcab" [[0,3],[1,2]]
{ "name": "smallestStringWithSwaps", "params": [ { "name": "s", "type": "string" }, { "type": "list<list<integer>>", "name": "pairs" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Sorting']
1,203
Sort Items by Groups Respecting Dependencies
sort-items-by-groups-respecting-dependencies
<p>There are&nbsp;<code>n</code>&nbsp;items each&nbsp;belonging to zero or one of&nbsp;<code>m</code>&nbsp;groups where <code>group[i]</code>&nbsp;is the group that the <code>i</code>-th item belongs to and it&#39;s equal to <code>-1</code>&nbsp;if the <code>i</code>-th item belongs to no group. The items and the group...
Hard
59.2K
90.2K
59,246
90,229
65.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> sortItems(int n, int m, vector<int>& group, vector<vector<int>>& beforeItems) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] sortItems(int n, int m, int[] group, Li...
8 2 [-1,-1,1,0,0,1,0,-1] [[],[6],[5],[6],[3,6],[],[],[]]
{ "name": "sortItems", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "m" }, { "type": "integer[]", "name": "group" }, { "type": "list<list<integer>>", "name": "beforeItems" } ], "return": { "type":...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Depth-First Search', 'Breadth-First Search', 'Graph', 'Topological Sort']
1,204
Last Person to Fit in the Bus
last-person-to-fit-in-the-bus
<p>Table: <code>Queue</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | person_id | int | | person_name | varchar | | weight | int | | turn | int | +-------------+---------+ person_id column contains unique values. This table has the information ...
Medium
224.5K
328.9K
224,482
328,862
68.3%
['running-total-for-different-genders', 'the-number-of-seniors-and-juniors-to-join-the-company', 'the-number-of-seniors-and-juniors-to-join-the-company-ii']
['Create table If Not Exists Queue (person_id int, person_name varchar(30), weight int, turn int)', 'Truncate table Queue', "insert into Queue (person_id, person_name, weight, turn) values ('5', 'Alice', '250', '1')", "insert into Queue (person_id, person_name, weight, turn) values ('4', 'Bob', '175', '5')", "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":{"Queue":["person_id","person_name","weight","turn"]},"rows":{"Queue":[[5,"Alice",250,1],[4,"Bob",175,5],[3,"Alex",350,2],[6,"John Cena",400,3],[1,"Winston",500,6],[2,"Marie",200,4]]}}
{"manual": false, "mysql": ["Create table If Not Exists Queue (person_id int, person_name varchar(30), weight int, turn int)"], "mssql": ["Create table Queue (person_id int, person_name varchar(30), weight int, turn int)"], "oraclesql": ["Create table Queue (person_id int, person_name varchar(30), weight int, turn int)...
{"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']
1,205
Monthly Transactions II
monthly-transactions-ii
null
Medium
25.8K
61.4K
25,764
61,351
42.0%
['monthly-transactions-i']
["Create table If Not Exists Transactions (id int, country varchar(4), state enum('approved', 'declined'), amount int, trans_date date)\n", 'Create table If Not Exists Chargebacks (trans_id int, trans_date date)\n', 'Truncate table Transactions', "insert into Transactions (id, country, state, amount, trans_date) values...
Database
null
{"headers":{"Transactions":["id","country","state","amount","trans_date"],"Chargebacks":["trans_id","trans_date"]},"rows":{"Transactions":[[101,"US","approved",1000,"2019-05-18"],[102,"US","declined",2000,"2019-05-19"],[103,"US","approved",3000,"2019-06-10"],[104,"US","declined",4000,"2019-06-13"],[105,"US","approved",...
{"mysql": ["Create table If Not Exists Transactions (id int, country varchar(4), state enum('approved', 'declined'), amount int, trans_date date)\n", "Create table If Not Exists Chargebacks (trans_id int, trans_date date)\n"], "mssql": ["Create table Transactions (id int, country varchar(4), state varchar(10) check(sta...
{"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']
1,206
Design Skiplist
design-skiplist
<p>Design a <strong>Skiplist</strong> without using any built-in libraries.</p> <p>A <strong>skiplist</strong> is a data structure that takes <code>O(log(n))</code> time to add, erase and search. Comparing with treap and red-black tree which has the same function and performance, the code length of Skiplist can be com...
Hard
27.8K
44.9K
27,767
44,909
61.8%
['design-hashset', 'design-hashmap', 'design-linked-list']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Skiplist {\npublic:\n Skiplist() {\n \n }\n \n bool search(int target) {\n \n }\n \n void add(int num) {\n \n }\n \n bool erase(int num) {\n \n }\n};\n\n/**\n * Your Skiplist object will be instantiated a...
["Skiplist","add","add","add","search","add","search","erase","erase","search"] [[],[1],[2],[3],[0],[4],[1],[0],[1],[1]]
{ "classname": "Skiplist", "maxbytesperline": 160000, "constructor": { "params": [] }, "methods": [ { "params": [ { "type": "integer", "name": "target" } ], "name": "search", "return": { "type": "boolean" } }, { "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...
['Linked List', 'Design']
1,207
Unique Number of Occurrences
unique-number-of-occurrences
<p>Given an array of integers <code>arr</code>, return <code>true</code> <em>if the number of occurrences of each value in the array is <strong>unique</strong> or </em><code>false</code><em> otherwise</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> arr = [1,2,2...
Easy
821.4K
1.1M
821,444
1,051,304
78.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool uniqueOccurrences(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean uniqueOccurrences(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Pyt...
[1,2,2,1,1,3]
{ "name": "uniqueOccurrences", "params": [ { "name": "arr", "type": "integer[]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table']
1,208
Get Equal Substrings Within Budget
get-equal-substrings-within-budget
<p>You are given two strings <code>s</code> and <code>t</code> of the same length and an integer <code>maxCost</code>.</p> <p>You want to change <code>s</code> to <code>t</code>. Changing the <code>i<sup>th</sup></code> character of <code>s</code> to <code>i<sup>th</sup></code> character of <code>t</code> costs <code>...
Medium
177.6K
302.2K
177,629
302,162
58.8%
['longest-nice-subarray']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int equalSubstring(string s, string t, int maxCost) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int equalSubstring(String s, String t, int maxCost) {\n \n }\n}"}, {"valu...
"abcd" "bcdf" 3
{ "name": "equalSubstring", "params": [ { "name": "s", "type": "string" }, { "type": "string", "name": "t" }, { "type": "integer", "name": "maxCost" } ], "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', 'Binary Search', 'Sliding Window', 'Prefix Sum']
1,209
Remove All Adjacent Duplicates in String II
remove-all-adjacent-duplicates-in-string-ii
<p>You are given a string <code>s</code> and an integer <code>k</code>, a <code>k</code> <strong>duplicate removal</strong> consists of choosing <code>k</code> adjacent and equal letters from <code>s</code> and removing them, causing the left and the right side of the deleted substring to concatenate together.</p> <p>...
Medium
362.4K
611.3K
362,412
611,349
59.3%
['remove-all-adjacent-duplicates-in-string', 'replace-non-coprime-numbers-in-array', 'minimize-string-length']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string removeDuplicates(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String removeDuplicates(String s, int k) {\n \n }\n}"}, {"value": "python", "text": ...
"abcd" 2
{ "name": "removeDuplicates", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Stack']
1,210
Minimum Moves to Reach Target with Rotations
minimum-moves-to-reach-target-with-rotations
<p>In an&nbsp;<code>n*n</code>&nbsp;grid, there is a snake that spans 2 cells and starts moving from the top left corner at <code>(0, 0)</code> and <code>(0, 1)</code>. The grid has empty cells represented by zeros and blocked cells represented by ones. The snake wants to reach the lower right corner at&nbsp;<code>(n-1...
Hard
11K
21.8K
10,997
21,849
50.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumMoves(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumMoves(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python...
[[0,0,0,0,0,1],[1,1,0,0,1,0],[0,0,0,0,1,1],[0,0,1,0,1,0],[0,1,1,0,0,0],[0,1,1,0,0,0]]
{ "name": "minimumMoves", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Breadth-First Search', 'Matrix']
1,211
Queries Quality and Percentage
queries-quality-and-percentage
<p>Table: <code>Queries</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | query_name | varchar | | result | varchar | | position | int | | rating | int | +-------------+---------+ This table may have duplicate rows. This table contains information co...
Easy
342K
727.8K
341,998
727,839
47.0%
['percentage-of-users-attended-a-contest']
['Create table If Not Exists Queries (query_name varchar(30), result varchar(50), position int, rating int)', 'Truncate table Queries', "insert into Queries (query_name, result, position, rating) values ('Dog', 'Golden Retriever', '1', '5')", "insert into Queries (query_name, result, position, rating) values ('Dog', 'G...
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":{"Queries":["query_name","result","position","rating"]},"rows":{"Queries":[["Dog","Golden Retriever",1,5],["Dog","German Shepherd",2,5],["Dog","Mule",200,1],["Cat","Shirazi",5,2],["Cat","Siamese",3,3],["Cat","Sphynx",7,4]]}}
{"mysql": ["Create table If Not Exists Queries (query_name varchar(30), result varchar(50), position int, rating int)"], "mssql": ["create table Queries (query_name varchar(30), result varchar(50), position int, rating int)"], "oraclesql": ["create table Queries (query_name varchar(30), result varchar(50), position int...
{"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']
1,212
Team Scores in Football Tournament
team-scores-in-football-tournament
null
Medium
46.1K
82.8K
46,148
82,767
55.8%
[]
['Create table If Not Exists Teams (team_id int, team_name varchar(30))', 'Create table If Not Exists Matches (match_id int, host_team int, guest_team int, host_goals int, guest_goals int)', 'Truncate table Teams', "insert into Teams (team_id, team_name) values ('10', 'Leetcode FC')", "insert into Teams (team_id, team_...
Database
null
{"headers": {"Teams": ["team_id", "team_name"], "Matches": ["match_id", "host_team", "guest_team", "host_goals", "guest_goals"]}, "rows": {"Teams": [[10, "Leetcode FC"], [20, "NewYork FC"], [30, "Atlanta FC"], [40, "Chicago FC"], [50, "Toronto FC"]], "Matches": [[1, 10, 20, 3, 0], [2, 30, 10, 2, 2], [3, 10, 50, 5, 1], ...
{"mysql": ["Create table If Not Exists Teams (team_id int, team_name varchar(30))", "Create table If Not Exists Matches (match_id int, host_team int, guest_team int, host_goals int, guest_goals int)"], "mssql": ["Create table Teams (team_id int, team_name varchar(30))", "Create table Matches (match_id int, host_team in...
{"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']
1,213
Intersection of Three Sorted Arrays
intersection-of-three-sorted-arrays
null
Easy
99K
123.6K
99,009
123,591
80.1%
['intersection-of-two-arrays', 'intersection-of-multiple-arrays']
[]
Algorithms
null
[1,2,3,4,5] [1,2,5,7,9] [1,3,4,5,8]
{ "name": "arraysIntersection", "params": [ { "name": "arr1", "type": "integer[]" }, { "name": "arr2", "type": "integer[]" }, { "name": "arr3", "type": "integer[]" } ], "return": { "type": "list<integer>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Binary Search', 'Counting']
1,214
Two Sum BSTs
two-sum-bsts
null
Medium
53.7K
79.8K
53,718
79,797
67.3%
['two-sum-iv-input-is-a-bst']
[]
Algorithms
null
[2,1,4] [1,0,3] 5
{ "name": "twoSumBSTs", "params": [ { "name": "root1", "type": "TreeNode" }, { "name": "root2", "type": "TreeNode" }, { "name": "target", "type": "integer" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Two Pointers', 'Binary Search', 'Stack', 'Tree', 'Depth-First Search', 'Binary Search Tree', 'Binary Tree']
1,215
Stepping Numbers
stepping-numbers
null
Medium
10.4K
21.9K
10,399
21,860
47.6%
['count-stepping-numbers-in-range']
[]
Algorithms
null
0 21
{ "name": "countSteppingNumbers", "params": [ { "name": "low", "type": "integer" }, { "name": "high", "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...
['Math', 'Backtracking', 'Breadth-First Search']
1,216
Valid Palindrome III
valid-palindrome-iii
null
Hard
95.5K
194.8K
95,531
194,811
49.0%
['valid-palindrome-ii', 'valid-palindrome-iv']
[]
Algorithms
null
"abcdeca" 2
{ "name": "isValidPalindrome", "params": [ { "name": "s", "type": "string" }, { "name": "k", "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...
['String', 'Dynamic Programming']
1,217
Minimum Cost to Move Chips to The Same Position
minimum-cost-to-move-chips-to-the-same-position
<p>We have <code>n</code> chips, where the position of the <code>i<sup>th</sup></code> chip is <code>position[i]</code>.</p> <p>We need to move all the chips to <strong>the same position</strong>. In one step, we can change the position of the <code>i<sup>th</sup></code> chip from <code>position[i]</code> to:</p> <ul...
Easy
146.8K
203.6K
146,767
203,554
72.1%
['minimum-number-of-operations-to-move-all-balls-to-each-box', 'split-with-minimum-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minCostToMoveChips(vector<int>& position) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minCostToMoveChips(int[] position) {\n \n }\n}"}, {"value": "python", "text...
[1,2,3]
{ "name": "minCostToMoveChips", "params": [ { "name": "position", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Greedy']
1,218
Longest Arithmetic Subsequence of Given Difference
longest-arithmetic-subsequence-of-given-difference
<p>Given an integer array <code>arr</code> and an integer <code>difference</code>, return the length of the longest subsequence in <code>arr</code> which is an arithmetic sequence such that the difference between adjacent elements in the subsequence equals <code>difference</code>.</p> <p>A <strong>subsequence</strong>...
Medium
157.9K
289.9K
157,928
289,876
54.5%
['destroy-sequential-targets']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestSubsequence(vector<int>& arr, int difference) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestSubsequence(int[] arr, int difference) {\n \n }\n}"}, {"v...
[1,2,3,4] 1
{ "name": "longestSubsequence", "params": [ { "name": "arr", "type": "integer[]" }, { "type": "integer", "name": "difference" } ], "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', 'Dynamic Programming']
1,219
Path with Maximum Gold
path-with-maximum-gold
<p>In a gold mine <code>grid</code> of size <code>m x n</code>, each cell in this mine has an integer representing the amount of gold in that cell, <code>0</code> if it is empty.</p> <p>Return the maximum amount of gold you can collect under the conditions:</p> <ul> <li>Every time you are located in a cell you will ...
Medium
233.9K
343.6K
233,874
343,553
68.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getMaximumGold(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getMaximumGold(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Py...
[[0,6,0],[5,8,7],[0,9,0]]
{ "name": "getMaximumGold", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Backtracking', 'Matrix']
1,220
Count Vowels Permutation
count-vowels-permutation
<p>Given an integer <code>n</code>, your task is to count how many strings of length <code>n</code> can be formed under the following rules:</p> <ul> <li>Each character is a lower case vowel&nbsp;(<code>&#39;a&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;i&#39;</code>, <code>&#39;o&#39;</code>, <code>&#39;u&#39;...
Hard
175.6K
285.4K
175,578
285,430
61.5%
['number-of-strings-which-can-be-rearranged-to-contain-substring']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countVowelPermutation(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countVowelPermutation(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau...
1
{ "name": "countVowelPermutation", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Dynamic Programming']
1,221
Split a String in Balanced Strings
split-a-string-in-balanced-strings
<p><strong>Balanced</strong> strings are those that have an equal quantity of <code>&#39;L&#39;</code> and <code>&#39;R&#39;</code> characters.</p> <p>Given a <strong>balanced</strong> string <code>s</code>, split it into some number of substrings such that:</p> <ul> <li>Each substring is balanced.</li> </ul> <p>Re...
Easy
341.4K
393.9K
341,408
393,863
86.7%
['split-strings-by-separator']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int balancedStringSplit(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int balancedStringSplit(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
"RLRRLLRLRL"
{ "name": "balancedStringSplit", "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', 'Greedy', 'Counting']
1,222
Queens That Can Attack the King
queens-that-can-attack-the-king
<p>On a <strong>0-indexed</strong> <code>8 x 8</code> chessboard, there can be multiple black queens and one white king.</p> <p>You are given a 2D integer array <code>queens</code> where <code>queens[i] = [xQueen<sub>i</sub>, yQueen<sub>i</sub>]</code> represents the position of the <code>i<sup>th</sup></code> black q...
Medium
46.6K
64.7K
46,649
64,708
72.1%
['minimum-moves-to-capture-the-queen']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> queensAttacktheKing(vector<vector<int>>& queens, vector<int>& king) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> queensAttacktheKing(int[][]...
[[0,1],[1,0],[4,0],[0,4],[3,3],[2,4]] [0,0]
{ "name": "queensAttacktheKing", "params": [ { "name": "queens", "type": "integer[][]" }, { "type": "integer[]", "name": "king" } ], "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', 'Matrix', 'Simulation']
1,223
Dice Roll Simulation
dice-roll-simulation
<p>A die simulator generates a random number from <code>1</code> to <code>6</code> for each roll. You introduced a constraint to the generator such that it cannot roll the number <code>i</code> more than <code>rollMax[i]</code> (<strong>1-indexed</strong>) consecutive times.</p> <p>Given an array of integers <code>rol...
Hard
33.5K
67.2K
33,472
67,200
49.8%
['find-missing-observations', 'number-of-distinct-roll-sequences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int dieSimulator(int n, vector<int>& rollMax) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int dieSimulator(int n, int[] rollMax) {\n \n }\n}"}, {"value": "python", "text...
2 [1,1,2,2,2,3]
{ "name": "dieSimulator", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[]", "name": "rollMax" } ], "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']
1,224
Maximum Equal Frequency
maximum-equal-frequency
<p>Given an array <code>nums</code> of positive integers, return the longest possible length of an array prefix of <code>nums</code>, such that it is possible to remove <strong>exactly one</strong> element from this prefix so that every number that has appeared in it will have the same number of occurrences.</p> <p>If...
Hard
16.9K
45.4K
16,950
45,397
37.3%
['remove-letter-to-equalize-frequency', 'count-submatrices-with-equal-frequency-of-x-and-y']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxEqualFreq(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxEqualFreq(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[2,2,1,1,5,3,3,5]
{ "name": "maxEqualFreq", "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']
1,225
Report Contiguous Dates
report-contiguous-dates
null
Hard
28.4K
49.5K
28,381
49,480
57.4%
['find-the-start-and-end-number-of-continuous-ranges', 'find-the-missing-ids', 'customers-with-strictly-increasing-purchases']
['Create table If Not Exists Failed (fail_date date)', 'Create table If Not Exists Succeeded (success_date date)', 'Truncate table Failed', "insert into Failed (fail_date) values ('2018-12-28')", "insert into Failed (fail_date) values ('2018-12-29')", "insert into Failed (fail_date) values ('2019-01-04')", "insert into...
Database
null
{"headers":{"Failed":["fail_date"],"Succeeded":["success_date"]},"rows":{"Failed":[["2018-12-28"],["2018-12-29"],["2019-01-04"],["2019-01-05"]],"Succeeded":[["2018-12-30"],["2018-12-31"],["2019-01-01"],["2019-01-02"],["2019-01-03"],["2019-01-06"]]}}
{"mysql": ["Create table If Not Exists Failed (fail_date date)", "Create table If Not Exists Succeeded (success_date date)"], "mssql": ["Create table Failed (fail_date date)", "Create table Succeeded (success_date date)\n"], "oraclesql": ["Create table Failed (fail_date date)", "Create table Succeeded (success_date dat...
{"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']
1,226
The Dining Philosophers
the-dining-philosophers
<p>Five silent philosophers&nbsp;sit at a round table with bowls of spaghetti. Forks are placed between each pair of adjacent philosophers.</p> <p>Each philosopher must alternately think and eat. However, a philosopher can only eat spaghetti when they have both left and right forks. Each fork can be held by only one p...
Medium
42K
77K
42,043
77,048
54.6%
[]
[]
Concurrency
[{"value": "cpp", "text": "C++", "defaultCode": "class DiningPhilosophers {\npublic:\n DiningPhilosophers() {\n \n }\n\n void wantsToEat(int philosopher,\n function<void()> pickLeftFork,\n function<void()> pickRightFork,\n function<void()> eat,\n ...
1
{ "name": "foobar", "params": [ { "name": "target", "type": "integer" } ], "return": { "type": "integer" }, "languages": [ "java", "python", "python3", "cpp" ], "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...
['Concurrency']
1,227
Airplane Seat Assignment Probability
airplane-seat-assignment-probability
<p><code>n</code> passengers board an airplane with exactly <code>n</code> seats. The first passenger has lost the ticket and picks a seat randomly. But after that, the rest of the passengers will:</p> <ul> <li>Take their own seat if it is still available, and</li> <li>Pick other seats randomly when they find their ...
Medium
48.2K
72.3K
48,178
72,340
66.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double nthPersonGetsNthSeat(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double nthPersonGetsNthSeat(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
1
{ "name": "nthPersonGetsNthSeat", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "double" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Dynamic Programming', 'Brainteaser', 'Probability and Statistics']
1,228
Missing Number In Arithmetic Progression
missing-number-in-arithmetic-progression
null
Easy
29.7K
57.1K
29,718
57,082
52.1%
[]
[]
Algorithms
null
[5,7,11,13]
{ "name": "missingNumber", "params": [ { "name": "arr", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math']
1,229
Meeting Scheduler
meeting-scheduler
null
Medium
92.9K
168.4K
92,881
168,364
55.2%
['merge-two-2d-arrays-by-summing-values', 'reschedule-meetings-for-maximum-free-time-i']
[]
Algorithms
null
[[10,50],[60,120],[140,210]] [[0,15],[60,70]] 8
{ "name": "minAvailableDuration", "params": [ { "name": "slots1", "type": "integer[][]" }, { "name": "slots2", "type": "integer[][]" }, { "name": "duration", "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', 'Two Pointers', 'Sorting']
1,230
Toss Strange Coins
toss-strange-coins
null
Medium
22.1K
38K
22,109
38,022
58.1%
[]
[]
Algorithms
null
[0.4] 1
{ "name": "probabilityOfHeads", "params": [ { "name": "prob", "type": "double[]" }, { "name": "target", "type": "integer" } ], "return": { "type": "double" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Dynamic Programming', 'Probability and Statistics']
1,231
Divide Chocolate
divide-chocolate
null
Hard
62.7K
104.9K
62,733
104,947
59.8%
['split-array-largest-sum', 'capacity-to-ship-packages-within-d-days']
[]
Algorithms
null
[1,2,3,4,5,6,7,8,9] 5
{ "name": "maximizeSweetness", "params": [ { "name": "sweetness", "type": "integer[]" }, { "name": "k", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search']
1,232
Check If It Is a Straight Line
check-if-it-is-a-straight-line
<p>You are given an array&nbsp;<code>coordinates</code>, <code>coordinates[i] = [x, y]</code>, where <code>[x, y]</code> represents the coordinate of a point. Check if these points&nbsp;make a straight line in the XY plane.</p> <p>&nbsp;</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <p><img al...
Easy
281.1K
709.1K
281,141
709,096
39.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkStraightLine(vector<vector<int>>& coordinates) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkStraightLine(int[][] coordinates) {\n \n }\n}"}, {"valu...
[[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]]
{ "name": "checkStraightLine", "params": [ { "name": "coordinates", "type": "integer[][]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Geometry']
1,233
Remove Sub-Folders from the Filesystem
remove-sub-folders-from-the-filesystem
<p>Given a list of folders <code>folder</code>, return <em>the folders after removing all <strong>sub-folders</strong> in those folders</em>. You may return the answer in <strong>any order</strong>.</p> <p>If a <code>folder[i]</code> is located within another <code>folder[j]</code>, it is called a <strong>sub-folder</...
Medium
163.8K
216.3K
163,750
216,298
75.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> removeSubfolders(vector<string>& folder) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> removeSubfolders(String[] folder) {\n \n }\n}"}, {"value...
["/a","/a/b","/c/d","/c/d/e","/c/f"]
{ "name": "removeSubfolders", "params": [ { "name": "folder", "type": "string[]" } ], "return": { "type": "list<string>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'Depth-First Search', 'Trie']
1,234
Replace the Substring for Balanced String
replace-the-substring-for-balanced-string
<p>You are given a string s of length <code>n</code> containing only four kinds of characters: <code>&#39;Q&#39;</code>, <code>&#39;W&#39;</code>, <code>&#39;E&#39;</code>, and <code>&#39;R&#39;</code>.</p> <p>A string is said to be <strong>balanced</strong><em> </em>if each of its characters appears <code>n / 4</code...
Medium
39.9K
101.5K
39,850
101,513
39.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int balancedString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int balancedString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":...
"QWER"
{ "name": "balancedString", "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', 'Sliding Window']
1,235
Maximum Profit in Job Scheduling
maximum-profit-in-job-scheduling
<p>We have <code>n</code> jobs, where every job is scheduled to be done from <code>startTime[i]</code> to <code>endTime[i]</code>, obtaining a profit of <code>profit[i]</code>.</p> <p>You&#39;re given the <code>startTime</code>, <code>endTime</code> and <code>profit</code> arrays, return the maximum profit you can tak...
Hard
354.4K
652.2K
354,363
652,162
54.3%
['maximum-earnings-from-taxi', 'two-best-non-overlapping-events']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int jobScheduling(vector<int>& startTime, vector<int>& endTime, vector<int>& profit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int jobScheduling(int[] startTime, int[] endTime, ...
[1,2,3,3] [3,4,5,6] [50,10,40,70]
{ "name": "jobScheduling", "params": [ { "name": "startTime", "type": "integer[]" }, { "type": "integer[]", "name": "endTime" }, { "type": "integer[]", "name": "profit" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Dynamic Programming', 'Sorting']
1,236
Web Crawler
web-crawler
null
Medium
43.2K
63K
43,216
63,005
68.6%
['web-crawler-multithreaded']
[]
Algorithms
null
["http://news.yahoo.com","http://news.yahoo.com/news","http://news.yahoo.com/news/topics/","http://news.google.com","http://news.yahoo.com/us"] [[2,0],[2,1],[3,2],[3,1],[0,4]] "http://news.yahoo.com/news/topics/"
{ "name": "crawl", "params": [ { "name": "urls", "type": "string[]" }, { "type": "integer[][]", "name": "edges" }, { "type": "string", "name": "startUrl" } ], "return": { "type": "list<string>" }, "manual": true, "languages": [ "cpp", ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Depth-First Search', 'Breadth-First Search', 'Interactive']
1,237
Find Positive Integer Solution for a Given Equation
find-positive-integer-solution-for-a-given-equation
<p>Given a callable function <code>f(x, y)</code> <strong>with a hidden formula</strong> and a value <code>z</code>, reverse engineer the formula and return <em>all positive integer pairs </em><code>x</code><em> and </em><code>y</code><em> where </em><code>f(x,y) == z</code>. You may return the pairs in any order.</p> ...
Medium
74.4K
107.3K
74,431
107,254
69.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/*\n * // This is the custom function interface.\n * // You should not implement it, or speculate about its implementation\n * class CustomFunction {\n * public:\n * // Returns f(x, y) for any given positive integers x and y.\n * // Note that f(x, y) is increasin...
1 5
{ "name": "findSolution", "params": [ { "name": "num", "type": "integer" }, { "type": "integer", "name": "z" } ], "return": { "type": "list<list<integer>>" }, "manual": true, "typescriptCustomType" : "class CustomFunction {\n num: number;\n constructor(x: nu...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Two Pointers', 'Binary Search', 'Interactive']
1,238
Circular Permutation in Binary Representation
circular-permutation-in-binary-representation
<p>Given 2 integers <code>n</code> and <code>start</code>. Your task is return <strong>any</strong> permutation <code>p</code>&nbsp;of <code>(0,1,2.....,2^n -1) </code>such that :</p> <ul> <li><code>p[0] = start</code></li> <li><code>p[i]</code> and <code>p[i+1]</code>&nbsp;differ by only one bit in their binary rep...
Medium
21.1K
29.6K
21,137
29,620
71.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\r\npublic:\r\n vector<int> circularPermutation(int n, int start) {\r\n \r\n }\r\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\r\n public List<Integer> circularPermutation(int n, int start) {\r\n \r\n ...
2 3
{ "name": "circularPermutation", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "start" } ], "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...
['Math', 'Backtracking', 'Bit Manipulation']
1,239
Maximum Length of a Concatenated String with Unique Characters
maximum-length-of-a-concatenated-string-with-unique-characters
<p>You are given an array of strings <code>arr</code>. A string <code>s</code> is formed by the <strong>concatenation</strong> of a <strong>subsequence</strong> of <code>arr</code> that has <strong>unique characters</strong>.</p> <p>Return <em>the <strong>maximum</strong> possible length</em> of <code>s</code>.</p> <...
Medium
302.7K
558.5K
302,733
558,486
54.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxLength(vector<string>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxLength(List<String> arr) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
["un","iq","ue"]
{ "name": "maxLength", "params": [ { "name": "arr", "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...
['Array', 'String', 'Backtracking', 'Bit Manipulation']
1,240
Tiling a Rectangle with the Fewest Squares
tiling-a-rectangle-with-the-fewest-squares
<p>Given a rectangle of size <code>n</code> x <code>m</code>, return <em>the minimum number of integer-sided squares that tile the rectangle</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <p><img alt="" src="https://assets.leetcode.com/uploads/2019/10/17/sample_11_1592.png" style="width: 1...
Hard
25.6K
47K
25,560
47,043
54.3%
['selling-pieces-of-wood']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int tilingRectangle(int n, int m) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int tilingRectangle(int n, int m) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
2 3
{ "name": "tilingRectangle", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "m" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Backtracking']
1,241
Number of Comments per Post
number-of-comments-per-post
null
Easy
38.4K
58.2K
38,441
58,196
66.1%
[]
['Create table If Not Exists Submissions (sub_id int, parent_id int)', 'Truncate table Submissions', "insert into Submissions (sub_id, parent_id) values ('1', NULL)", "insert into Submissions (sub_id, parent_id) values ('2', NULL)", "insert into Submissions (sub_id, parent_id) values ('1', NULL)", "insert into Submissi...
Database
null
{"headers":{"Submissions":["sub_id","parent_id"]},"rows":{"Submissions":[[1,null],[2,null],[1,null],[12,null],[3,1],[5,2],[3,1],[4,1],[9,1],[10,2],[6,7]]}}
{"mysql": ["Create table If Not Exists Submissions (sub_id int, parent_id int)"], "mssql": ["Create table Submissions (sub_id int, parent_id int)"], "oraclesql": ["Create table Submissions (sub_id int, parent_id int)"], "database": true, "name": "count_comments", "pythondata": ["Submissions = pd.DataFrame([], columns=[...
{"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']
1,242
Web Crawler Multithreaded
web-crawler-multithreaded
null
Medium
71K
142.7K
71,006
142,745
49.7%
['web-crawler']
[]
Concurrency
null
["http://news.yahoo.com","http://news.yahoo.com/news","http://news.yahoo.com/news/topics/","http://news.google.com","http://news.yahoo.com/us"] [[2,0],[2,1],[3,2],[3,1],[0,4]] "http://news.yahoo.com/news/topics/"
{ "name": "foobar", "params": [ { "name": "urls", "type": "string[]" }, { "type": "integer[][]", "name": "edges" }, { "type": "string", "name": "startUrl" } ], "return": { "type": "integer" }, "languages": [ "cpp", "java", "python",...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Depth-First Search', 'Breadth-First Search', 'Concurrency']
1,243
Array Transformation
array-transformation
null
Easy
14.8K
28K
14,831
27,993
53.0%
[]
[]
Algorithms
null
[6,2,3,4]
{ "name": "transformArray", "params": [ { "name": "arr", "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', 'Simulation']
1,244
Design A Leaderboard
design-a-leaderboard
null
Medium
81.5K
120.1K
81,524
120,088
67.9%
[]
[]
Algorithms
null
["Leaderboard","addScore","addScore","addScore","addScore","addScore","top","reset","reset","addScore","top"] [[],[1,73],[2,56],[3,39],[4,51],[5,4],[1],[1],[2],[2,51],[3]]
{ "classname": "Leaderboard", "maxbytesperline": 200000, "constructor": { "params": [] }, "methods": [ { "name" : "addScore", "params": [ { "type": "integer", "name": "playerId" }, ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Design', 'Sorting']
1,245
Tree Diameter
tree-diameter
null
Medium
52.1K
85.3K
52,072
85,315
61.0%
['count-subtrees-with-max-distance-between-cities', 'find-minimum-diameter-after-merging-two-trees']
[]
Algorithms
null
[[0,1],[0,2]]
{ "name": "treeDiameter", "params": [ { "name": "edges", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Graph', 'Topological Sort']
1,246
Palindrome Removal
palindrome-removal
null
Hard
11.3K
24.5K
11,345
24,490
46.3%
[]
[]
Algorithms
null
[1,2]
{ "name": "minimumMoves", "params": [ { "name": "arr", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
1,247
Minimum Swaps to Make Strings Equal
minimum-swaps-to-make-strings-equal
<p>You are given two strings <code>s1</code> and <code>s2</code> of equal length consisting of letters <code>&quot;x&quot;</code> and <code>&quot;y&quot;</code> <strong>only</strong>. Your task is to make these two strings equal to each other. You can swap any two characters that belong to <strong>different</strong> st...
Medium
45.8K
71.1K
45,840
71,069
64.5%
['determine-if-two-strings-are-close', 'make-number-of-distinct-characters-equal']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumSwap(string s1, string s2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumSwap(String s1, String s2) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
"xx" "yy"
{ "name": "minimumSwap", "params": [ { "name": "s1", "type": "string" }, { "type": "string", "name": "s2" } ], "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', 'Greedy']
1,248
Count Number of Nice Subarrays
count-number-of-nice-subarrays
<p>Given an array of integers <code>nums</code> and an integer <code>k</code>. A continuous subarray is called <strong>nice</strong> if there are <code>k</code> odd numbers on it.</p> <p>Return <em>the number of <strong>nice</strong> sub-arrays</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p...
Medium
335.6K
462K
335,571
462,022
72.6%
['k-divisible-elements-subarrays', 'count-subarrays-with-fixed-bounds', 'ways-to-split-array-into-good-subarrays', 'count-of-interesting-subarrays']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfSubarrays(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfSubarrays(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "...
[1,1,2,1,1] 3
{ "name": "numberOfSubarrays", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Math', 'Sliding Window', 'Prefix Sum']
1,249
Minimum Remove to Make Valid Parentheses
minimum-remove-to-make-valid-parentheses
<p>Given a string <font face="monospace">s</font> of <code>&#39;(&#39;</code> , <code>&#39;)&#39;</code> and lowercase English characters.</p> <p>Your task is to remove the minimum number of parentheses ( <code>&#39;(&#39;</code> or <code>&#39;)&#39;</code>, in any positions ) so that the resulting <em>parentheses str...
Medium
912.7K
1.3M
912,718
1,295,696
70.4%
['minimum-number-of-swaps-to-make-the-string-balanced', 'check-if-a-parentheses-string-can-be-valid']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string minRemoveToMakeValid(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String minRemoveToMakeValid(String s) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
"lee(t(c)o)de)"
{ "name": "minRemoveToMakeValid", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Stack']
1,250
Check If It Is a Good Array
check-if-it-is-a-good-array
<p>Given an array <code>nums</code> of&nbsp;positive integers. Your task is to select some subset of <code>nums</code>, multiply each element by an integer and add all these numbers.&nbsp;The array is said to be&nbsp;<strong>good&nbsp;</strong>if you can obtain a sum of&nbsp;<code>1</code>&nbsp;from the array by any po...
Hard
29.1K
47.7K
29,059
47,705
60.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isGoodArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isGoodArray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
[12,5,7,23]
{ "name": "isGoodArray", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Number Theory']
1,251
Average Selling Price
average-selling-price
<p>Table: <code>Prices</code></p> <pre> +---------------+---------+ | Column Name | Type | +---------------+---------+ | product_id | int | | start_date | date | | end_date | date | | price | int | +---------------+---------+ (product_id, start_date, end_date) is the primary key (...
Easy
437.9K
1.2M
437,907
1,188,053
36.9%
[]
['Create table If Not Exists Prices (product_id int, start_date date, end_date date, price int)', 'Create table If Not Exists UnitsSold (product_id int, purchase_date date, units int)', 'Truncate table Prices', "insert into Prices (product_id, start_date, end_date, price) values ('1', '2019-02-17', '2019-02-28', '5')",...
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":{"Prices":["product_id","start_date","end_date","price"],"UnitsSold":["product_id","purchase_date","units"]},"rows":{"Prices":[[1,"2019-02-17","2019-02-28",5],[1,"2019-03-01","2019-03-22",20],[2,"2019-02-01","2019-02-20",15],[2,"2019-02-21","2019-03-31",30]],"UnitsSold":[[1,"2019-02-25",100],[1,"2019-03-01",...
{"mysql": ["Create table If Not Exists Prices (product_id int, start_date date, end_date date, price int)", "Create table If Not Exists UnitsSold (product_id int, purchase_date date, units int)"], "mssql": ["Create table Prices (product_id int, start_date date, end_date date, price int)", "Create table UnitsSold (produ...
{"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']
1,252
Cells with Odd Values in a Matrix
cells-with-odd-values-in-a-matrix
<p>There is an <code>m x n</code> matrix that is initialized to all <code>0</code>&#39;s. There is also a 2D array <code>indices</code> where each <code>indices[i] = [r<sub>i</sub>, c<sub>i</sub>]</code> represents a <strong>0-indexed location</strong> to perform some increment operations on the matrix.</p> <p>For eac...
Easy
128.3K
162.1K
128,259
162,053
79.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int oddCells(int m, int n, vector<vector<int>>& indices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int oddCells(int m, int n, int[][] indices) {\n \n }\n}"}, {"value":...
2 3 [[0,1],[1,1]]
{ "name": "oddCells", "params": [ { "name": "m", "type": "integer" }, { "type": "integer", "name": "n" }, { "type": "integer[][]", "name": "indices" } ], "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', 'Simulation']
1,253
Reconstruct a 2-Row Binary Matrix
reconstruct-a-2-row-binary-matrix
<p>Given the following details of a matrix with <code>n</code> columns and <code>2</code> rows :</p> <ul> <li>The matrix is a binary matrix, which means each element in the matrix can be <code>0</code> or <code>1</code>.</li> <li>The sum of elements of the 0-th(upper) row is given as <code>upper</code>.</li> <li>Th...
Medium
30.6K
64.5K
30,644
64,520
47.5%
['find-valid-matrix-given-row-and-column-sums']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> reconstructMatrix(int upper, int lower, vector<int>& colsum) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> reconstructMatrix(int upper, int l...
2 1 [1,1,1]
{ "name": "reconstructMatrix", "params": [ { "name": "upper", "type": "integer" }, { "type": "integer", "name": "lower" }, { "type": "integer[]", "name": "colsum" } ], "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', 'Greedy', 'Matrix']
1,254
Number of Closed Islands
number-of-closed-islands
<p>Given a 2D&nbsp;<code>grid</code> consists of <code>0s</code> (land)&nbsp;and <code>1s</code> (water).&nbsp; An <em>island</em> is a maximal 4-directionally connected group of <code><font face="monospace">0</font>s</code> and a <em>closed island</em>&nbsp;is an island <strong>totally</strong>&nbsp;(all left, top, ri...
Medium
250.3K
375.3K
250,267
375,345
66.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int closedIsland(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int closedIsland(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python...
[[1,1,1,1,1,1,1,0],[1,0,0,0,0,1,1,0],[1,0,1,0,1,1,1,0],[1,0,0,0,0,1,0,1],[1,1,1,1,1,1,1,0]]
{ "name": "closedIsland", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix']
1,255
Maximum Score Words Formed by Letters
maximum-score-words-formed-by-letters
<p>Given a list of <code>words</code>, list of&nbsp; single&nbsp;<code>letters</code> (might be repeating)&nbsp;and <code>score</code>&nbsp;of every character.</p> <p>Return the maximum score of <strong>any</strong> valid set of words formed by using the given letters (<code>words[i]</code> cannot be used two&nbsp;or ...
Hard
124.8K
152.9K
124,769
152,895
81.6%
['maximum-good-people-based-on-statements']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxScoreWords(vector<string>& words, vector<char>& letters, vector<int>& score) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxScoreWords(String[] words, char[] letters, i...
["dog","cat","dad","good"] ["a","a","c","d","d","d","g","o","o"] [1,0,9,5,0,0,3,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0]
{ "name": "maxScoreWords", "params": [ { "name": "words", "type": "string[]" }, { "type": "character[]", "name": "letters" }, { "type": "integer[]", "name": "score" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Bitmask']
1,256
Encode Number
encode-number
null
Medium
8.2K
11.7K
8,181
11,674
70.1%
['convert-to-base-2']
[]
Algorithms
null
23
{ "name": "encode", "params": [ { "name": "num", "type": "integer" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'String', 'Bit Manipulation']
1,257
Smallest Common Region
smallest-common-region
null
Medium
33.7K
49.7K
33,744
49,712
67.9%
['lowest-common-ancestor-of-a-binary-search-tree', 'lowest-common-ancestor-of-a-binary-tree']
[]
Algorithms
null
[["Earth","North America","South America"],["North America","United States","Canada"],["United States","New York","Boston"],["Canada","Ontario","Quebec"],["South America","Brazil"]] "Quebec" "New York"
{ "name": "findSmallestRegion", "params": [ { "name": "regions", "type": "list<list<string>>" }, { "name": "region1", "type": "string" }, { "name": "region2", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String', 'Tree', 'Depth-First Search', 'Breadth-First Search']
1,258
Synonymous Sentences
synonymous-sentences
null
Medium
26.3K
46.6K
26,341
46,636
56.5%
[]
[]
Algorithms
null
[["happy","joy"],["sad","sorrow"],["joy","cheerful"]] "I am happy today but was sad yesterday"
{ "name": "generateSentences", "params": [ { "name": "synonyms", "type": "list<list<string>>" }, { "name": "text", "type": "string" } ], "return": { "type": "list<string>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String', 'Backtracking', 'Union Find']
1,259
Handshakes That Don't Cross
handshakes-that-dont-cross
null
Hard
12.9K
21.4K
12,854
21,437
60.0%
[]
[]
Algorithms
null
4
{ "name": "numberOfWays", "params": [ { "name": "numPeople", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Dynamic Programming']
1,260
Shift 2D Grid
shift-2d-grid
<p>Given a 2D <code>grid</code> of size <code>m x n</code>&nbsp;and an integer <code>k</code>. You need to shift the <code>grid</code>&nbsp;<code>k</code> times.</p> <p>In one shift operation:</p> <ul> <li>Element at <code>grid[i][j]</code> moves to <code>grid[i][j + 1]</code>.</li> <li>Element at <code>grid[i][n -...
Easy
114.9K
170K
114,899
170,010
67.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> shiftGrid(vector<vector<int>>& grid, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> shiftGrid(int[][] grid, int k) {\n \n }\n...
[[1,2,3],[4,5,6],[7,8,9]] 1
{ "name": "shiftGrid", "params": [ { "name": "grid", "type": "integer[][]" }, { "type": "integer", "name": "k" } ], "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', 'Matrix', 'Simulation']
1,261
Find Elements in a Contaminated Binary Tree
find-elements-in-a-contaminated-binary-tree
<p>Given a binary tree with the following rules:</p> <ol> <li><code>root.val == 0</code></li> <li>For any <code>treeNode</code>: <ol type="a"> <li>If <code>treeNode.val</code> has a value <code>x</code> and <code>treeNode.left != null</code>, then <code>treeNode.left.val == 2 * x + 1</code></li> <li>If <code>tr...
Medium
193.1K
227.8K
193,086
227,787
84.8%
[]
[]
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...
["FindElements","find","find"] [[[-1,null,-1]],[1],[2]]
{ "classname": "FindElements", "constructor": { "params": [ { "type": "TreeNode", "name": "root" } ] }, "methods": [ { "params": [ { "type": "integer", "name": "target" } ], "name": "find", "return": { "t...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Design', 'Binary Tree']
1,262
Greatest Sum Divisible by Three
greatest-sum-divisible-by-three
<p>Given an integer array <code>nums</code>, return <em>the <strong>maximum possible sum </strong>of elements of the array such that it is divisible by three</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> nums = [3,6,5,1,8] <strong>Output:</strong> 18 <strong>...
Medium
62.9K
123.9K
62,866
123,900
50.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSumDivThree(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSumDivThree(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
[3,6,5,1,8]
{ "name": "maxSumDivThree", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Greedy', 'Sorting']
1,263
Minimum Moves to Move a Box to Their Target Location
minimum-moves-to-move-a-box-to-their-target-location
<p>A storekeeper is a game in which the player pushes boxes around in a warehouse trying to get them to target locations.</p> <p>The game is represented by an <code>m x n</code> grid of characters <code>grid</code> where each element is a wall, floor, or box.</p> <p>Your task is to move the box <code>&#39;B&#39;</cod...
Hard
29.8K
60.9K
29,768
60,856
48.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minPushBox(vector<vector<char>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minPushBox(char[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python",...
[["#","#","#","#","#","#"],["#","T","#","#","#","#"],["#",".",".","B",".","#"],["#",".","#","#",".","#"],["#",".",".",".","S","#"],["#","#","#","#","#","#"]]
{ "name": "minPushBox", "params": [ { "name": "grid", "type": "character[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Breadth-First Search', 'Heap (Priority Queue)', 'Matrix']
1,264
Page Recommendations
page-recommendations
null
Medium
49K
74.9K
48,956
74,886
65.4%
['page-recommendations-ii', 'strong-friendship']
['Create table If Not Exists Friendship (user1_id int, user2_id int)', 'Create table If Not Exists Likes (user_id int, page_id int)', 'Truncate table Friendship', "insert into Friendship (user1_id, user2_id) values ('1', '2')", "insert into Friendship (user1_id, user2_id) values ('1', '3')", "insert into Friendship (us...
Database
null
{"headers":{"Friendship":["user1_id","user2_id"],"Likes":["user_id","page_id"]},"rows":{"Friendship":[[1,2],[1,3],[1,4],[2,3],[2,4],[2,5],[6,1]],"Likes":[[1,88],[2,23],[3,24],[4,56],[5,11],[6,33],[2,77],[3,77],[6,88]]}}
{"mysql": ["Create table If Not Exists Friendship (user1_id int, user2_id int)", "Create table If Not Exists Likes (user_id int, page_id int)"], "mssql": ["Create table Friendship (user1_id int, user2_id int)", "Create table Likes (user_id int, page_id int)"], "oraclesql": ["Create table Friendship (user1_id int, user2...
{"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']
1,265
Print Immutable Linked List in Reverse
print-immutable-linked-list-in-reverse
null
Medium
62.9K
66.9K
62,875
66,854
94.0%
[]
[]
Algorithms
null
[1,2,3,4]
{ "name": "printOutLinkListinReverse", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "list<integer>" }, "manual": true, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3", "kotlin", "ruby", "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...
['Linked List', 'Two Pointers', 'Stack', 'Recursion']
1,266
Minimum Time Visiting All Points
minimum-time-visiting-all-points
<p>On a 2D plane, there are <code>n</code> points with integer coordinates <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>. Return <em>the <strong>minimum time</strong> in seconds to visit all the points in the order given by </em><code>points</code>.</p> <p>You can move according to these rules:</p> <ul> <l...
Easy
257K
311.5K
257,021
311,522
82.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minTimeToVisitAllPoints(vector<vector<int>>& points) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minTimeToVisitAllPoints(int[][] points) {\n \n }\n}"}, {"value":...
[[1,1],[3,4],[-1,0]]
{ "name": "minTimeToVisitAllPoints", "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', 'Math', 'Geometry']
1,267
Count Servers that Communicate
count-servers-that-communicate
<p>You are given a map of a server center, represented as a <code>m * n</code> integer matrix&nbsp;<code>grid</code>, where 1 means that on that cell there is a server and 0 means that it is no server. Two servers are said to communicate if they are on the same row or on the same column.<br /> <br /> Return the number ...
Medium
187.2K
254.9K
187,198
254,858
73.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countServers(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countServers(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python...
[[1,0],[0,1]]
{ "name": "countServers", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix', 'Counting']
1,268
Search Suggestions System
search-suggestions-system
<p>You are given an array of strings <code>products</code> and a string <code>searchWord</code>.</p> <p>Design a system that suggests at most three product names from <code>products</code> after each character of <code>searchWord</code> is typed. Suggested products should have common prefix with <code>searchWord</code...
Medium
378.1K
581.5K
378,102
581,515
65.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<string>> suggestedProducts(vector<string>& products, string searchWord) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<String>> suggestedProducts(String[] pro...
["mobile","mouse","moneypot","monitor","mousepad"] "mouse"
{ "name": "suggestedProducts", "params": [ { "name": "products", "type": "string[]" }, { "type": "string", "name": "searchWord" } ], "return": { "type": "list<list<string>>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'Binary Search', 'Trie', 'Sorting', 'Heap (Priority Queue)']
1,269
Number of Ways to Stay in the Same Place After Some Steps
number-of-ways-to-stay-in-the-same-place-after-some-steps
<p>You have a pointer at index <code>0</code> in an array of size <code>arrLen</code>. At each step, you can move 1 position to the left, 1 position to the right in the array, or stay in the same place (The pointer should not be placed outside the array at any time).</p> <p>Given two integers <code>steps</code> and <c...
Hard
97K
193.6K
96,954
193,559
50.1%
['number-of-ways-to-reach-a-position-after-exactly-k-steps']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numWays(int steps, int arrLen) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numWays(int steps, int arrLen) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
3 2
{ "name": "numWays", "params": [ { "name": "steps", "type": "integer" }, { "type": "integer", "name": "arrLen" } ], "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']
1,270
All People Report to the Given Manager
all-people-report-to-the-given-manager
null
Medium
61.6K
72.9K
61,589
72,893
84.5%
[]
['Create table If Not Exists Employees (employee_id int, employee_name varchar(30), manager_id int)', 'Truncate table Employees', "insert into Employees (employee_id, employee_name, manager_id) values ('1', 'Boss', '1')", "insert into Employees (employee_id, employee_name, manager_id) values ('3', 'Alice', '3')", "inse...
Database
null
{"headers":{"Employees":["employee_id","employee_name","manager_id"]},"rows":{"Employees":[[1,"Boss",1],[3,"Alice",3],[2,"Bob",1],[4,"Daniel",2],[7,"Luis",4],[8,"John",3],[9,"Angela",8],[77,"Robert",1]]}}
{"mysql": ["Create table If Not Exists Employees (employee_id int, employee_name varchar(30), manager_id int)"], "mssql": ["Create table Employees (employee_id int, employee_name varchar(30), manager_id int)"], "oraclesql": ["Create table Employees (employee_id int, employee_name varchar(30), manager_id int)"], "databa...
{"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']
1,271
Hexspeak
hexspeak
null
Easy
12.1K
20.8K
12,120
20,775
58.3%
[]
[]
Algorithms
null
"257"
{ "name": "toHexspeak", "params": [ { "name": "num", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'String']
1,272
Remove Interval
remove-interval
null
Medium
39.4K
59.1K
39,425
59,144
66.7%
[]
[]
Algorithms
null
[[0,2],[3,4],[5,7]] [1,6]
{ "name": "removeInterval", "params": [ { "name": "intervals", "type": "integer[][]" }, { "type": "integer[]", "name": "toBeRemoved" } ], "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']
1,273
Delete Tree Nodes
delete-tree-nodes
null
Medium
10.9K
17.8K
10,920
17,841
61.2%
[]
[]
Algorithms
null
7 [-1,0,0,1,2,2,2] [1,-2,4,0,-2,-1,-1]
{ "name": "deleteTreeNodes", "params": [ { "name": "nodes", "type": "integer" }, { "type": "integer[]", "name": "parent" }, { "type": "integer[]", "name": "value" } ], "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', 'Tree', 'Depth-First Search', 'Breadth-First Search']
1,274
Number of Ships in a Rectangle
number-of-ships-in-a-rectangle
null
Hard
31K
45.1K
31,015
45,091
68.8%
[]
[]
Algorithms
null
[[1,1],[2,2],[3,3],[5,5]] [4,4] [0,0]
{ "name": "countShips", "params": [ { "name": "ans", "type": "integer[][]" }, { "name": "topRight", "type": "integer[]" }, { "name": "bottomLeft", "type": "integer[]" } ], "return": { "type": "integer" }, "manual": true, "typescriptCustomType...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Interactive']
1,275
Find Winner on a Tic Tac Toe Game
find-winner-on-a-tic-tac-toe-game
<p><strong>Tic-tac-toe</strong> is played by two players <code>A</code> and <code>B</code> on a <code>3 x 3</code> grid. The rules of Tic-Tac-Toe are:</p> <ul> <li>Players take turns placing characters into empty squares <code>&#39; &#39;</code>.</li> <li>The first player <code>A</code> always places <code>&#39;X&#3...
Easy
149.1K
275.5K
149,126
275,538
54.1%
['categorize-box-according-to-criteria']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string tictactoe(vector<vector<int>>& moves) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String tictactoe(int[][] moves) {\n \n }\n}"}, {"value": "python", "text": "Pyth...
[[0,0],[2,0],[1,1],[2,1],[2,2]]
{ "name": "tictactoe", "params": [ { "name": "moves", "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', 'Hash Table', 'Matrix', 'Simulation']
1,276
Number of Burgers with No Waste of Ingredients
number-of-burgers-with-no-waste-of-ingredients
<p>Given two integers <code>tomatoSlices</code> and <code>cheeseSlices</code>. The ingredients of different burgers are as follows:</p> <ul> <li><strong>Jumbo Burger:</strong> <code>4</code> tomato slices and <code>1</code> cheese slice.</li> <li><strong>Small Burger:</strong> <code>2</code> Tomato slices and <code>...
Medium
29.3K
58.3K
29,328
58,284
50.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> numOfBurgers(int tomatoSlices, int cheeseSlices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> numOfBurgers(int tomatoSlices, int cheeseSlices) {\n ...
16 7
{ "name": "numOfBurgers", "params": [ { "name": "tomatoSlices", "type": "integer" }, { "type": "integer", "name": "cheeseSlices" } ], "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...
['Math']
1,277
Count Square Submatrices with All Ones
count-square-submatrices-with-all-ones
<p>Given a <code>m * n</code> matrix of ones and zeros, return how many <strong>square</strong> submatrices have all ones.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> matrix = [ &nbsp; [0,1,1,1], &nbsp; [1,1,1,1], &nbsp; [0,1,1,1] ] <strong>Output:</strong> 15 <s...
Medium
338.6K
430.9K
338,604
430,946
78.6%
['minimum-cost-homecoming-of-a-robot-in-a-grid', 'count-fertile-pyramids-in-a-land']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSquares(vector<vector<int>>& matrix) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSquares(int[][] matrix) {\n \n }\n}"}, {"value": "python", "text": "Py...
[[0,1,1,1],[1,1,1,1],[0,1,1,1]]
{ "name": "countSquares", "params": [ { "name": "matrix", "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...
['Array', 'Dynamic Programming', 'Matrix']
1,278
Palindrome Partitioning III
palindrome-partitioning-iii
<p>You are given a string <code>s</code> containing lowercase letters and an integer <code>k</code>. You need to :</p> <ul> <li>First, change some characters of <code>s</code> to other lowercase English letters.</li> <li>Then divide <code>s</code> into <code>k</code> non-empty disjoint substrings such that each subs...
Hard
32.6K
53.1K
32,593
53,064
61.4%
['palindrome-partitioning-iv', 'maximum-number-of-non-overlapping-palindrome-substrings', 'minimum-changes-to-make-k-semi-palindromes']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int palindromePartition(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int palindromePartition(String s, int k) {\n \n }\n}"}, {"value": "python", "text": ...
"abc" 2
{ "name": "palindromePartition", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming']
1,279
Traffic Light Controlled Intersection
traffic-light-controlled-intersection
null
Easy
17.1K
23.4K
17,065
23,408
72.9%
[]
[]
Concurrency
null
[1,3,5,2,4] [2,1,2,4,3] [10,20,30,40,50]
{ "name": "carArrived", "params": [ { "type": "integer[]", "name": "cars" }, { "type": "integer[]", "name": "directions" }, { "type": "integer[]", "name": "arrivalTimes" } ], "return": { "type": "void" }, "languages": [ "cpp", "java", ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Concurrency']
1,280
Students and Examinations
students-and-examinations
<p>Table: <code>Students</code></p> <pre> +---------------+---------+ | Column Name | Type | +---------------+---------+ | student_id | int | | student_name | varchar | +---------------+---------+ student_id is the primary key (column with unique values) for this table. Each row of this table contains the...
Easy
489K
809.8K
489,043
809,773
60.4%
[]
['Create table If Not Exists Students (student_id int, student_name varchar(20))', 'Create table If Not Exists Subjects (subject_name varchar(20))', 'Create table If Not Exists Examinations (student_id int, subject_name varchar(20))', 'Truncate table Students', "insert into Students (student_id, student_name) values ('...
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":{"Students":["student_id","student_name"],"Subjects":["subject_name"],"Examinations":["student_id","subject_name"]},"rows":{"Students":[[1,"Alice"],[2,"Bob"],[13,"John"],[6,"Alex"]],"Subjects":[["Math"],["Physics"],["Programming"]],"Examinations":[[1,"Math"],[1,"Physics"],[1,"Programming"],[2,"Programming"],...
{"mysql": ["Create table If Not Exists Students (student_id int, student_name varchar(20))", "Create table If Not Exists Subjects (subject_name varchar(20))", "Create table If Not Exists Examinations (student_id int, subject_name varchar(20))"], "mssql": ["Create table Students (student_id int, student_name varchar(20)...
{"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']
1,281
Subtract the Product and Sum of Digits of an Integer
subtract-the-product-and-sum-of-digits-of-an-integer
Given an integer number <code>n</code>, return the difference between the product of its digits and the sum of its digits. <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> n = 234 <strong>Output:</strong> 15 <b>Explanation:</b> Product of digits = 2 * 3 * 4 = 24 Sum of ...
Easy
558.6K
644.6K
558,593
644,613
86.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int subtractProductAndSum(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int subtractProductAndSum(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau...
234
{ "name": "subtractProductAndSum", "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']
1,282
Group the People Given the Group Size They Belong To
group-the-people-given-the-group-size-they-belong-to
<p>There are <code>n</code> people&nbsp;that are split into some unknown number of groups. Each person is labeled with a&nbsp;<strong>unique ID</strong>&nbsp;from&nbsp;<code>0</code>&nbsp;to&nbsp;<code>n - 1</code>.</p> <p>You are given an integer array&nbsp;<code>groupSizes</code>, where <code>groupSizes[i]</code>&nb...
Medium
226.5K
259.3K
226,488
259,287
87.4%
['maximum-number-of-groups-with-increasing-length']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> groupThePeople(vector<int>& groupSizes) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> groupThePeople(int[] groupSizes) {\n \n }\n}"...
[3,3,3,3,3,1,3]
{ "name": "groupThePeople", "params": [ { "name": "groupSizes", "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', 'Hash Table', 'Greedy']
1,283
Find the Smallest Divisor Given a Threshold
find-the-smallest-divisor-given-a-threshold
<p>Given an array of integers <code>nums</code> and an integer <code>threshold</code>, we will choose a positive integer <code>divisor</code>, divide all the array by it, and sum the division&#39;s result. Find the <strong>smallest</strong> <code>divisor</code> such that the result mentioned above is less than or equal...
Medium
288.4K
458.1K
288,424
458,105
63.0%
['minimized-maximum-of-products-distributed-to-any-store']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int smallestDivisor(vector<int>& nums, int threshold) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int smallestDivisor(int[] nums, int threshold) {\n \n }\n}"}, {"value":...
[1,2,5,9] 6
{ "name": "smallestDivisor", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "threshold" } ], "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']
1,284
Minimum Number of Flips to Convert Binary Matrix to Zero Matrix
minimum-number-of-flips-to-convert-binary-matrix-to-zero-matrix
<p>Given a <code>m x n</code> binary matrix <code>mat</code>. In one step, you can choose one cell and flip it and all the four neighbors of it if they exist (Flip is changing <code>1</code> to <code>0</code> and <code>0</code> to <code>1</code>). A pair of cells are called neighbors if they share one edge.</p> <p>Ret...
Hard
36.2K
50.4K
36,233
50,425
71.9%
['minimum-operations-to-remove-adjacent-ones-in-matrix', 'remove-all-ones-with-row-and-column-flips', 'remove-all-ones-with-row-and-column-flips-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minFlips(vector<vector<int>>& mat) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minFlips(int[][] mat) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[[0,0],[0,1]]
{ "name": "minFlips", "params": [ { "name": "mat", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Bit Manipulation', 'Breadth-First Search', 'Matrix']
1,285
Find the Start and End Number of Continuous Ranges
find-the-start-and-end-number-of-continuous-ranges
null
Medium
44.9K
54.7K
44,859
54,744
81.9%
['report-contiguous-dates', 'find-the-missing-ids', 'customers-with-strictly-increasing-purchases']
['Create table If Not Exists Logs (log_id int)', 'Truncate table Logs', "insert into Logs (log_id) values ('1')", "insert into Logs (log_id) values ('2')", "insert into Logs (log_id) values ('3')", "insert into Logs (log_id) values ('7')", "insert into Logs (log_id) values ('8')", "insert into Logs (log_id) values ('10...
Database
null
{"headers":{"Logs":["log_id"]},"rows":{"Logs":[[1],[2],[3],[7],[8],[10]]}}
{"mysql": ["Create table If Not Exists Logs (log_id int)"], "mssql": ["Create table Logs (log_id int)"], "oraclesql": ["Create table Logs (log_id int)"], "database": true, "name": "find_continuous_ranges", "pythondata": ["Logs = pd.DataFrame([], columns=['log_id']).astype({'log_id':'Int64'})"], "postgresql": ["\nCreate...
{"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']
1,286
Iterator for Combination
iterator-for-combination
<p>Design the <code>CombinationIterator</code> class:</p> <ul> <li><code>CombinationIterator(string characters, int combinationLength)</code> Initializes the object with a string <code>characters</code> of <strong>sorted distinct</strong> lowercase English letters and a number <code>combinationLength</code> as argume...
Medium
77.7K
105.7K
77,680
105,731
73.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class CombinationIterator {\npublic:\n CombinationIterator(string characters, int combinationLength) {\n \n }\n \n string next() {\n \n }\n \n bool hasNext() {\n \n }\n};\n\n/**\n * Your CombinationIterator object will be inst...
["CombinationIterator","next","hasNext","next","hasNext","next","hasNext"] [["abc",2],[],[],[],[],[],[]]
{ "classname": "CombinationIterator", "maxbytesperline": 200000, "constructor": { "params": [ { "type": "string", "name": "characters" }, { "type": "integer", "name": "combinationLength" } ] }, "methods": [ { "name": "next", "para...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Backtracking', 'Design', 'Iterator']
1,287
Element Appearing More Than 25% In Sorted Array
element-appearing-more-than-25-in-sorted-array
<p>Given an integer array <strong>sorted</strong> in non-decreasing order, there is exactly one integer in the array that occurs more than 25% of the time, return that integer.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> arr = [1,2,2,6,6,6,6,7,10] <strong>Output:...
Easy
236.6K
387.5K
236,557
387,519
61.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findSpecialInteger(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findSpecialInteger(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Python...
[1,2,2,6,6,6,6,7,10]
{ "name": "findSpecialInteger", "params": [ { "name": "arr", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array']
1,288
Remove Covered Intervals
remove-covered-intervals
<p>Given an array <code>intervals</code> where <code>intervals[i] = [l<sub>i</sub>, r<sub>i</sub>]</code> represent the interval <code>[l<sub>i</sub>, r<sub>i</sub>)</code>, remove all intervals that are covered by another interval in the list.</p> <p>The interval <code>[a, b)</code> is covered by the interval <code>[...
Medium
130.7K
232.7K
130,732
232,746
56.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int removeCoveredIntervals(vector<vector<int>>& intervals) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int removeCoveredIntervals(int[][] intervals) {\n \n }\n}"}, {"val...
[[1,4],[3,6],[2,8]]
{ "name": "removeCoveredIntervals", "params": [ { "name": "intervals", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting']
1,289
Minimum Falling Path Sum II
minimum-falling-path-sum-ii
<p>Given an <code>n x n</code> integer matrix <code>grid</code>, return <em>the minimum sum of a <strong>falling path with non-zero shifts</strong></em>.</p> <p>A <strong>falling path with non-zero shifts</strong> is a choice of exactly one element from each row of <code>grid</code> such that no two elements chosen in...
Hard
151.8K
237.3K
151,770
237,278
64.0%
['minimum-falling-path-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minFallingPathSum(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minFallingPathSum(int[][] grid) {\n \n }\n}"}, {"value": "python", "text...
[[1,2,3],[4,5,6],[7,8,9]]
{ "name": "minFallingPathSum", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Matrix']
1,290
Convert Binary Number in a Linked List to Integer
convert-binary-number-in-a-linked-list-to-integer
<p>Given <code>head</code> which is a reference node to a singly-linked list. The value of each node in the linked list is either <code>0</code> or <code>1</code>. The linked list holds the binary representation of a number.</p> <p>Return the <em>decimal value</em> of the number in the linked list.</p> <p>The <strong...
Easy
537.6K
662.5K
537,626
662,476
81.2%
[]
[]
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,0,1]
{ "name": "getDecimalValue", "params": [ { "name": "head", "type": "ListNode" } ], "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...
['Linked List', 'Math']
1,291
Sequential Digits
sequential-digits
<p>An&nbsp;integer has <em>sequential digits</em> if and only if each digit in the number is one more than the previous digit.</p> <p>Return a <strong>sorted</strong> list of all the integers&nbsp;in the range <code>[low, high]</code>&nbsp;inclusive that have sequential digits.</p> <p>&nbsp;</p> <p><strong class="exa...
Medium
227K
347.8K
226,976
347,801
65.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> sequentialDigits(int low, int high) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> sequentialDigits(int low, int high) {\n \n }\n}"}, {"value": "p...
100 300
{ "name": "sequentialDigits", "params": [ { "name": "low", "type": "integer" }, { "name": "high", "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...
['Enumeration']
1,292
Maximum Side Length of a Square with Sum Less than or Equal to Threshold
maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold
<p>Given a <code>m x n</code> matrix <code>mat</code> and an integer <code>threshold</code>, return <em>the maximum side-length of a square with a sum less than or equal to </em><code>threshold</code><em> or return </em><code>0</code><em> if there is no such square</em>.</p> <p>&nbsp;</p> <p><strong class="example">Ex...
Medium
37K
69.3K
37,028
69,263
53.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSideLength(vector<vector<int>>& mat, int threshold) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSideLength(int[][] mat, int threshold) {\n \n }\n}"}, {"val...
[[1,1,3,2,4,3,2],[1,1,3,2,4,3,2],[1,1,3,2,4,3,2]] 4
{ "name": "maxSideLength", "params": [ { "name": "mat", "type": "integer[][]" }, { "type": "integer", "name": "threshold" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Matrix', 'Prefix Sum']
1,293
Shortest Path in a Grid with Obstacles Elimination
shortest-path-in-a-grid-with-obstacles-elimination
<p>You are given an <code>m x n</code> integer matrix <code>grid</code> where each cell is either <code>0</code> (empty) or <code>1</code> (obstacle). You can move up, down, left, or right from and to an empty cell in <strong>one step</strong>.</p> <p>Return <em>the minimum number of <strong>steps</strong> to walk fro...
Hard
236.1K
519.2K
236,077
519,161
45.5%
['shortest-path-to-get-food', 'minimum-obstacle-removal-to-reach-corner', 'find-a-safe-walk-through-a-grid']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int shortestPath(vector<vector<int>>& grid, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int shortestPath(int[][] grid, int k) {\n \n }\n}"}, {"value": "python", "...
[[0,0,0],[1,1,0],[0,0,0],[0,1,1],[0,0,0]] 1
{ "name": "shortestPath", "params": [ { "name": "grid", "type": "integer[][]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Breadth-First Search', 'Matrix']
1,294
Weather Type in Each Country
weather-type-in-each-country
null
Easy
42.8K
63.8K
42,770
63,818
67.0%
[]
['Create table If Not Exists Countries (country_id int, country_name varchar(20))', 'Create table If Not Exists Weather (country_id int, weather_state int, day date)', 'Truncate table Countries', "insert into Countries (country_id, country_name) values ('2', 'USA')", "insert into Countries (country_id, country_name) va...
Database
null
{"headers":{"Countries":["country_id","country_name"],"Weather":["country_id","weather_state","day"]},"rows":{"Countries":[[2,"USA"],[3,"Australia"],[7,"Peru"],[5,"China"],[8,"Morocco"],[9,"Spain"]],"Weather":[[2,15,"2019-11-01"],[2,12,"2019-10-28"],[2,12,"2019-10-27"],[3,-2,"2019-11-10"],[3,0,"2019-11-11"],[3,3,"2019-...
{"mysql": ["Create table If Not Exists Countries (country_id int, country_name varchar(20))", "Create table If Not Exists Weather (country_id int, weather_state int, day date)"], "mssql": ["Create table Countries (country_id int, country_name varchar(20))", "Create table Weather (country_id int, weather_state int, day ...
{"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']
1,295
Find Numbers with Even Number of Digits
find-numbers-with-even-number-of-digits
<p>Given an array <code>nums</code> of integers, return how many of them contain an <strong>even number</strong> of digits.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> nums = [12,345,2,6,7896] <strong>Output:</strong> 2 <strong>Explanation: </strong>12 contains ...
Easy
783.9K
1M
783,877
1,007,899
77.8%
['finding-3-digit-even-numbers', 'number-of-even-and-odd-bits', 'find-if-digit-game-can-be-won']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findNumbers(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findNumbers(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC...
[12,345,2,6,7896]
{ "name": "findNumbers", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math']
1,296
Divide Array in Sets of K Consecutive Numbers
divide-array-in-sets-of-k-consecutive-numbers
<p>Given an array of integers <code>nums</code> and a positive integer <code>k</code>, check whether it is possible to divide this array into sets of <code>k</code> consecutive numbers.</p> <p>Return <code>true</code> <em>if it is possible</em>.<strong> </strong>Otherwise, return <code>false</code>.</p> <p>&nbsp;</p>...
Medium
109.2K
186.4K
109,163
186,389
58.6%
['split-array-into-consecutive-subsequences', 'all-divisions-with-the-highest-score-of-a-binary-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isPossibleDivide(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isPossibleDivide(int[] nums, int k) {\n \n }\n}"}, {"value": "python"...
[1,2,3,3,4,4,5,6] 4
{ "name": "isPossibleDivide", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Greedy', 'Sorting']
1,297
Maximum Number of Occurrences of a Substring
maximum-number-of-occurrences-of-a-substring
<p>Given a string <code>s</code>, return the maximum number of occurrences of <strong>any</strong> substring under the following rules:</p> <ul> <li>The number of unique characters in the substring must be less than or equal to <code>maxLetters</code>.</li> <li>The substring size must be between <code>minSize</code>...
Medium
68.5K
129.1K
68,482
129,054
53.1%
['rearrange-characters-to-make-target-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxFreq(string s, int maxLetters, int minSize, int maxSize) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxFreq(String s, int maxLetters, int minSize, int maxSize) {\n ...
"aababcaab" 2 3 4
{ "name": "maxFreq", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "maxLetters" }, { "type": "integer", "name": "minSize" }, { "type": "integer", "name": "maxSize" } ], "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']
1,298
Maximum Candies You Can Get from Boxes
maximum-candies-you-can-get-from-boxes
<p>You have <code>n</code> boxes labeled from <code>0</code> to <code>n - 1</code>. You are given four arrays: <code>status</code>, <code>candies</code>, <code>keys</code>, and <code>containedBoxes</code> where:</p> <ul> <li><code>status[i]</code> is <code>1</code> if the <code>i<sup>th</sup></code> box is open and <...
Hard
20.8K
36.2K
20,814
36,198
57.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxCandies(vector<int>& status, vector<int>& candies, vector<vector<int>>& keys, vector<vector<int>>& containedBoxes, vector<int>& initialBoxes) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution ...
[1,0,1,0] [7,5,4,100] [[],[],[1],[]] [[1,2],[3],[],[]] [0]
{ "name": "maxCandies", "params": [ { "name": "status", "type": "integer[]" }, { "type": "integer[]", "name": "candies" }, { "type": "integer[][]", "name": "keys" }, { "type": "integer[][]", "name": "containedBoxes" }, { "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', 'Breadth-First Search', 'Graph']
1,299
Replace Elements with Greatest Element on Right Side
replace-elements-with-greatest-element-on-right-side
<p>Given an array <code>arr</code>,&nbsp;replace every element in that array with the greatest element among the elements to its&nbsp;right, and replace the last element with <code>-1</code>.</p> <p>After doing so, return the array.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>I...
Easy
457.6K
641.3K
457,595
641,275
71.4%
['two-furthest-houses-with-different-colors', 'next-greater-element-iv']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> replaceElements(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] replaceElements(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Py...
[17,18,5,4,6,1]
{ "name": "replaceElements", "params": [ { "name": "arr", "type": "integer[]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array']
1,300
Sum of Mutated Array Closest to Target
sum-of-mutated-array-closest-to-target
<p>Given an integer array <code>arr</code> and a target value <code>target</code>, return the integer <code>value</code> such that when we change all the integers larger than <code>value</code> in the given array to be equal to <code>value</code>, the sum of the array gets as close as possible (in absolute difference) ...
Medium
43.1K
95.6K
43,058
95,620
45.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findBestValue(vector<int>& arr, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findBestValue(int[] arr, int target) {\n \n }\n}"}, {"value": "python", "...
[4,9,3] 10
{ "name": "findBestValue", "params": [ { "name": "arr", "type": "integer[]" }, { "type": "integer", "name": "target" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Sorting']