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,902
Depth of BST Given Insertion Order
depth-of-bst-given-insertion-order
null
Medium
2.7K
6.3K
2,653
6,267
42.3%
[]
[]
Algorithms
null
[2,1,4,3]
{ "name": "maxDepthBST", "params": [ { "name": "order", "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', 'Tree', 'Binary Search Tree', 'Binary Tree', 'Ordered Set']
1,903
Largest Odd Number in String
largest-odd-number-in-string
<p>You are given a string <code>num</code>, representing a large integer. Return <em>the <strong>largest-valued odd</strong> integer (as a string) that is a <strong>non-empty substring</strong> of </em><code>num</code><em>, or an empty string </em><code>&quot;&quot;</code><em> if no odd integer exists</em>.</p> <p>A <...
Easy
378.6K
585.2K
378,638
585,169
64.7%
['largest-3-same-digit-number-in-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string largestOddNumber(string num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String largestOddNumber(String num) {\n \n }\n}"}, {"value": "python", "text": "Python", ...
"52"
{ "name": "largestOddNumber", "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', 'Greedy']
1,904
The Number of Full Rounds You Have Played
the-number-of-full-rounds-you-have-played
<p>You are participating in an online chess tournament. There is a chess round that starts every <code>15</code> minutes. The first round of the day starts at <code>00:00</code>, and after every <code>15</code> minutes, a new round starts.</p> <ul> <li>For example, the second round starts at <code>00:15</code>, the f...
Medium
23.9K
55K
23,883
55,049
43.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfRounds(string loginTime, string logoutTime) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfRounds(String loginTime, String logoutTime) {\n \n }\n}"}...
"09:31" "10:14"
{ "name": "numberOfRounds", "params": [ { "name": "loginTime", "type": "string" }, { "type": "string", "name": "logoutTime" } ], "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']
1,905
Count Sub Islands
count-sub-islands
<p>You are given two <code>m x n</code> binary matrices <code>grid1</code> and <code>grid2</code> containing only <code>0</code>&#39;s (representing water) and <code>1</code>&#39;s (representing land). An <strong>island</strong> is a group of <code>1</code>&#39;s connected <strong>4-directionally</strong> (horizontal o...
Medium
203.8K
279.8K
203,767
279,848
72.8%
['number-of-islands', 'number-of-distinct-islands', 'find-all-groups-of-farmland']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSubIslands(vector<vector<int>>& grid1, vector<vector<int>>& grid2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSubIslands(int[][] grid1, int[][] grid2) {\n ...
[[1,1,1,0,0],[0,1,1,1,1],[0,0,0,0,0],[1,0,0,0,0],[1,1,0,1,1]] [[1,1,1,0,0],[0,0,1,1,1],[0,1,0,0,0],[1,0,1,1,0],[0,1,0,1,0]]
{ "name": "countSubIslands", "params": [ { "name": "grid1", "type": "integer[][]" }, { "type": "integer[][]", "name": "grid2" } ], "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,906
Minimum Absolute Difference Queries
minimum-absolute-difference-queries
<p>The <strong>minimum absolute difference</strong> of an array <code>a</code> is defined as the <strong>minimum value</strong> of <code>|a[i] - a[j]|</code>, where <code>0 &lt;= i &lt; j &lt; a.length</code> and <code>a[i] != a[j]</code>. If all elements of <code>a</code> are the <strong>same</strong>, the minimum abs...
Medium
12.3K
27.7K
12,345
27,657
44.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> minDifference(vector<int>& nums, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] minDifference(int[] nums, int[][] queries) {\n ...
[1,3,4,8] [[0,1],[1,2],[2,3],[0,3]]
{ "name": "minDifference", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[][]", "name": "queries" } ], "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,907
Count Salary Categories
count-salary-categories
<p>Table: <code>Accounts</code></p> <pre> +-------------+------+ | Column Name | Type | +-------------+------+ | account_id | int | | income | int | +-------------+------+ account_id is the primary key (column with unique values) for this table. Each row contains information about the monthly income for one ba...
Medium
193.6K
312.9K
193,606
312,891
61.9%
['create-a-session-bar-chart']
['Create table If Not Exists Accounts (account_id int, income int)', 'Truncate table Accounts', "insert into Accounts (account_id, income) values ('3', '108939')", "insert into Accounts (account_id, income) values ('2', '12747')", "insert into Accounts (account_id, income) values ('8', '87709')", "insert into Accounts ...
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":{"Accounts":["account_id","income"]},"rows":{"Accounts":[[3,108939],[2,12747],[8,87709],[6,91796]]}}
{"mysql": ["Create table If Not Exists Accounts (account_id int, income int)"], "mssql": ["Create table Accounts (account_id int, income int)"], "oraclesql": ["Create table Accounts (account_id int, income int)"], "database": true, "name": "count_salary_categories", "pythondata": ["Accounts = 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,908
Game of Nim
game-of-nim
null
Medium
4.9K
7.7K
4,857
7,722
62.9%
['subtree-removal-game-with-fibonacci-tree']
[]
Algorithms
null
[1]
{ "name": "nimGame", "params": [ { "name": "piles", "type": "integer[]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Dynamic Programming', 'Bit Manipulation', 'Brainteaser', 'Game Theory']
1,909
Remove One Element to Make the Array Strictly Increasing
remove-one-element-to-make-the-array-strictly-increasing
<p>Given a <strong>0-indexed</strong> integer array <code>nums</code>, return <code>true</code> <em>if it can be made <strong>strictly increasing</strong> after removing <strong>exactly one</strong> element, or </em><code>false</code><em> otherwise. If the array is already strictly increasing, return </em><code>true</c...
Easy
76.6K
268.5K
76,597
268,455
28.5%
['steps-to-make-array-non-decreasing', 'find-the-maximum-factor-score-of-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canBeIncreasing(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canBeIncreasing(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
[1,2,10,5,7]
{ "name": "canBeIncreasing", "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']
1,910
Remove All Occurrences of a Substring
remove-all-occurrences-of-a-substring
<p>Given two strings <code>s</code> and <code>part</code>, perform the following operation on <code>s</code> until <strong>all</strong> occurrences of the substring <code>part</code> are removed:</p> <ul> <li>Find the <strong>leftmost</strong> occurrence of the substring <code>part</code> and <strong>remove</strong> ...
Medium
328.6K
421.2K
328,557
421,219
78.0%
['maximum-deletions-on-a-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string removeOccurrences(string s, string part) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String removeOccurrences(String s, String part) {\n \n }\n}"}, {"value": "pyt...
"daabcbaabcbc" "abc"
{ "name": "removeOccurrences", "params": [ { "name": "s", "type": "string" }, { "type": "string", "name": "part" } ], "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', 'Simulation']
1,911
Maximum Alternating Subsequence Sum
maximum-alternating-subsequence-sum
<p>The <strong>alternating sum</strong> of a <strong>0-indexed</strong> array is defined as the <strong>sum</strong> of the elements at <strong>even</strong> indices <strong>minus</strong> the <strong>sum</strong> of the elements at <strong>odd</strong> indices.</p> <ul> <li>For example, the alternating sum of <code>...
Medium
48.7K
83K
48,675
82,951
58.7%
['maximum-alternating-subarray-sum', 'maximum-element-sum-of-a-complete-subset-of-indices', 'maximum-product-of-subsequences-with-an-alternating-sum-equal-to-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\r\npublic:\r\n long long maxAlternatingSum(vector<int>& nums) {\r\n \r\n }\r\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\r\n public long maxAlternatingSum(int[] nums) {\r\n \r\n }\r\n}"}, {"value": ...
[4,2,5,3]
{ "name": "maxAlternatingSum", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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,912
Design Movie Rental System
design-movie-rental-system
<p>You have a movie renting company consisting of <code>n</code> shops. You want to implement a renting system that supports searching for, booking, and returning movies. The system should also support generating a report of the currently rented movies.</p> <p>Each movie is given as a 2D integer array <code>entries</c...
Hard
8.1K
21.8K
8,085
21,779
37.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class MovieRentingSystem {\npublic:\n MovieRentingSystem(int n, vector<vector<int>>& entries) {\n \n }\n \n vector<int> search(int movie) {\n \n }\n \n void rent(int shop, int movie) {\n \n }\n \n void drop(int shop, int...
["MovieRentingSystem","search","rent","rent","report","drop","search"] [[3,[[0,1,5],[0,2,6],[0,3,7],[1,1,4],[1,2,7],[2,1,5]]],[1],[0,1],[1,2],[],[1,2],[2]]
{ "classname": "MovieRentingSystem", "constructor": { "params": [ { "type": "integer", "name": "n" }, { "name": "entries", "type": "integer[][]" } ] }, "methods": [ { "params": [ { "type": "integer", "name": "m...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Design', 'Heap (Priority Queue)', 'Ordered Set']
1,913
Maximum Product Difference Between Two Pairs
maximum-product-difference-between-two-pairs
<p>The <strong>product difference</strong> between two pairs <code>(a, b)</code> and <code>(c, d)</code> is defined as <code>(a * b) - (c * d)</code>.</p> <ul> <li>For example, the product difference between <code>(5, 6)</code> and <code>(2, 7)</code> is <code>(5 * 6) - (2 * 7) = 16</code>.</li> </ul> <p>Given an in...
Easy
272.7K
329.1K
272,707
329,126
82.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\r\npublic:\r\n int maxProductDifference(vector<int>& nums) {\r\n \r\n }\r\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\r\n public int maxProductDifference(int[] nums) {\r\n \r\n }\r\n}"}, {"value": "...
[5,6,2,7,4]
{ "name": "maxProductDifference", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting']
1,914
Cyclically Rotating a Grid
cyclically-rotating-a-grid
<p>You are given an <code>m x n</code> integer matrix <code>grid</code>​​​, where <code>m</code> and <code>n</code> are both <strong>even</strong> integers, and an integer <code>k</code>.</p> <p>The matrix is composed of several layers, which is shown in the below image, where each color is its own layer:</p> <p><img...
Medium
14K
27.9K
13,964
27,889
50.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\r\npublic:\r\n vector<vector<int>> rotateGrid(vector<vector<int>>& grid, int k) {\r\n \r\n }\r\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\r\n public int[][] rotateGrid(int[][] grid, int k) {\r\n \r\n ...
[[40,10],[30,20]] 1
{ "name": "rotateGrid", "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', 'Matrix', 'Simulation']
1,915
Number of Wonderful Substrings
number-of-wonderful-substrings
<p>A <strong>wonderful</strong> string is a string where <strong>at most one</strong> letter appears an <strong>odd</strong> number of times.</p> <ul> <li>For example, <code>&quot;ccjjc&quot;</code> and <code>&quot;abab&quot;</code> are wonderful, but <code>&quot;ab&quot;</code> is not.</li> </ul> <p>Given a string ...
Medium
86.3K
129.5K
86,334
129,511
66.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\r\npublic:\r\n long long wonderfulSubstrings(string word) {\r\n \r\n }\r\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\r\n public long wonderfulSubstrings(String word) {\r\n \r\n }\r\n}"}, {"value": "...
"aba"
{ "name": "wonderfulSubstrings", "params": [ { "name": "word", "type": "string" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Bit Manipulation', 'Prefix Sum']
1,916
Count Ways to Build Rooms in an Ant Colony
count-ways-to-build-rooms-in-an-ant-colony
<p>You are an ant tasked with adding <code>n</code> new rooms numbered <code>0</code> to <code>n-1</code> to your colony. You are given the expansion plan as a <strong>0-indexed</strong> integer array of length <code>n</code>, <code>prevRoom</code>, where <code>prevRoom[i]</code> indicates that you must build room <cod...
Hard
8.9K
18.5K
8,925
18,502
48.2%
['count-anagrams', 'count-the-number-of-good-subsequences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\r\npublic:\r\n int waysToBuildRooms(vector<int>& prevRoom) {\r\n \r\n }\r\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\r\n public int waysToBuildRooms(int[] prevRoom) {\r\n \r\n }\r\n}"}, {"value": "...
[-1,0,1]
{ "name": "waysToBuildRooms", "params": [ { "name": "prevRoom", "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', 'Tree', 'Graph', 'Topological Sort', 'Combinatorics']
1,917
Leetcodify Friends Recommendations
leetcodify-friends-recommendations
null
Hard
7.7K
27.8K
7,703
27,774
27.7%
['leetcodify-similar-friends', 'strong-friendship']
['Create table If Not Exists Listens (user_id int, song_id int, day date)', 'Create table If Not Exists Friendship (user1_id int, user2_id int)', 'Truncate table Listens', "insert into Listens (user_id, song_id, day) values ('1', '10', '2021-03-15')", "insert into Listens (user_id, song_id, day) values ('1', '11', '202...
Database
null
{"headers":{"Listens":["user_id","song_id","day"],"Friendship":["user1_id","user2_id"]},"rows":{"Listens":[[1,10,"2021-03-15"],[1,11,"2021-03-15"],[1,12,"2021-03-15"],[2,10,"2021-03-15"],[2,11,"2021-03-15"],[2,12,"2021-03-15"],[3,10,"2021-03-15"],[3,11,"2021-03-15"],[3,12,"2021-03-15"],[4,10,"2021-03-15"],[4,11,"2021-0...
{"mysql": ["Create table If Not Exists Listens (user_id int, song_id int, day date)", "Create table If Not Exists Friendship (user1_id int, user2_id int)"], "mssql": ["Create table Listens (user_id int, song_id int, day date)", "Create table Friendship (user1_id int, user2_id int)"], "oraclesql": ["Create table Listens...
{"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,918
Kth Smallest Subarray Sum
kth-smallest-subarray-sum
null
Medium
5.1K
9.6K
5,064
9,598
52.8%
[]
[]
Algorithms
null
[2,1,3] 4
{ "name": "kthSmallestSubarraySum", "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', 'Binary Search', 'Sliding Window']
1,919
Leetcodify Similar Friends
leetcodify-similar-friends
null
Hard
6.7K
15.7K
6,695
15,747
42.5%
['leetcodify-friends-recommendations']
['Create table If Not Exists Listens (user_id int, song_id int, day date)', 'Create table If Not Exists Friendship (user1_id int, user2_id int)', 'Truncate table Listens', "insert into Listens (user_id, song_id, day) values ('1', '10', '2021-03-15')", "insert into Listens (user_id, song_id, day) values ('1', '11', '202...
Database
null
{"headers":{"Listens":["user_id","song_id","day"],"Friendship":["user1_id","user2_id"]},"rows":{"Listens":[[1,10,"2021-03-15"],[1,11,"2021-03-15"],[1,12,"2021-03-15"],[2,10,"2021-03-15"],[2,11,"2021-03-15"],[2,12,"2021-03-15"],[3,10,"2021-03-15"],[3,11,"2021-03-15"],[3,12,"2021-03-15"],[4,10,"2021-03-15"],[4,11,"2021-0...
{"mysql": ["Create table If Not Exists Listens (user_id int, song_id int, day date)", "Create table If Not Exists Friendship (user1_id int, user2_id int)"], "mssql": ["Create table Listens (user_id int, song_id int, day date)", "Create table Friendship (user1_id int, user2_id int)"], "oraclesql": ["Create table Listens...
{"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,920
Build Array from Permutation
build-array-from-permutation
<p>Given a <strong>zero-based permutation</strong> <code>nums</code> (<strong>0-indexed</strong>), build an array <code>ans</code> of the <strong>same length</strong> where <code>ans[i] = nums[nums[i]]</code> for each <code>0 &lt;= i &lt; nums.length</code> and return it.</p> <p>A <strong>zero-based permutation</stron...
Easy
623K
690.4K
623,049
690,447
90.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> buildArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] buildArray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[0,2,1,5,3,4]
{ "name": "buildArray", "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', 'Simulation']
1,921
Eliminate Maximum Number of Monsters
eliminate-maximum-number-of-monsters
<p>You are playing a video game where you are defending your city from a group of <code>n</code> monsters. You are given a <strong>0-indexed</strong> integer array <code>dist</code> of size <code>n</code>, where <code>dist[i]</code> is the <strong>initial distance</strong> in kilometers of the <code>i<sup>th</sup></cod...
Medium
115.4K
227.1K
115,354
227,065
50.8%
['minimum-health-to-beat-game', 'minimum-time-to-kill-all-monsters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int eliminateMaximum(vector<int>& dist, vector<int>& speed) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int eliminateMaximum(int[] dist, int[] speed) {\n \n }\n}"}, {"va...
[1,3,4] [1,1,1]
{ "name": "eliminateMaximum", "params": [ { "name": "dist", "type": "integer[]" }, { "type": "integer[]", "name": "speed" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting']
1,922
Count Good Numbers
count-good-numbers
<p>A digit string is <strong>good</strong> if the digits <strong>(0-indexed)</strong> at <strong>even</strong> indices are <strong>even</strong> and the digits at <strong>odd</strong> indices are <strong>prime</strong> (<code>2</code>, <code>3</code>, <code>5</code>, or <code>7</code>).</p> <ul> <li>For example, <cod...
Medium
111.9K
229.5K
111,874
229,516
48.7%
['count-the-number-of-arrays-with-k-matching-adjacent-elements']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countGoodNumbers(long long n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countGoodNumbers(long n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC...
1
{ "name": "countGoodNumbers", "params": [ { "name": "n", "type": "long" } ], "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', 'Recursion']
1,923
Longest Common Subpath
longest-common-subpath
<p>There is a country of <code>n</code> cities numbered from <code>0</code> to <code>n - 1</code>. In this country, there is a road connecting <b>every pair</b> of cities.</p> <p>There are <code>m</code> friends numbered from <code>0</code> to <code>m - 1</code> who are traveling through the country. Each one of them ...
Hard
8.6K
31K
8,629
30,954
27.9%
['reconstruct-itinerary', 'maximum-length-of-repeated-subarray']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestCommonSubpath(int n, vector<vector<int>>& paths) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestCommonSubpath(int n, int[][] paths) {\n \n }\n}"}, {"v...
5 [[0,1,2,3,4],[2,3,4],[4,0,1,2,3]]
{ "name": "longestCommonSubpath", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "paths" } ], "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', 'Rolling Hash', 'Suffix Array', 'Hash Function']
1,924
Erect the Fence II
erect-the-fence-ii
null
Hard
821
1.7K
821
1,655
49.6%
['erect-the-fence']
[]
Algorithms
null
[[1,1],[2,2],[2,0],[2,4],[3,3],[4,2]]
{ "name": "outerTrees", "params": [ { "name": "trees", "type": "integer[][]" } ], "return": { "type": "double[]" }, "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', 'Math', 'Geometry']
1,925
Count Square Sum Triples
count-square-sum-triples
<p>A <strong>square triple</strong> <code>(a,b,c)</code> is a triple where <code>a</code>, <code>b</code>, and <code>c</code> are <strong>integers</strong> and <code>a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup></code>.</p> <p>Given an integer <code>n</code>, return <em>the number of <strong>square triples</strong> su...
Easy
53.9K
78.5K
53,881
78,497
68.6%
['number-of-unequal-triplets-in-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countTriples(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countTriples(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So...
5
{ "name": "countTriples", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Enumeration']
1,926
Nearest Exit from Entrance in Maze
nearest-exit-from-entrance-in-maze
<p>You are given an <code>m x n</code> matrix <code>maze</code> (<strong>0-indexed</strong>) with empty cells (represented as <code>&#39;.&#39;</code>) and walls (represented as <code>&#39;+&#39;</code>). You are also given the <code>entrance</code> of the maze, where <code>entrance = [entrance<sub>row</sub>, entrance<...
Medium
215.5K
455.5K
215,518
455,485
47.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int nearestExit(vector<vector<char>>& maze, vector<int>& entrance) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int nearestExit(char[][] maze, int[] entrance) {\n \n }\n}...
[["+","+",".","+"],[".",".",".","+"],["+","+","+","."]] [1,2]
{ "name": "nearestExit", "params": [ { "name": "maze", "type": "character[][]" }, { "type": "integer[]", "name": "entrance" } ], "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,927
Sum Game
sum-game
<p>Alice and Bob take turns playing a game, with <strong>Alice</strong><strong>&nbsp;starting first</strong>.</p> <p>You are given a string <code>num</code> of <strong>even length</strong> consisting of digits and <code>&#39;?&#39;</code> characters. On each turn, a player will do the following if there is still at le...
Medium
13.8K
28.7K
13,826
28,735
48.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool sumGame(string num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean sumGame(String num) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cla...
"5023"
{ "name": "sumGame", "params": [ { "name": "num", "type": "string" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'String', 'Greedy', 'Game Theory']
1,928
Minimum Cost to Reach Destination in Time
minimum-cost-to-reach-destination-in-time
<p>There is a country of <code>n</code> cities numbered from <code>0</code> to <code>n - 1</code> where <strong>all the cities are connected</strong> by bi-directional roads. The roads are represented as a 2D integer array <code>edges</code> where <code>edges[i] = [x<sub>i</sub>, y<sub>i</sub>, time<sub>i</sub>]</code>...
Hard
24.1K
61.4K
24,130
61,376
39.3%
['maximum-cost-of-trip-with-k-highways', 'maximum-path-quality-of-a-graph', 'minimum-cost-to-reach-city-with-discounts', 'find-minimum-time-to-reach-last-room-i', 'find-minimum-time-to-reach-last-room-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minCost(int maxTime, vector<vector<int>>& edges, vector<int>& passingFees) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minCost(int maxTime, int[][] edges, int[] passingFee...
30 [[0,1,10],[1,2,10],[2,5,10],[0,3,1],[3,4,10],[4,5,15]] [5,1,2,20,20,3]
{ "name": "minCost", "params": [ { "name": "maxTime", "type": "integer" }, { "type": "integer[][]", "name": "edges" }, { "type": "integer[]", "name": "passingFees" } ], "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', 'Graph']
1,929
Concatenation of Array
concatenation-of-array
<p>Given an integer array <code>nums</code> of length <code>n</code>, you want to create an array <code>ans</code> of length <code>2n</code> where <code>ans[i] == nums[i]</code> and <code>ans[i + n] == nums[i]</code> for <code>0 &lt;= i &lt; n</code> (<strong>0-indexed</strong>).</p> <p>Specifically, <code>ans</code> ...
Easy
987.4K
1.1M
987,429
1,092,101
90.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getConcatenation(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getConcatenation(int[] nums) {\n \n }\n}"}, {"value": "python", "text":...
[1,2,1]
{ "name": "getConcatenation", "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', 'Simulation']
1,930
Unique Length-3 Palindromic Subsequences
unique-length-3-palindromic-subsequences
<p>Given a string <code>s</code>, return <em>the number of <strong>unique palindromes of length three</strong> that are a <strong>subsequence</strong> of </em><code>s</code>.</p> <p>Note that even if there are multiple ways to obtain the same subsequence, it is still only counted <strong>once</strong>.</p> <p>A <stro...
Medium
252.9K
356.8K
252,888
356,808
70.9%
['count-palindromic-subsequences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countPalindromicSubsequence(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countPalindromicSubsequence(String s) {\n \n }\n}"}, {"value": "python", "text"...
"aabca"
{ "name": "countPalindromicSubsequence", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Bit Manipulation', 'Prefix Sum']
1,931
Painting a Grid With Three Different Colors
painting-a-grid-with-three-different-colors
<p>You are given two integers <code>m</code> and <code>n</code>. Consider an <code>m x n</code> grid where each cell is initially white. You can paint each cell <strong>red</strong>, <strong>green</strong>, or <strong>blue</strong>. All cells <strong>must</strong> be painted.</p> <p>Return<em> the number of ways to co...
Hard
10.8K
19.1K
10,821
19,057
56.8%
['number-of-ways-to-paint-n-3-grid']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int colorTheGrid(int m, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int colorTheGrid(int m, int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo...
1 1
{ "name": "colorTheGrid", "params": [ { "name": "m", "type": "integer" }, { "type": "integer", "name": "n" } ], "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,932
Merge BSTs to Create Single BST
merge-bsts-to-create-single-bst
<p>You are given <code>n</code> <strong>BST (binary search tree) root nodes</strong> for <code>n</code> separate BSTs stored in an array <code>trees</code> (<strong>0-indexed</strong>). Each BST in <code>trees</code> has <strong>at most 3 nodes</strong>, and no two roots have the same value. In one operation, you can:<...
Hard
11.8K
30.2K
11,836
30,164
39.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[[2,1],[3,2,5],[5,4]]
{ "name": "canMerge", "params": [ { "name": "trees", "type": "list<TreeNode>" } ], "return": { "type": "TreeNode" }, "manual": true }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Binary Search', 'Tree', 'Depth-First Search', 'Binary Tree']
1,933
Check if String Is Decomposable Into Value-Equal Substrings
check-if-string-is-decomposable-into-value-equal-substrings
null
Easy
4.3K
8.5K
4,307
8,501
50.7%
[]
[]
Algorithms
null
"000111000"
{ "name": "isDecomposable", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
1,934
Confirmation Rate
confirmation-rate
<p>Table: <code>Signups</code></p> <pre> +----------------+----------+ | Column Name | Type | +----------------+----------+ | user_id | int | | time_stamp | datetime | +----------------+----------+ user_id is the column of unique values for this table. Each row contains information about the sig...
Medium
400.2K
658.6K
400,212
658,580
60.8%
[]
['Create table If Not Exists Signups (user_id int, time_stamp datetime)', "Create table If Not Exists Confirmations (user_id int, time_stamp datetime, action ENUM('confirmed','timeout'))", 'Truncate table Signups', "insert into Signups (user_id, time_stamp) values ('3', '2020-03-21 10:16:13')", "insert into Signups (us...
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": {"Signups": ["user_id", "time_stamp"], "Confirmations": ["user_id", "time_stamp", "action"]}, "rows": {"Signups": [[3, "2020-03-21 10:16:13"], [7, "2020-01-04 13:57:59"], [2, "2020-07-29 23:09:44"], [6, "2020-12-09 10:39:37"]], "Confirmations": [[3, "2021-01-06 03:30:46", "timeout"], [3, "2021-07-14 14:00:0...
{"mysql": ["Create table If Not Exists Signups (user_id int, time_stamp datetime)", "Create table If Not Exists Confirmations (user_id int, time_stamp datetime, action ENUM('confirmed','timeout'))"], "mssql": ["Create table Signups (user_id int, time_stamp datetime)", "Create table Confirmations (user_id int, time_stam...
{"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,935
Maximum Number of Words You Can Type
maximum-number-of-words-you-can-type
<p>There is a malfunctioning keyboard where some letter keys do not work. All other keys on the keyboard work properly.</p> <p>Given a string <code>text</code> of words separated by a single space (no leading or trailing spaces) and a string <code>brokenLetters</code> of all <strong>distinct</strong> letter keys that ...
Easy
70.6K
94.8K
70,595
94,828
74.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int canBeTypedWords(string text, string brokenLetters) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int canBeTypedWords(String text, String brokenLetters) {\n \n }\n}"}, ...
"hello world" "ad"
{ "name": "canBeTypedWords", "params": [ { "name": "text", "type": "string" }, { "type": "string", "name": "brokenLetters" } ], "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']
1,936
Add Minimum Number of Rungs
add-minimum-number-of-rungs
<p>You are given a <strong>strictly increasing</strong> integer array <code>rungs</code> that represents the <strong>height</strong> of rungs on a ladder. You are currently on the <strong>floor</strong> at height <code>0</code>, and you want to reach the last rung.</p> <p>You are also given an integer <code>dist</code...
Medium
32.1K
74.2K
32,068
74,217
43.2%
['cutting-ribbons']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int addRungs(vector<int>& rungs, int dist) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int addRungs(int[] rungs, int dist) {\n \n }\n}"}, {"value": "python", "text": "Py...
[1,3,5,10] 2
{ "name": "addRungs", "params": [ { "name": "rungs", "type": "integer[]" }, { "type": "integer", "name": "dist" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy']
1,937
Maximum Number of Points with Cost
maximum-number-of-points-with-cost
<p>You are given an <code>m x n</code> integer matrix <code>points</code> (<strong>0-indexed</strong>). Starting with <code>0</code> points, you want to <strong>maximize</strong> the number of points you can get from the matrix.</p> <p>To gain points, you must pick one cell in <strong>each row</strong>. Picking the ce...
Medium
149.3K
352.6K
149,348
352,572
42.4%
['minimum-path-sum', 'minimize-the-difference-between-target-and-chosen-elements']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxPoints(vector<vector<int>>& points) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxPoints(int[][] points) {\n \n }\n}"}, {"value": "python", "text": "P...
[[1,2,3],[1,5,1],[3,1,1]]
{ "name": "maxPoints", "params": [ { "name": "points", "type": "integer[][]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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,938
Maximum Genetic Difference Query
maximum-genetic-difference-query
<p>There is a rooted tree consisting of <code>n</code> nodes numbered <code>0</code> to <code>n - 1</code>. Each node&#39;s number denotes its <strong>unique genetic value</strong> (i.e. the genetic value of node <code>x</code> is <code>x</code>). The <strong>genetic difference</strong> between two genetic values is de...
Hard
6.6K
15K
6,572
15,002
43.8%
['maximum-xor-with-an-element-from-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> maxGeneticDifference(vector<int>& parents, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] maxGeneticDifference(int[] parents, int[][] ...
[-1,0,1,1] [[0,2],[3,2],[2,5]]
{ "name": "maxGeneticDifference", "params": [ { "name": "parents", "type": "integer[]" }, { "type": "integer[][]", "name": "queries" } ], "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', 'Depth-First Search', 'Trie']
1,939
Users That Actively Request Confirmation Messages
users-that-actively-request-confirmation-messages
null
Easy
12.8K
22.7K
12,838
22,686
56.6%
[]
['Create table If Not Exists Signups (user_id int, time_stamp datetime)', "Create table If Not Exists Confirmations (user_id int, time_stamp datetime, action ENUM('confirmed','timeout'))", 'Truncate table Signups', "insert into Signups (user_id, time_stamp) values ('3', '2020-03-21 10:16:13')", "insert into Signups (us...
Database
null
{"headers": {"Signups": ["user_id", "time_stamp"], "Confirmations": ["user_id", "time_stamp", "action"]}, "rows": {"Signups": [[3, "2020-03-21 10:16:13"], [7, "2020-01-04 13:57:59"], [2, "2020-07-29 23:09:44"], [6, "2020-12-09 10:39:37"]], "Confirmations": [[3, "2021-01-06 03:30:46", "timeout"], [3, "2021-01-06 03:37:4...
{"mysql": ["Create table If Not Exists Signups (user_id int, time_stamp datetime)", "Create table If Not Exists Confirmations (user_id int, time_stamp datetime, action ENUM('confirmed','timeout'))"], "mssql": ["Create table Signups (user_id int, time_stamp datetime)", "Create table Confirmations (user_id int, time_stam...
{"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,940
Longest Common Subsequence Between Sorted Arrays
longest-common-subsequence-between-sorted-arrays
null
Medium
14.3K
17.6K
14,315
17,610
81.3%
['merge-two-sorted-lists']
[]
Algorithms
null
[[1,3,4],[1,4,7,9]]
{ "name": "longestCommonSubsequence", "params": [ { "name": "arrays", "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', 'Counting']
1,941
Check if All Characters Have Equal Number of Occurrences
check-if-all-characters-have-equal-number-of-occurrences
<p>Given a string <code>s</code>, return <code>true</code><em> if </em><code>s</code><em> is a <strong>good</strong> string, or </em><code>false</code><em> otherwise</em>.</p> <p>A string <code>s</code> is <strong>good</strong> if <strong>all</strong> the characters that appear in <code>s</code> have the <strong>same<...
Easy
139.3K
177.5K
139,260
177,549
78.4%
['rings-and-rods', 'make-number-of-distinct-characters-equal']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool areOccurrencesEqual(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean areOccurrencesEqual(String s) {\n \n }\n}"}, {"value": "python", "text": "Python",...
"abacbc"
{ "name": "areOccurrencesEqual", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Counting']
1,942
The Number of the Smallest Unoccupied Chair
the-number-of-the-smallest-unoccupied-chair
<p>There is a party where <code>n</code> friends numbered from <code>0</code> to <code>n - 1</code> are attending. There is an <strong>infinite</strong> number of chairs in this party that are numbered from <code>0</code> to <code>infinity</code>. When a friend arrives at the party, they sit on the unoccupied chair wit...
Medium
122.3K
202.2K
122,314
202,163
60.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int smallestChair(vector<vector<int>>& times, int targetFriend) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int smallestChair(int[][] times, int targetFriend) {\n \n }\n...
[[1,4],[2,3],[4,6]] 1
{ "name": "smallestChair", "params": [ { "type": "integer[][]", "name": "times" }, { "type": "integer", "name": "targetFriend" } ], "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', 'Heap (Priority Queue)']
1,943
Describe the Painting
describe-the-painting
<p>There is a long and thin painting that can be represented by a number line. The painting was painted with multiple overlapping segments where each segment was painted with a <strong>unique</strong> color. You are given a 2D integer array <code>segments</code>, where <code>segments[i] = [start<sub>i</sub>, end<sub>i<...
Medium
15.9K
31.3K
15,896
31,306
50.8%
['average-height-of-buildings-in-each-segment', 'amount-of-new-area-painted-each-day', 'shifting-letters-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<long long>> splitPainting(vector<vector<int>>& segments) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Long>> splitPainting(int[][] segments) {\n \n ...
[[1,4,5],[4,7,7],[1,7,9]]
{ "name": "splitPainting", "params": [ { "name": "segments", "type": "integer[][]" } ], "return": { "type": "list<list<long>>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Sorting', 'Prefix Sum']
1,944
Number of Visible People in a Queue
number-of-visible-people-in-a-queue
<p>There are <code>n</code> people standing in a queue, and they numbered from <code>0</code> to <code>n - 1</code> in <strong>left to right</strong> order. You are given an array <code>heights</code> of <strong>distinct</strong> integers where <code>heights[i]</code> represents the height of the <code>i<sup>th</sup></...
Hard
76.4K
108K
76,387
107,972
70.7%
['buildings-with-an-ocean-view', 'sum-of-subarray-ranges', 'sum-of-total-strength-of-wizards', 'number-of-people-that-can-be-seen-in-a-grid', 'find-building-where-alice-and-bob-can-meet']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> canSeePersonsCount(vector<int>& heights) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] canSeePersonsCount(int[] heights) {\n \n }\n}"}, {"value": "python...
[10,6,8,5,11,9]
{ "name": "canSeePersonsCount", "params": [ { "type": "integer[]", "name": "heights" } ], "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', 'Stack', 'Monotonic Stack']
1,945
Sum of Digits of String After Convert
sum-of-digits-of-string-after-convert
<p>You are given a string <code>s</code> consisting of lowercase English letters, and an integer <code>k</code>. Your task is to <em>convert</em> the string into an integer by a special process, and then <em>transform</em> it by summing its digits repeatedly <code>k</code> times. More specifically, perform the followin...
Easy
221.5K
296.5K
221,506
296,505
74.7%
['happy-number', 'add-digits', 'count-integers-with-even-digit-sum', 'minimum-element-after-replacement-with-digit-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getLucky(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getLucky(String s, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode...
"iiii" 1
{ "name": "getLucky", "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', 'Simulation']
1,946
Largest Number After Mutating Substring
largest-number-after-mutating-substring
<p>You are given a string <code>num</code>, which represents a large integer. You are also given a <strong>0-indexed</strong> integer array <code>change</code> of length <code>10</code> that maps each digit <code>0-9</code> to another digit. More formally, digit <code>d</code> maps to digit <code>change[d]</code>.</p> ...
Medium
23.3K
63.8K
23,337
63,800
36.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string maximumNumber(string num, vector<int>& change) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String maximumNumber(String num, int[] change) {\n \n }\n}"}, {"value":...
"132" [9,8,5,0,3,6,4,2,6,8]
{ "name": "maximumNumber", "params": [ { "name": "num", "type": "string" }, { "type": "integer[]", "name": "change" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'Greedy']
1,947
Maximum Compatibility Score Sum
maximum-compatibility-score-sum
<p>There is a survey that consists of <code>n</code> questions where each question&#39;s answer is either <code>0</code> (no) or <code>1</code> (yes).</p> <p>The survey was given to <code>m</code> students numbered from <code>0</code> to <code>m - 1</code> and <code>m</code> mentors numbered from <code>0</code> to <co...
Medium
29.4K
46.7K
29,426
46,722
63.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxCompatibilitySum(vector<vector<int>>& students, vector<vector<int>>& mentors) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxCompatibilitySum(int[][] students, int[][] ...
[[1,1,0],[1,0,1],[0,0,1]] [[1,0,0],[0,0,1],[1,1,0]]
{ "name": "maxCompatibilitySum", "params": [ { "name": "students", "type": "integer[][]" }, { "type": "integer[][]", "name": "mentors" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Bitmask']
1,948
Delete Duplicate Folders in System
delete-duplicate-folders-in-system
<p>Due to a bug, there are many duplicate folders in a file system. You are given a 2D array <code>paths</code>, where <code>paths[i]</code> is an array representing an absolute path to the <code>i<sup>th</sup></code> folder in the file system.</p> <ul> <li>For example, <code>[&quot;one&quot;, &quot;two&quot;, &quot;...
Hard
9.9K
18.5K
9,892
18,467
53.6%
['find-duplicate-file-in-system', 'find-duplicate-subtrees']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<string>> deleteDuplicateFolder(vector<vector<string>>& paths) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<String>> deleteDuplicateFolder(List<List<String>>...
[["a"],["c"],["d"],["a","b"],["c","b"],["d","a"]]
{ "name": "deleteDuplicateFolder", "params": [ { "name": "paths", "type": "list<list<string>>" } ], "return": { "type": "list<list<string>>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String', 'Trie', 'Hash Function']
1,949
Strong Friendship
strong-friendship
null
Medium
14.2K
26.1K
14,217
26,116
54.4%
['page-recommendations', 'page-recommendations-ii', 'leetcodify-friends-recommendations']
['Create table If Not Exists Friendship (user1_id int, user2_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 (user1_id, user2_id) values ('2', '3')", "insert into Friendship (...
Database
null
{"headers":{"Friendship":["user1_id","user2_id"]},"rows":{"Friendship":[[1,2],[1,3],[2,3],[1,4],[2,4],[1,5],[2,5],[1,7],[3,7],[1,6],[3,6],[2,6]]}}
{"mysql": ["Create table If Not Exists Friendship (user1_id int, user2_id int)"], "mssql": ["Create table Friendship (user1_id int, user2_id int)"], "oraclesql": ["Create table Friendship (user1_id int, user2_id int)"], "database": true, "name": "strong_friendship", "pythondata": ["Friendship = 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,950
Maximum of Minimum Values in All Subarrays
maximum-of-minimum-values-in-all-subarrays
null
Medium
3.3K
6.9K
3,326
6,943
47.9%
[]
[]
Algorithms
null
[0,1,2,4]
{ "name": "findMaximums", "params": [ { "name": "nums", "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', 'Stack', 'Monotonic Stack']
1,951
All the Pairs With the Maximum Number of Common Followers
all-the-pairs-with-the-maximum-number-of-common-followers
null
Medium
13K
18.8K
13,012
18,814
69.2%
[]
['Create table If Not Exists Relations (user_id int, follower_id int)', 'Truncate table Relations', "insert into Relations (user_id, follower_id) values ('1', '3')", "insert into Relations (user_id, follower_id) values ('2', '3')", "insert into Relations (user_id, follower_id) values ('7', '3')", "insert into Relations...
Database
null
{"headers":{"Relations":["user_id","follower_id"]},"rows":{"Relations":[[1,3],[2,3],[7,3],[1,4],[2,4],[7,4],[1,5],[2,6],[7,5]]}}
{"mysql": ["Create table If Not Exists Relations (user_id int, follower_id int)"], "mssql": ["Create table Relations (user_id int, follower_id int)"], "oraclesql": ["Create table Relations (user_id int, follower_id int)"], "database": true, "name": "find_pairs", "pythondata": ["Relations = pd.DataFrame([], columns=['us...
{"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,952
Three Divisors
three-divisors
<p>Given an integer <code>n</code>, return <code>true</code><em> if </em><code>n</code><em> has <strong>exactly three positive divisors</strong>. Otherwise, return </em><code>false</code>.</p> <p>An integer <code>m</code> is a <strong>divisor</strong> of <code>n</code> if there exists an integer <code>k</code> such th...
Easy
97.7K
156.8K
97,742
156,848
62.3%
['find-greatest-common-divisor-of-array', 'smallest-even-multiple']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isThree(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isThree(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solutio...
2
{ "name": "isThree", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Enumeration', 'Number Theory']
1,953
Maximum Number of Weeks for Which You Can Work
maximum-number-of-weeks-for-which-you-can-work
<p>There are <code>n</code> projects numbered from <code>0</code> to <code>n - 1</code>. You are given an integer array <code>milestones</code> where each <code>milestones[i]</code> denotes the number of milestones the <code>i<sup>th</sup></code> project has.</p> <p>You can work on the projects following these two rul...
Medium
26.7K
65.1K
26,747
65,051
41.1%
['task-scheduler']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long numberOfWeeks(vector<int>& milestones) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long numberOfWeeks(int[] milestones) {\n \n }\n}"}, {"value": "python", "tex...
[1,2,3]
{ "name": "numberOfWeeks", "params": [ { "name": "milestones", "type": "integer[]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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']
1,954
Minimum Garden Perimeter to Collect Enough Apples
minimum-garden-perimeter-to-collect-enough-apples
<p>In a garden represented as an infinite 2D grid, there is an apple tree planted at <strong>every</strong> integer coordinate. The apple tree planted at an integer coordinate <code>(i, j)</code> has <code>|i| + |j|</code> apples growing on it.</p> <p>You will buy an axis-aligned <strong>square plot</strong> of land t...
Medium
18.9K
34.9K
18,895
34,875
54.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumPerimeter(long long neededApples) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumPerimeter(long neededApples) {\n \n }\n}"}, {"value": "python"...
1
{ "name": "minimumPerimeter", "params": [ { "name": "neededApples", "type": "long" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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']
1,955
Count Number of Special Subsequences
count-number-of-special-subsequences
<p>A sequence is <strong>special</strong> if it consists of a <strong>positive</strong> number of <code>0</code>s, followed by a <strong>positive</strong> number of <code>1</code>s, then a <strong>positive</strong> number of <code>2</code>s.</p> <ul> <li>For example, <code>[0,1,2]</code> and <code>[0,0,1,1,1,2]</code...
Hard
13.5K
26.2K
13,515
26,203
51.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSpecialSubsequences(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSpecialSubsequences(int[] nums) {\n \n }\n}"}, {"value": "python", "...
[0,1,2,2]
{ "name": "countSpecialSubsequences", "params": [ { "name": "nums", "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']
1,956
Minimum Time For K Virus Variants to Spread
minimum-time-for-k-virus-variants-to-spread
null
Hard
1.1K
2.3K
1,147
2,340
49.0%
[]
[]
Algorithms
null
[[1,1],[6,1]] 2
{ "name": "minDayskVariants", "params": [ { "name": "points", "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', 'Math', 'Binary Search', 'Geometry', 'Enumeration']
1,957
Delete Characters to Make Fancy String
delete-characters-to-make-fancy-string
<p>A <strong>fancy string</strong> is a string where no <strong>three</strong> <strong>consecutive</strong> characters are equal.</p> <p>Given a string <code>s</code>, delete the <strong>minimum</strong> possible number of characters from <code>s</code> to make it <strong>fancy</strong>.</p> <p>Return <em>the final s...
Easy
192.4K
268.7K
192,378
268,656
71.6%
['find-maximum-removals-from-source-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string makeFancyString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String makeFancyString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau...
"leeetcode"
{ "name": "makeFancyString", "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']
1,958
Check if Move is Legal
check-if-move-is-legal
<p>You are given a <strong>0-indexed</strong> <code>8 x 8</code> grid <code>board</code>, where <code>board[r][c]</code> represents the cell <code>(r, c)</code> on a game board. On the board, free cells are represented by <code>&#39;.&#39;</code>, white cells are represented by <code>&#39;W&#39;</code>, and black cells...
Medium
16.1K
32.7K
16,069
32,749
49.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkMove(vector<vector<char>>& board, int rMove, int cMove, char color) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkMove(char[][] board, int rMove, int cMove, c...
[[".",".",".","B",".",".",".","."],[".",".",".","W",".",".",".","."],[".",".",".","W",".",".",".","."],[".",".",".","W",".",".",".","."],["W","B","B",".","W","W","W","B"],[".",".",".","B",".",".",".","."],[".",".",".","B",".",".",".","."],[".",".",".","W",".",".",".","."]] 4 3 "B"
{ "name": "checkMove", "params": [ { "name": "board", "type": "character[][]" }, { "type": "integer", "name": "rMove" }, { "type": "integer", "name": "cMove" }, { "type": "character", "name": "color" } ], "return": { "type": "bo...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Enumeration']
1,959
Minimum Total Space Wasted With K Resizing Operations
minimum-total-space-wasted-with-k-resizing-operations
<p>You are currently designing a dynamic array. You are given a <strong>0-indexed</strong> integer array <code>nums</code>, where <code>nums[i]</code> is the number of elements that will be in the array at time <code>i</code>. In addition, you are given an integer <code>k</code>, the <strong>maximum</strong> number of ...
Medium
9.6K
22.6K
9,636
22,597
42.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minSpaceWastedKResizing(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minSpaceWastedKResizing(int[] nums, int k) {\n \n }\n}"}, {"value":...
[10,20] 0
{ "name": "minSpaceWastedKResizing", "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', 'Dynamic Programming']
1,960
Maximum Product of the Length of Two Palindromic Substrings
maximum-product-of-the-length-of-two-palindromic-substrings
<p>You are given a <strong>0-indexed</strong> string <code>s</code> and are tasked with finding two <strong>non-intersecting palindromic </strong>substrings of <strong>odd</strong> length such that the product of their lengths is maximized.</p> <p>More formally, you want to choose four integers <code>i</code>, <code>j...
Hard
4.3K
14.3K
4,350
14,338
30.3%
['maximum-product-of-the-length-of-two-palindromic-subsequences', 'minimum-cost-to-make-array-equal']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxProduct(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxProduct(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ...
"ababbb"
{ "name": "maxProduct", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Rolling Hash', 'Hash Function']
1,961
Check If String Is a Prefix of Array
check-if-string-is-a-prefix-of-array
<p>Given a string <code>s</code> and an array of strings <code>words</code>, determine whether <code>s</code> is a <strong>prefix string</strong> of <code>words</code>.</p> <p>A string <code>s</code> is a <strong>prefix string</strong> of <code>words</code> if <code>s</code> can be made by concatenating the first <cod...
Easy
71.2K
135.9K
71,250
135,923
52.4%
['count-prefixes-of-a-given-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isPrefixString(string s, vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isPrefixString(String s, String[] words) {\n \n }\n}"}, {"value"...
"iloveleetcode" ["i","love","leetcode","apples"]
{ "name": "isPrefixString", "params": [ { "name": "s", "type": "string" }, { "type": "string[]", "name": "words" } ], "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', 'Two Pointers', 'String']
1,962
Remove Stones to Minimize the Total
remove-stones-to-minimize-the-total
<p>You are given a <strong>0-indexed</strong> integer array <code>piles</code>, where <code>piles[i]</code> represents the number of stones in the <code>i<sup>th</sup></code> pile, and an integer <code>k</code>. You should apply the following operation <strong>exactly</strong> <code>k</code> times:</p> <ul> <li>Choos...
Medium
125.9K
195.7K
125,932
195,722
64.3%
['minimum-operations-to-halve-array-sum', 'maximal-score-after-applying-k-operations', 'take-gifts-from-the-richest-pile']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minStoneSum(vector<int>& piles, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minStoneSum(int[] piles, int k) {\n \n }\n}"}, {"value": "python", "text": "Py...
[5,4,9] 2
{ "name": "minStoneSum", "params": [ { "name": "piles", "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', 'Greedy', 'Heap (Priority Queue)']
1,963
Minimum Number of Swaps to Make the String Balanced
minimum-number-of-swaps-to-make-the-string-balanced
<p>You are given a <strong>0-indexed</strong> string <code>s</code> of <strong>even</strong> length <code>n</code>. The string consists of <strong>exactly</strong> <code>n / 2</code> opening brackets <code>&#39;[&#39;</code> and <code>n / 2</code> closing brackets <code>&#39;]&#39;</code>.</p> <p>A string is called <s...
Medium
224.2K
287.8K
224,174
287,769
77.9%
['remove-invalid-parentheses', 'minimum-add-to-make-parentheses-valid', 'minimum-remove-to-make-valid-parentheses', 'minimum-insertions-to-balance-a-parentheses-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minSwaps(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minSwaps(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solu...
"][]["
{ "name": "minSwaps", "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...
['Two Pointers', 'String', 'Stack', 'Greedy']
1,964
Find the Longest Valid Obstacle Course at Each Position
find-the-longest-valid-obstacle-course-at-each-position
<p>You want to build some obstacle courses. You are given a <strong>0-indexed</strong> integer array <code>obstacles</code> of length <code>n</code>, where <code>obstacles[i]</code> describes the height of the <code>i<sup>th</sup></code> obstacle.</p> <p>For every index <code>i</code> between <code>0</code> and <code>...
Hard
63.2K
101.1K
63,182
101,136
62.5%
['longest-increasing-subsequence']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> longestObstacleCourseAtEachPosition(vector<int>& obstacles) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] longestObstacleCourseAtEachPosition(int[] obstacles) {\n ...
[1,2,3,2]
{ "name": "longestObstacleCourseAtEachPosition", "params": [ { "name": "obstacles", "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', 'Binary Indexed Tree']
1,965
Employees With Missing Information
employees-with-missing-information
<p>Table: <code>Employees</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | employee_id | int | | name | varchar | +-------------+---------+ employee_id is the column with unique values for this table. Each row of this table indicates the name of the employee w...
Easy
144.7K
198.7K
144,660
198,715
72.8%
[]
['Create table If Not Exists Employees (employee_id int, name varchar(30))', 'Create table If Not Exists Salaries (employee_id int, salary int)', 'Truncate table Employees', "insert into Employees (employee_id, name) values ('2', 'Crew')", "insert into Employees (employee_id, name) values ('4', 'Haven')", "insert into ...
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":{"Employees":["employee_id","name"],"Salaries":["employee_id","salary"]},"rows":{"Employees":[[2,"Crew"],[4,"Haven"],[5,"Kristian"]],"Salaries":[[5,76071],[1,22517],[4,63539]]}}
{"mysql": ["Create table If Not Exists Employees (employee_id int, name varchar(30))", "Create table If Not Exists Salaries (employee_id int, salary int)"], "mssql": ["Create table Employees (employee_id int, name varchar(30))", "Create table Salaries (employee_id int, salary int)"], "oraclesql": ["Create table Employe...
{"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,966
Binary Searchable Numbers in an Unsorted Array
binary-searchable-numbers-in-an-unsorted-array
null
Medium
3.1K
4.9K
3,059
4,899
62.4%
[]
[]
Algorithms
null
[7]
{ "name": "binarySearchableNumbers", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search']
1,967
Number of Strings That Appear as Substrings in Word
number-of-strings-that-appear-as-substrings-in-word
<p>Given an array of strings <code>patterns</code> and a string <code>word</code>, return <em>the <strong>number</strong> of strings in </em><code>patterns</code><em> that exist as a <strong>substring</strong> in </em><code>word</code>.</p> <p>A <strong>substring</strong> is a contiguous sequence of characters within ...
Easy
89.4K
109.4K
89,380
109,395
81.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numOfStrings(vector<string>& patterns, string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numOfStrings(String[] patterns, String word) {\n \n }\n}"}, {"val...
["a","abc","bc","d"] "abc"
{ "name": "numOfStrings", "params": [ { "name": "patterns", "type": "string[]" }, { "type": "string", "name": "word" } ], "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']
1,968
Array With Elements Not Equal to Average of Neighbors
array-with-elements-not-equal-to-average-of-neighbors
<p>You are given a <strong>0-indexed</strong> array <code>nums</code> of <strong>distinct</strong> integers. You want to rearrange the elements in the array such that every element in the rearranged array is <strong>not</strong> equal to the <strong>average</strong> of its neighbors.</p> <p>More formally, the rearrang...
Medium
43.8K
87.5K
43,755
87,547
50.0%
['wiggle-sort', 'wiggle-sort-ii', 'design-neighbor-sum-service']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> rearrangeArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] rearrangeArray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Py...
[1,2,3,4,5]
{ "name": "rearrangeArray", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting']
1,969
Minimum Non-Zero Product of the Array Elements
minimum-non-zero-product-of-the-array-elements
<p>You are given a positive integer <code>p</code>. Consider an array <code>nums</code> (<strong>1-indexed</strong>) that consists of the integers in the <strong>inclusive</strong> range <code>[1, 2<sup>p</sup> - 1]</code> in their binary representations. You are allowed to do the following operation <strong>any</stron...
Medium
13.5K
37.3K
13,486
37,280
36.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minNonZeroProduct(int p) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minNonZeroProduct(int p) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":...
1
{ "name": "minNonZeroProduct", "params": [ { "name": "p", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Greedy', 'Recursion']
1,970
Last Day Where You Can Still Cross
last-day-where-you-can-still-cross
<p>There is a <strong>1-based</strong> binary matrix where <code>0</code> represents land and <code>1</code> represents water. You are given integers <code>row</code> and <code>col</code> representing the number of rows and columns in the matrix, respectively.</p> <p>Initially on day <code>0</code>, the <strong>entire...
Hard
61.1K
98.3K
61,074
98,319
62.1%
['bricks-falling-when-hit', 'escape-the-spreading-fire']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int latestDayToCross(int row, int col, vector<vector<int>>& cells) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int latestDayToCross(int row, int col, int[][] cells) {\n \n ...
2 2 [[1,1],[2,1],[1,2],[2,2]]
{ "name": "latestDayToCross", "params": [ { "name": "row", "type": "integer" }, { "type": "integer", "name": "col" }, { "type": "integer[][]", "name": "cells" } ], "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', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix']
1,971
Find if Path Exists in Graph
find-if-path-exists-in-graph
<p>There is a <strong>bi-directional</strong> graph with <code>n</code> vertices, where each vertex is labeled from <code>0</code> to <code>n - 1</code> (<strong>inclusive</strong>). The edges in the graph are represented as a 2D integer array <code>edges</code>, where each <code>edges[i] = [u<sub>i</sub>, v<sub>i</sub...
Easy
542.7K
1M
542,741
1,006,950
53.9%
['valid-arrangement-of-pairs', 'paths-in-maze-that-lead-to-same-room']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool validPath(int n, vector<vector<int>>& edges, int source, int destination) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean validPath(int n, int[][] edges, int source, int ...
3 [[0,1],[1,2],[2,0]] 0 2
{ "name": "validPath", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "edges" }, { "type": "integer", "name": "source" }, { "type": "integer", "name": "destination" } ], "return": { "type": "boo...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Union Find', 'Graph']
1,972
First and Last Call On the Same Day
first-and-last-call-on-the-same-day
null
Hard
11K
21.5K
10,963
21,511
51.0%
[]
['Create table If Not Exists Calls (caller_id int, recipient_id int, call_time datetime)', 'Truncate table Calls', "insert into Calls (caller_id, recipient_id, call_time) values ('8', '4', '2021-08-24 17:46:07')", "insert into Calls (caller_id, recipient_id, call_time) values ('4', '8', '2021-08-24 19:57:13')", "insert...
Database
null
{"headers": {"Calls": ["caller_id", "recipient_id", "call_time"]}, "rows": {"Calls": [[8, 4, "2021-08-24 17:46:07"], [4, 8, "2021-08-24 19:57:13"], [5, 1, "2021-08-11 05:28:44"], [8, 3, "2021-08-17 04:04:15"], [11, 3, "2021-08-17 13:07:00"], [8, 11, "2021-08-17 22:22:22"]]}}
{"mysql": ["Create table If Not Exists Calls (caller_id int, recipient_id int, call_time datetime)"], "mssql": ["Create table Calls (caller_id int, recipient_id int, call_time datetime)"], "oraclesql": ["Create table Calls (caller_id int, recipient_id int, call_time date)", "ALTER SESSION SET nls_date_format='YYYY-MM-D...
{"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,973
Count Nodes Equal to Sum of Descendants
count-nodes-equal-to-sum-of-descendants
null
Medium
14.8K
19.3K
14,834
19,271
77.0%
['most-frequent-subtree-sum', 'maximum-average-subtree', 'count-nodes-equal-to-average-of-subtree']
[]
Algorithms
null
[10,3,4,2,1]
{ "name": "equalToDescendants", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Binary Tree']
1,974
Minimum Time to Type Word Using Special Typewriter
minimum-time-to-type-word-using-special-typewriter
<p>There is a special typewriter with lowercase English letters <code>&#39;a&#39;</code> to <code>&#39;z&#39;</code> arranged in a <strong>circle</strong> with a <strong>pointer</strong>. A character can <strong>only</strong> be typed if the pointer is pointing to that character. The pointer is <strong>initially</stron...
Easy
55.8K
72.5K
55,846
72,476
77.1%
['minimum-distance-to-type-a-word-using-two-fingers']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minTimeToType(string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minTimeToType(String word) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo...
"abc"
{ "name": "minTimeToType", "params": [ { "name": "word", "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']
1,975
Maximum Matrix Sum
maximum-matrix-sum
<p>You are given an <code>n x n</code> integer <code>matrix</code>. You can do the following operation <strong>any</strong> number of times:</p> <ul> <li>Choose any two <strong>adjacent</strong> elements of <code>matrix</code> and <strong>multiply</strong> each of them by <code>-1</code>.</li> </ul> <p>Two elements ...
Medium
109.2K
165.6K
109,232
165,642
65.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxMatrixSum(vector<vector<int>>& matrix) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxMatrixSum(int[][] matrix) {\n \n }\n}"}, {"value": "python", "tex...
[[1,-1],[-1,1]]
{ "name": "maxMatrixSum", "params": [ { "name": "matrix", "type": "integer[][]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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,976
Number of Ways to Arrive at Destination
number-of-ways-to-arrive-at-destination
<p>You are in a city that consists of <code>n</code> intersections numbered from <code>0</code> to <code>n - 1</code> with <strong>bi-directional</strong> roads between some intersections. The inputs are generated such that you can reach any intersection from any other intersection and that there is at most one road be...
Medium
183.5K
485.2K
183,521
485,174
37.8%
['all-paths-from-source-to-target', 'path-with-maximum-probability', 'second-minimum-time-to-reach-destination']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countPaths(int n, vector<vector<int>>& roads) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countPaths(int n, int[][] roads) {\n \n }\n}"}, {"value": "python", "te...
7 [[0,6,7],[0,1,2],[1,2,3],[1,3,3],[6,3,3],[3,5,1],[6,5,1],[2,5,1],[0,4,5],[4,6,2]]
{ "name": "countPaths", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "roads" } ], "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', 'Graph', 'Topological Sort', 'Shortest Path']
1,977
Number of Ways to Separate Numbers
number-of-ways-to-separate-numbers
<p>You wrote down many <strong>positive</strong> integers in a string called <code>num</code>. However, you realized that you forgot to add commas to seperate the different numbers. You remember that the list of integers was <strong>non-decreasing</strong> and that <strong>no</strong> integer had leading zeros.</p> <p...
Hard
7.4K
35.2K
7,354
35,171
20.9%
['decode-ways', 'decode-ways-ii', 'restore-the-array', 'number-of-beautiful-partitions']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfCombinations(string num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfCombinations(String num) {\n \n }\n}"}, {"value": "python", "text": "Python"...
"327"
{ "name": "numberOfCombinations", "params": [ { "name": "num", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming', 'Suffix Array']
1,978
Employees Whose Manager Left the Company
employees-whose-manager-left-the-company
<p>Table: <code>Employees</code></p> <pre> +-------------+----------+ | Column Name | Type | +-------------+----------+ | employee_id | int | | name | varchar | | manager_id | int | | salary | int | +-------------+----------+ In SQL, employee_id is the primary key for this table. This ...
Easy
230.1K
471.3K
230,143
471,331
48.8%
[]
['Create table If Not Exists Employees (employee_id int, name varchar(20), manager_id int, salary int)', 'Truncate table Employees', "insert into Employees (employee_id, name, manager_id, salary) values ('3', 'Mila', '9', '60301')", "insert into Employees (employee_id, name, manager_id, salary) values ('12', 'Antonella...
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": {"Employees": ["employee_id", "name", "manager_id", "salary"]}, "rows": {"Employees": [[3, "Mila", 9, 60301], [12, "Antonella", null, 31000], [13, "Emery", null, 67084], [1, "Kalel", 11, 21241], [9, "Mikaela", null, 50937], [11, "Joziah", 6, 28485]]}}
{"mysql": ["Create table If Not Exists Employees (employee_id int, name varchar(20), manager_id int, salary int)"], "mssql": ["Create table Employees (employee_id int, name varchar(20), manager_id int, salary int)"], "oraclesql": ["Create table Employees (employee_id int, name varchar(20), manager_id int, salary 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,979
Find Greatest Common Divisor of Array
find-greatest-common-divisor-of-array
<p>Given an integer array <code>nums</code>, return<strong> </strong><em>the <strong>greatest common divisor</strong> of the smallest number and largest number in </em><code>nums</code>.</p> <p>The <strong>greatest common divisor</strong> of two numbers is the largest positive integer that evenly divides both numbers....
Easy
179.5K
228.8K
179,471
228,829
78.4%
['greatest-common-divisor-of-strings', 'number-of-different-subsequences-gcds', 'three-divisors', 'smallest-even-multiple', 'number-of-subarrays-with-gcd-equal-to-k', 'find-the-number-of-subsequences-with-equal-gcd', 'maximum-subarray-with-equal-products']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findGCD(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findGCD(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "c...
[2,5,6,9,10]
{ "name": "findGCD", "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', 'Number Theory']
1,980
Find Unique Binary String
find-unique-binary-string
<p>Given an array of strings <code>nums</code> containing <code>n</code> <strong>unique</strong> binary strings each of length <code>n</code>, return <em>a binary string of length </em><code>n</code><em> that <strong>does not appear</strong> in </em><code>nums</code><em>. If there are multiple answers, you may return <...
Medium
288.7K
363.8K
288,666
363,801
79.3%
['missing-number', 'find-all-numbers-disappeared-in-an-array', 'random-pick-with-blacklist']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string findDifferentBinaryString(vector<string>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String findDifferentBinaryString(String[] nums) {\n \n }\n}"}, {"value...
["01","10"]
{ "name": "findDifferentBinaryString", "params": [ { "type": "string[]", "name": "nums" } ], "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', 'Backtracking']
1,981
Minimize the Difference Between Target and Chosen Elements
minimize-the-difference-between-target-and-chosen-elements
<p>You are given an <code>m x n</code> integer matrix <code>mat</code> and an integer <code>target</code>.</p> <p>Choose one integer from <strong>each row</strong> in the matrix such that the <strong>absolute difference</strong> between <code>target</code> and the <strong>sum</strong> of the chosen elements is <strong...
Medium
33.4K
93.5K
33,385
93,459
35.7%
['partition-equal-subset-sum', 'closest-subsequence-sum', 'maximum-number-of-points-with-cost']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimizeTheDifference(vector<vector<int>>& mat, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimizeTheDifference(int[][] mat, int target) {\n \n }\n...
[[1,2,3],[4,5,6],[7,8,9]] 13
{ "name": "minimizeTheDifference", "params": [ { "name": "mat", "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', 'Dynamic Programming', 'Matrix']
1,983
Widest Pair of Indices With Equal Range Sum
widest-pair-of-indices-with-equal-range-sum
null
Medium
3.2K
6.1K
3,226
6,089
53.0%
[]
[]
Algorithms
null
[1,1,0,1] [0,1,1,0]
{ "name": "widestPairOfIndices", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Prefix Sum']
1,984
Minimum Difference Between Highest and Lowest of K Scores
minimum-difference-between-highest-and-lowest-of-k-scores
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>, where <code>nums[i]</code> represents the score of the <code>i<sup>th</sup></code> student. You are also given an integer <code>k</code>.</p> <p>Pick the scores of any <code>k</code> students from the array so that the <strong>difference</s...
Easy
103.8K
178.4K
103,840
178,390
58.2%
['array-partition']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumDifference(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumDifference(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "...
[90] 1
{ "name": "minimumDifference", "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', 'Sliding Window', 'Sorting']
1,985
Find the Kth Largest Integer in the Array
find-the-kth-largest-integer-in-the-array
<p>You are given an array of strings <code>nums</code> and an integer <code>k</code>. Each string in <code>nums</code> represents an integer without leading zeros.</p> <p>Return <em>the string that represents the </em><code>k<sup>th</sup></code><em><strong> largest integer</strong> in </em><code>nums</code>.</p> <p><...
Medium
82.6K
177.3K
82,619
177,254
46.6%
['kth-largest-element-in-an-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string kthLargestNumber(vector<string>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String kthLargestNumber(String[] nums, int k) {\n \n }\n}"}, {"value": "...
["3","6","7","10"] 4
{ "name": "kthLargestNumber", "params": [ { "name": "nums", "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...
['Array', 'String', 'Divide and Conquer', 'Sorting', 'Heap (Priority Queue)', 'Quickselect']
1,986
Minimum Number of Work Sessions to Finish the Tasks
minimum-number-of-work-sessions-to-finish-the-tasks
<p>There are <code>n</code> tasks assigned to you. The task times are represented as an integer array <code>tasks</code> of length <code>n</code>, where the <code>i<sup>th</sup></code> task takes <code>tasks[i]</code> hours to finish. A <strong>work session</strong> is when you work for <strong>at most</strong> <code>s...
Medium
29.8K
89K
29,848
89,002
33.5%
['smallest-sufficient-team', 'fair-distribution-of-cookies', 'find-minimum-time-to-finish-all-jobs', 'find-minimum-time-to-finish-all-jobs-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minSessions(vector<int>& tasks, int sessionTime) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minSessions(int[] tasks, int sessionTime) {\n \n }\n}"}, {"value": "...
[1,2,3] 3
{ "name": "minSessions", "params": [ { "name": "tasks", "type": "integer[]" }, { "type": "integer", "name": "sessionTime" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Bitmask']
1,987
Number of Unique Good Subsequences
number-of-unique-good-subsequences
<p>You are given a binary string <code>binary</code>. A <strong>subsequence</strong> of <code>binary</code> is considered <strong>good</strong> if it is <strong>not empty</strong> and has <strong>no leading zeros</strong> (with the exception of <code>&quot;0&quot;</code>).</p> <p>Find the number of <strong>unique good...
Hard
14.7K
28.2K
14,660
28,190
52.0%
['distinct-subsequences', 'distinct-subsequences-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfUniqueGoodSubsequences(string binary) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfUniqueGoodSubsequences(String binary) {\n \n }\n}"}, {"value": ...
"001"
{ "name": "numberOfUniqueGoodSubsequences", "params": [ { "name": "binary", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming']
1,988
Find Cutoff Score for Each School
find-cutoff-score-for-each-school
null
Medium
12.6K
18.9K
12,616
18,853
66.9%
[]
['Create table If Not Exists Schools (school_id int, capacity int)', 'Create table If Not Exists Exam (score int, student_count int)', 'Truncate table Schools', "insert into Schools (school_id, capacity) values ('11', '151')", "insert into Schools (school_id, capacity) values ('5', '48')", "insert into Schools (school_...
Database
null
{"headers":{"Schools":["school_id","capacity"],"Exam":["score","student_count"]},"rows":{"Schools":[[11,151],[5,48],[9,9],[10,99]],"Exam":[[975,10],[966,60],[844,76],[749,76],[744,100]]}}
{"mysql": ["Create table If Not Exists Schools (school_id int, capacity int)", "Create table If Not Exists Exam (score int, student_count int)"], "mssql": ["Create table Schools (school_id int, capacity int)", "Create table Exam (score int, student_count int)"], "oraclesql": ["Create table Schools (school_id int, capac...
{"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,989
Maximum Number of People That Can Be Caught in Tag
maximum-number-of-people-that-can-be-caught-in-tag
null
Medium
2.4K
4.9K
2,442
4,916
49.7%
['minimum-number-of-food-buckets-to-feed-the-hamsters']
[]
Algorithms
null
[0,1,0,1,0] 3
{ "name": "catchMaximumAmountofPeople", "params": [ { "name": "team", "type": "integer[]" }, { "type": "integer", "name": "dist" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy']
1,990
Count the Number of Experiments
count-the-number-of-experiments
null
Medium
8.4K
17.2K
8,412
17,157
49.0%
[]
["Create table If Not Exists Experiments (experiment_id int, platform ENUM('Android', 'IOS', 'Web'), experiment_name ENUM('Reading', 'Sports', 'Programming'))", 'Truncate table Experiments', "insert into Experiments (experiment_id, platform, experiment_name) values ('4', 'IOS', 'Programming')", "insert into Experiments...
Database
null
{"headers":{"Experiments":["experiment_id","platform","experiment_name"]},"rows":{"Experiments":[[4,"IOS","Programming"],[13,"IOS","Sports"],[14,"Android","Reading"],[8,"Web","Reading"],[12,"Web","Reading"],[18,"Web","Programming"]]}}
{"mysql": ["Create table If Not Exists Experiments (experiment_id int, platform ENUM('Android', 'IOS', 'Web'), experiment_name ENUM('Reading', 'Sports', 'Programming'))"], "mssql": ["Create table Experiments (experiment_id int, platform VARCHAR(7) NOT NULL CHECK (platform IN ('Android', 'IOS', 'Web')), experiment_name ...
{"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,991
Find the Middle Index in Array
find-the-middle-index-in-array
<p>Given a <strong>0-indexed</strong> integer array <code>nums</code>, find the <strong>leftmost</strong> <code>middleIndex</code> (i.e., the smallest amongst all the possible ones).</p> <p>A <code>middleIndex</code> is an index where <code>nums[0] + nums[1] + ... + nums[middleIndex-1] == nums[middleIndex+1] + nums[mi...
Easy
125.5K
184.9K
125,482
184,870
67.9%
['find-pivot-index', 'partition-array-into-three-parts-with-equal-sum', 'number-of-ways-to-split-array', 'maximum-sum-score-of-array', 'left-and-right-sum-differences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMiddleIndex(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMiddleIndex(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[2,3,-1,8,4]
{ "name": "findMiddleIndex", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Prefix Sum']
1,992
Find All Groups of Farmland
find-all-groups-of-farmland
<p>You are given a <strong>0-indexed</strong> <code>m x n</code> binary matrix <code>land</code> where a <code>0</code> represents a hectare of forested land and a <code>1</code> represents a hectare of farmland.</p> <p>To keep the land organized, there are designated rectangular areas of hectares that consist <strong...
Medium
135.5K
179.5K
135,516
179,513
75.5%
['number-of-islands', 'count-sub-islands']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> findFarmland(vector<vector<int>>& land) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] findFarmland(int[][] land) {\n \n }\n}"}, {"value": "pyth...
[[1,0,0],[0,1,1],[0,1,1]]
{ "name": "findFarmland", "params": [ { "name": "land", "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', 'Depth-First Search', 'Breadth-First Search', 'Matrix']
1,993
Operations on Tree
operations-on-tree
<p>You are given a tree with <code>n</code> nodes numbered from <code>0</code> to <code>n - 1</code> in the form of a parent array <code>parent</code> where <code>parent[i]</code> is the parent of the <code>i<sup>th</sup></code> node. The root of the tree is node <code>0</code>, so <code>parent[0] = -1</code> since it ...
Medium
20K
42.4K
19,956
42,376
47.1%
['throne-inheritance']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class LockingTree {\npublic:\n LockingTree(vector<int>& parent) {\n \n }\n \n bool lock(int num, int user) {\n \n }\n \n bool unlock(int num, int user) {\n \n }\n \n bool upgrade(int num, int user) {\n \n }\n};...
["LockingTree","lock","unlock","unlock","lock","upgrade","lock"] [[[-1,0,0,1,1,2,2]],[2,2],[2,3],[2,2],[4,5],[0,1],[0,1]]
{ "classname": "LockingTree", "constructor": { "params": [ { "type": "integer[]", "name": "parent" } ] }, "methods": [ { "params": [ { "type": "integer", "name": "num" }, { "type": "integer", "name": "u...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Design']
1,994
The Number of Good Subsets
the-number-of-good-subsets
<p>You are given an integer array <code>nums</code>. We call a subset of <code>nums</code> <strong>good</strong> if its product can be represented as a product of one or more <strong>distinct prime</strong> numbers.</p> <ul> <li>For example, if <code>nums = [1, 2, 3, 4]</code>: <ul> <li><code>[2, 3]</code>, <code...
Hard
9.5K
26.6K
9,496
26,612
35.7%
['smallest-sufficient-team', 'fair-distribution-of-cookies', 'number-of-ways-to-wear-different-hats-to-each-other']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfGoodSubsets(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfGoodSubsets(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Py...
[1,2,3,4]
{ "name": "numberOfGoodSubsets", "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', 'Dynamic Programming', 'Bit Manipulation', 'Bitmask']
1,995
Count Special Quadruplets
count-special-quadruplets
<p>Given a <strong>0-indexed</strong> integer array <code>nums</code>, return <em>the number of <strong>distinct</strong> quadruplets</em> <code>(a, b, c, d)</code> <em>such that:</em></p> <ul> <li><code>nums[a] + nums[b] + nums[c] == nums[d]</code>, and</li> <li><code>a &lt; b &lt; c &lt; d</code></li> </ul> <p>&n...
Easy
50.4K
80.7K
50,431
80,714
62.5%
['4sum', 'increasing-triplet-subsequence', 'count-good-triplets', 'count-increasing-quadruplets']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countQuadruplets(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countQuadruplets(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",...
[1,2,3,6]
{ "name": "countQuadruplets", "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', 'Enumeration']
1,996
The Number of Weak Characters in the Game
the-number-of-weak-characters-in-the-game
<p>You are playing a game that contains multiple characters, and each of the characters has <strong>two</strong> main properties: <strong>attack</strong> and <strong>defense</strong>. You are given a 2D integer array <code>properties</code> where <code>properties[i] = [attack<sub>i</sub>, defense<sub>i</sub>]</code> re...
Medium
110.4K
250.1K
110,406
250,144
44.1%
['russian-doll-envelopes', 'maximum-height-by-stacking-cuboids']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfWeakCharacters(vector<vector<int>>& properties) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfWeakCharacters(int[][] properties) {\n \n }\n}"}, {"v...
[[5,5],[6,3],[3,6]]
{ "name": "numberOfWeakCharacters", "params": [ { "name": "properties", "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', 'Stack', 'Greedy', 'Sorting', 'Monotonic Stack']
1,997
First Day Where You Have Been in All the Rooms
first-day-where-you-have-been-in-all-the-rooms
<p>There are <code>n</code> rooms you need to visit, labeled from <code>0</code> to <code>n - 1</code>. Each day is labeled, starting from <code>0</code>. You will go in and visit one room a day.</p> <p>Initially on day <code>0</code>, you visit room <code>0</code>. The <strong>order</strong> you visit the rooms for t...
Medium
12.1K
30.7K
12,094
30,665
39.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int firstDayBeenInAllRooms(vector<int>& nextVisit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int firstDayBeenInAllRooms(int[] nextVisit) {\n \n }\n}"}, {"value": "pyth...
[0,0]
{ "name": "firstDayBeenInAllRooms", "params": [ { "name": "nextVisit", "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,998
GCD Sort of an Array
gcd-sort-of-an-array
<p>You are given an integer array <code>nums</code>, and you can perform the following operation <strong>any</strong> number of times on <code>nums</code>:</p> <ul> <li>Swap the positions of two elements <code>nums[i]</code> and <code>nums[j]</code> if <code>gcd(nums[i], nums[j]) &gt; 1</code> where <code>gcd(nums[i]...
Hard
11K
23.7K
10,955
23,702
46.2%
['rank-transform-of-a-matrix']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool gcdSort(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean gcdSort(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode...
[7,21,3]
{ "name": "gcdSort", "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', 'Union Find', 'Sorting', 'Number Theory']
1,999
Smallest Greater Multiple Made of Two Digits
smallest-greater-multiple-made-of-two-digits
null
Medium
2.3K
4.8K
2,313
4,810
48.1%
[]
[]
Algorithms
null
2 0 2
{ "name": "findInteger", "params": [ { "name": "k", "type": "integer" }, { "type": "integer", "name": "digit1" }, { "type": "integer", "name": "digit2" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Enumeration']
2,000
Reverse Prefix of Word
reverse-prefix-of-word
<p>Given a <strong>0-indexed</strong> string <code>word</code> and a character <code>ch</code>, <strong>reverse</strong> the segment of <code>word</code> that starts at index <code>0</code> and ends at the index of the <strong>first occurrence</strong> of <code>ch</code> (<strong>inclusive</strong>). If the character <...
Easy
318.6K
368.9K
318,642
368,851
86.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string reversePrefix(string word, char ch) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String reversePrefix(String word, char ch) {\n \n }\n}"}, {"value": "python", "tex...
"abcdefd" "d"
{ "name": "reversePrefix", "params": [ { "name": "word", "type": "string" }, { "type": "character", "name": "ch" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Two Pointers', 'String', 'Stack']
2,001
Number of Pairs of Interchangeable Rectangles
number-of-pairs-of-interchangeable-rectangles
<p>You are given <code>n</code> rectangles represented by a <strong>0-indexed</strong> 2D integer array <code>rectangles</code>, where <code>rectangles[i] = [width<sub>i</sub>, height<sub>i</sub>]</code> denotes the width and height of the <code>i<sup>th</sup></code> rectangle.</p> <p>Two rectangles <code>i</code> and...
Medium
48.5K
94.5K
48,533
94,509
51.4%
['number-of-good-pairs', 'count-nice-pairs-in-an-array', 'replace-non-coprime-numbers-in-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long interchangeableRectangles(vector<vector<int>>& rectangles) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long interchangeableRectangles(int[][] rectangles) {\n \n ...
[[4,8],[3,6],[10,20],[15,30]]
{ "name": "interchangeableRectangles", "params": [ { "name": "rectangles", "type": "integer[][]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Math', 'Counting', 'Number Theory']
2,002
Maximum Product of the Length of Two Palindromic Subsequences
maximum-product-of-the-length-of-two-palindromic-subsequences
<p>Given a string <code>s</code>, find two <strong>disjoint palindromic subsequences</strong> of <code>s</code> such that the <strong>product</strong> of their lengths is <strong>maximized</strong>. The two subsequences are <strong>disjoint</strong> if they do not both pick a character at the same index.</p> <p>Return...
Medium
35K
57.4K
35,044
57,383
61.1%
['valid-palindrome', 'longest-palindromic-subsequence', 'maximum-product-of-the-length-of-two-palindromic-substrings', 'maximum-points-in-an-archery-competition']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxProduct(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxProduct(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class ...
"leetcodecom"
{ "name": "maxProduct", "params": [ { "name": "s", "type": "string" } ], "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...
['String', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Bitmask']