questionFrontendId
int64
1
3.51k
questionTitle
stringlengths
3
79
TitleSlug
stringlengths
3
79
content
stringlengths
431
25.4k
difficulty
stringclasses
3 values
totalAccepted
stringlengths
2
6
totalSubmission
stringlengths
2
6
totalAcceptedRaw
int64
124
16.8M
totalSubmissionRaw
int64
285
30.3M
acRate
stringlengths
4
5
similarQuestions
stringlengths
2
714
mysqlSchemas
stringclasses
295 values
category
stringclasses
6 values
codeDefinition
stringlengths
122
24.9k
sampleTestCase
stringlengths
1
4.33k
metaData
stringlengths
37
3.13k
envInfo
stringclasses
26 values
topicTags
stringlengths
2
153
3,210
Find the Encrypted String
find-the-encrypted-string
<p>You are given a string <code>s</code> and an integer <code>k</code>. Encrypt the string using the following algorithm:</p> <ul> <li>For each character <code>c</code> in <code>s</code>, replace <code>c</code> with the <code>k<sup>th</sup></code> character after <code>c</code> in the string (in a cyclic manner).</li...
Easy
60.6K
89.4K
60,628
89,390
67.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string getEncryptedString(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String getEncryptedString(String s, int k) {\n \n }\n}"}, {"value": "python", "tex...
"dart" 3
{ "name": "getEncryptedString", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
3,211
Generate Binary Strings Without Adjacent Zeros
generate-binary-strings-without-adjacent-zeros
<p>You are given a positive integer <code>n</code>.</p> <p>A binary string <code>x</code> is <strong>valid</strong> if all <span data-keyword="substring-nonempty">substrings</span> of <code>x</code> of length 2 contain <strong>at least</strong> one <code>&quot;1&quot;</code>.</p> <p>Return all <strong>valid</strong> ...
Medium
55.1K
63.4K
55,052
63,362
86.9%
['non-negative-integers-without-consecutive-ones']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> validStrings(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> validStrings(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
3
{ "name": "validStrings", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "list<string>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Backtracking', 'Bit Manipulation']
3,212
Count Submatrices With Equal Frequency of X and Y
count-submatrices-with-equal-frequency-of-x-and-y
<p>Given a 2D character matrix <code>grid</code>, where <code>grid[i][j]</code> is either <code>&#39;X&#39;</code>, <code>&#39;Y&#39;</code>, or <code>&#39;.&#39;</code>, return the number of <span data-keyword="submatrix">submatrices</span> that contain:</p> <ul> <li><code>grid[0][0]</code></li> <li>an <strong>equa...
Medium
24.4K
48.5K
24,424
48,520
50.3%
['maximum-equal-frequency', 'count-submatrices-with-all-ones']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfSubmatrices(vector<vector<char>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfSubmatrices(char[][] grid) {\n \n }\n}"}, {"value": "python",...
[["X","Y","."],["Y",".","."]]
{ "name": "numberOfSubmatrices", "params": [ { "name": "grid", "type": "character[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Matrix', 'Prefix Sum']
3,213
Construct String with Minimum Cost
construct-string-with-minimum-cost
<p>You are given a string <code>target</code>, an array of strings <code>words</code>, and an integer array <code>costs</code>, both arrays of the same length.</p> <p>Imagine an empty string <code>s</code>.</p> <p>You can perform the following operation any number of times (including <strong>zero</strong>):</p> <ul>...
Hard
12.2K
63.3K
12,180
63,280
19.2%
['minimum-number-of-valid-strings-to-form-target-ii', 'minimum-number-of-valid-strings-to-form-target-i']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumCost(string target, vector<string>& words, vector<int>& costs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumCost(String target, String[] words, int[] costs) {...
"abcdef" ["abdef","abc","d","def","ef"] [100,1,1,10,5]
{ "name": "minimumCost", "params": [ { "name": "target", "type": "string" }, { "type": "string[]", "name": "words" }, { "type": "integer[]", "name": "costs" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'Dynamic Programming', 'Suffix Array']
3,214
Year on Year Growth Rate
year-on-year-growth-rate
null
Hard
1.8K
3.3K
1,751
3,325
52.7%
[]
['Create Table if not exists user_transactions( transaction_id int, product_id int, spend decimal(10,2), \ntransaction_date datetime)', 'Truncate table user_transactions', "insert into user_transactions (transaction_id, product_id, spend, transaction_date) values ('1341', '123424', '1500.6', '2019-12-31 12:00:00')", "i...
Database
null
{"headers":{"user_transactions":["transaction_id","product_id","spend","transaction_date"]},"rows":{"user_transactions":[[1341,123424,1500.60,"2019-12-31 12:00:00"],[1423,123424,1000.20,"2020-12-31 12:00:00"],[1623,123424,1246.44,"2021-12-31 12:00:00"],[1322,123424,2145.32,"2022-12-31 12:00:00"]]}}
{"mysql": ["Create Table if not exists user_transactions( transaction_id int, product_id int, spend decimal(10,2), \ntransaction_date datetime)"], "mssql": ["Create Table user_transactions( transaction_id int, product_id int, spend decimal(10,2), \ntransaction_date datetime)"], "oraclesql": ["Create Table user_transa...
{"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']
3,215
Count Triplets with Even XOR Set Bits II
count-triplets-with-even-xor-set-bits-ii
null
Medium
623
1.1K
623
1,054
59.1%
[]
[]
Algorithms
null
[1] [2] [3]
{ "name": "tripletCount", "params": [ { "name": "a", "type": "integer[]" }, { "type": "integer[]", "name": "b" }, { "type": "integer[]", "name": "c" } ], "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', 'Bit Manipulation']
3,216
Lexicographically Smallest String After a Swap
lexicographically-smallest-string-after-a-swap
<p>Given a string <code>s</code> containing only digits, return the <span data-keyword="lexicographically-smaller-string">lexicographically smallest string</span> that can be obtained after swapping <strong>adjacent</strong> digits in <code>s</code> with the same <strong>parity</strong> at most <strong>once</strong>.</...
Easy
49.8K
93.2K
49,827
93,188
53.5%
['lexicographically-smallest-string-after-applying-operations']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string getSmallestString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String getSmallestString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
"45320"
{ "name": "getSmallestString", "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', 'Greedy']
3,217
Delete Nodes From Linked List Present in Array
delete-nodes-from-linked-list-present-in-array
<p>You are given an array of integers <code>nums</code> and the <code>head</code> of a linked list. Return the <code>head</code> of the modified linked list after <strong>removing</strong> all nodes from the linked list that have a value that exists in <code>nums</code>.</p> <p>&nbsp;</p> <p><strong class="example">Ex...
Medium
189.7K
279.2K
189,667
279,197
67.9%
['remove-linked-list-elements', 'delete-node-in-a-linked-list', 'remove-nodes-from-linked-list']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ...
[1,2,3] [1,2,3,4,5]
{ "name": "modifiedList", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "ListNode", "name": "head" } ], "return": { "type": "ListNode" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Linked List']
3,218
Minimum Cost for Cutting Cake I
minimum-cost-for-cutting-cake-i
<p>There is an <code>m x n</code> cake that needs to be cut into <code>1 x 1</code> pieces.</p> <p>You are given integers <code>m</code>, <code>n</code>, and two arrays:</p> <ul> <li><code>horizontalCut</code> of size <code>m - 1</code>, where <code>horizontalCut[i]</code> represents the cost to cut along the horizo...
Medium
28.1K
49K
28,127
48,963
57.4%
['minimum-cost-for-cutting-cake-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumCost(int m, int n, vector<int>& horizontalCut, vector<int>& verticalCut) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumCost(int m, int n, int[] horizontalCut, ...
3 2 [1,3] [5]
{ "name": "minimumCost", "params": [ { "type": "integer", "name": "m" }, { "type": "integer", "name": "n" }, { "type": "integer[]", "name": "horizontalCut" }, { "type": "integer[]", "name": "verticalCut" } ], "return": { "type":...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Greedy', 'Sorting']
3,219
Minimum Cost for Cutting Cake II
minimum-cost-for-cutting-cake-ii
<p>There is an <code>m x n</code> cake that needs to be cut into <code>1 x 1</code> pieces.</p> <p>You are given integers <code>m</code>, <code>n</code>, and two arrays:</p> <ul> <li><code>horizontalCut</code> of size <code>m - 1</code>, where <code>horizontalCut[i]</code> represents the cost to cut along the horizo...
Hard
22.1K
40.5K
22,069
40,482
54.5%
['minimum-cost-for-cutting-cake-i']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumCost(int m, int n, vector<int>& horizontalCut, vector<int>& verticalCut) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumCost(int m, int n, int[] horizont...
3 2 [1,3] [5]
{ "name": "minimumCost", "params": [ { "name": "m", "type": "integer" }, { "type": "integer", "name": "n" }, { "type": "integer[]", "name": "horizontalCut" }, { "type": "integer[]", "name": "verticalCut" } ], "return": { "type":...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting']
3,220
Odd and Even Transactions
odd-and-even-transactions
<p>Table: <code>transactions</code></p> <pre> +------------------+------+ | Column Name | Type | +------------------+------+ | transaction_id | int | | amount | int | | transaction_date | date | +------------------+------+ The transactions_id column uniquely identifies each row in this table. Each ...
Medium
15.1K
21.6K
15,064
21,551
69.9%
[]
['Create table if not exists transactions ( transaction_id int, amount int, transaction_date date)', 'Truncate table transactions', "insert into transactions (transaction_id, amount, transaction_date) values ('1', '150', '2024-07-01')", "insert into transactions (transaction_id, amount, transaction_date) values ('2', '...
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":{"transactions":["transaction_id","amount","transaction_date"]},"rows":{"transactions":[[1,150,"2024-07-01"],[2,200,"2024-07-01"],[3,75,"2024-07-01"],[4,300,"2024-07-02"],[5,50,"2024-07-02"],[6,120,"2024-07-03"]]}}
{"mysql": ["Create table if not exists transactions ( transaction_id int, amount int, transaction_date date)"], "mssql": ["Create table transactions ( transaction_id int, amount int, transaction_date date)"], "oraclesql": ["Create table transactions ( transaction_id int, amount int, transaction_date date)", "ALTER SES...
{"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']
3,221
Maximum Array Hopping Score II
maximum-array-hopping-score-ii
null
Medium
797
1.4K
797
1,411
56.5%
[]
[]
Algorithms
null
[1,5,8]
{ "name": "maxScore", "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', 'Stack', 'Greedy', 'Monotonic Stack']
3,222
Find the Winning Player in Coin Game
find-the-winning-player-in-coin-game
<p>You are given two <strong>positive</strong> integers <code>x</code> and <code>y</code>, denoting the number of coins with values 75 and 10 <em>respectively</em>.</p> <p>Alice and Bob are playing a game. Each turn, starting with <strong>Alice</strong>, the player must pick up coins with a <strong>total</strong> valu...
Easy
45.5K
86.9K
45,495
86,868
52.4%
['can-i-win', 'predict-the-winner']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string winningPlayer(int x, int y) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String winningPlayer(int x, int y) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
2 7
{ "name": "winningPlayer", "params": [ { "name": "x", "type": "integer" }, { "type": "integer", "name": "y" } ], "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', 'Simulation', 'Game Theory']
3,223
Minimum Length of String After Operations
minimum-length-of-string-after-operations
<p>You are given a string <code>s</code>.</p> <p>You can perform the following process on <code>s</code> <strong>any</strong> number of times:</p> <ul> <li>Choose an index <code>i</code> in the string such that there is <strong>at least</strong> one character to the left of index <code>i</code> that is equal to <cod...
Medium
186.8K
249.3K
186,792
249,295
74.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumLength(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumLength(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
"abaacbcbb"
{ "name": "minimumLength", "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', 'Counting']
3,224
Minimum Array Changes to Make Differences Equal
minimum-array-changes-to-make-differences-equal
<p>You are given an integer array <code>nums</code> of size <code>n</code> where <code>n</code> is <strong>even</strong>, and an integer <code>k</code>.</p> <p>You can perform some changes on the array, where in one change you can replace <strong>any</strong> element in the array with <strong>any</strong> integer in t...
Medium
13.8K
59.7K
13,771
59,661
23.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minChanges(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minChanges(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Python...
[1,0,1,2,4,3] 4
{ "name": "minChanges", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Prefix Sum']
3,225
Maximum Score From Grid Operations
maximum-score-from-grid-operations
<p>You are given a 2D matrix <code>grid</code> of size <code>n x n</code>. Initially, all cells of the grid are colored white. In one operation, you can select any cell of indices <code>(i, j)</code>, and color black all the cells of the <code>j<sup>th</sup></code> column starting from the top row down to the <code>i<s...
Hard
2.3K
9.9K
2,314
9,926
23.3%
['maximum-difference-score-in-a-grid']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumScore(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumScore(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": ...
[[0,0,0,0,0],[0,0,3,0,0],[0,1,0,0,0],[5,0,0,3,0],[0,0,0,0,2]]
{ "name": "maximumScore", "params": [ { "name": "grid", "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', 'Prefix Sum']
3,226
Number of Bit Changes to Make Two Integers Equal
number-of-bit-changes-to-make-two-integers-equal
<p>You are given two positive integers <code>n</code> and <code>k</code>.</p> <p>You can choose <strong>any</strong> bit in the <strong>binary representation</strong> of <code>n</code> that is equal to 1 and change it to 0.</p> <p>Return the <em>number of changes</em> needed to make <code>n</code> equal to <code>k</c...
Easy
45.9K
72.1K
45,939
72,085
63.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minChanges(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minChanges(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":...
13 4
{ "name": "minChanges", "params": [ { "name": "n", "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...
['Bit Manipulation']
3,227
Vowels Game in a String
vowels-game-in-a-string
<p>Alice and Bob are playing a game on a string.</p> <p>You are given a string <code>s</code>, Alice and Bob will take turns playing the following game where Alice starts <strong>first</strong>:</p> <ul> <li>On Alice&#39;s turn, she has to remove any <strong>non-empty</strong> <span data-keyword="substring">substrin...
Medium
41.6K
67.2K
41,561
67,201
61.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool doesAliceWin(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean doesAliceWin(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode"...
"leetcoder"
{ "name": "doesAliceWin", "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...
['Math', 'String', 'Brainteaser', 'Game Theory']
3,228
Maximum Number of Operations to Move Ones to the End
maximum-number-of-operations-to-move-ones-to-the-end
<p>You are given a <span data-keyword="binary-string">binary string</span> <code>s</code>.</p> <p>You can perform the following operation on the string <strong>any</strong> number of times:</p> <ul> <li>Choose <strong>any</strong> index <code>i</code> from the string where <code>i + 1 &lt; s.length</code> such that ...
Medium
29.9K
56.5K
29,930
56,491
53.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxOperations(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxOperations(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
"1001101"
{ "name": "maxOperations", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Greedy', 'Counting']
3,229
Minimum Operations to Make Array Equal to Target
minimum-operations-to-make-array-equal-to-target
<p>You are given two positive integer arrays <code>nums</code> and <code>target</code>, of the same length.</p> <p>In a single operation, you can select any subarray of <code>nums</code> and increment each element within that subarray by 1 or decrement each element within that subarray by 1.</p> <p>Return the <strong...
Hard
17.5K
45.4K
17,514
45,448
38.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumOperations(vector<int>& nums, vector<int>& target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumOperations(int[] nums, int[] target) {\n \n }...
[3,5,1,2] [4,6,2,4]
{ "name": "minimumOperations", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[]", "name": "target" } ], "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', 'Stack', 'Greedy', 'Monotonic Stack']
3,230
Customer Purchasing Behavior Analysis
customer-purchasing-behavior-analysis
null
Medium
1.5K
3.9K
1,451
3,877
37.4%
[]
['CREATE TABLE if not exists Transactions (\n transaction_id INT,\n customer_id INT,\n product_id INT,\n transaction_date DATE,\n amount DECIMAL(10, 2)\n)', 'CREATE TABLE if not exists Products (\n product_id INT ,\n category VARCHAR(255),\n price DECIMAL(10, 2)\n)\n', 'Truncate table Transactio...
Database
null
{"headers":{"Transactions":["transaction_id","customer_id","product_id","transaction_date","amount"],"Products":["product_id","category","price"]},"rows":{"Transactions":[[1,101,1,"2023-01-01",100.00],[2,101,2,"2023-01-15",150.00],[3,102,1,"2023-01-01",100.00],[4,102,3,"2023-01-22",200.00],[5,101,3,"2023-02-10",200.00]...
{"mysql": ["CREATE TABLE if not exists Transactions (\n transaction_id INT,\n customer_id INT,\n product_id INT,\n transaction_date DATE,\n amount DECIMAL(10, 2)\n)", "CREATE TABLE if not exists Products (\n product_id INT ,\n category VARCHAR(255),\n price DECIMAL(10, 2)\n)\n"], "mssql": ["CREA...
{"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']
3,231
Minimum Number of Increasing Subsequence to Be Removed
minimum-number-of-increasing-subsequence-to-be-removed
null
Hard
409
963
409
963
42.5%
[]
[]
Algorithms
null
[5,3,1,4,2]
{ "name": "minOperations", "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']
3,232
Find if Digit Game Can Be Won
find-if-digit-game-can-be-won
<p>You are given an array of <strong>positive</strong> integers <code>nums</code>.</p> <p>Alice and Bob are playing a game. In the game, Alice can choose <strong>either</strong> all single-digit numbers or all double-digit numbers from <code>nums</code>, and the rest of the numbers are given to Bob. Alice wins if the ...
Easy
79.5K
98K
79,507
98,026
81.1%
['find-numbers-with-even-number-of-digits', 'count-integers-with-even-digit-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canAliceWin(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canAliceWin(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
[1,2,3,4,10]
{ "name": "canAliceWin", "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']
3,233
Find the Count of Numbers Which Are Not Special
find-the-count-of-numbers-which-are-not-special
<p>You are given 2 <strong>positive</strong> integers <code>l</code> and <code>r</code>. For any number <code>x</code>, all positive divisors of <code>x</code> <em>except</em> <code>x</code> are called the <strong>proper divisors</strong> of <code>x</code>.</p> <p>A number is called <strong>special</strong> if it has ...
Medium
34.7K
129.4K
34,689
129,408
26.8%
['count-primes']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int nonSpecialCount(int l, int r) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int nonSpecialCount(int l, int r) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
5 7
{ "name": "nonSpecialCount", "params": [ { "name": "l", "type": "integer" }, { "type": "integer", "name": "r" } ], "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']
3,234
Count the Number of Substrings With Dominant Ones
count-the-number-of-substrings-with-dominant-ones
<p>You are given a binary string <code>s</code>.</p> <p>Return the number of <span data-keyword="substring-nonempty">substrings</span> with <strong>dominant</strong> ones.</p> <p>A string has <strong>dominant</strong> ones if the number of ones in the string is <strong>greater than or equal to</strong> the <strong>sq...
Medium
8.5K
51.1K
8,496
51,125
16.6%
['count-binary-substrings']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfSubstrings(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfSubstrings(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau...
"00011"
{ "name": "numberOfSubstrings", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Sliding Window', 'Enumeration']
3,235
Check if the Rectangle Corner Is Reachable
check-if-the-rectangle-corner-is-reachable
<p>You are given two positive integers <code>xCorner</code> and <code>yCorner</code>, and a 2D array <code>circles</code>, where <code>circles[i] = [x<sub>i</sub>, y<sub>i</sub>, r<sub>i</sub>]</code> denotes a circle with center at <code>(x<sub>i</sub>, y<sub>i</sub>)</code> and radius <code>r<sub>i</sub></code>.</p> ...
Hard
7.2K
26.9K
7,161
26,935
26.6%
['queries-on-number-of-points-inside-a-circle', 'check-if-point-is-reachable']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canReachCorner(int xCorner, int yCorner, vector<vector<int>>& circles) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canReachCorner(int xCorner, int yCorner, int[][] ci...
3 4 [[2,1,1]]
{ "name": "canReachCorner", "params": [ { "name": "xCorner", "type": "integer" }, { "type": "integer", "name": "yCorner" }, { "type": "integer[][]", "name": "circles" } ], "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', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Geometry']
3,236
CEO Subordinate Hierarchy
ceo-subordinate-hierarchy
null
Hard
939
1.3K
939
1,308
71.8%
[]
['Create table if not exists employees(employee_id int, employee_name varchar(100), manager_id int, salary int)', 'Truncate table Employees', "insert into Employees (employee_id, employee_name, manager_id, salary) values ('1', 'Alice', NULL, '150000')", "insert into Employees (employee_id, employee_name, manager_id, sa...
Database
null
{"headers":{"Employees":["employee_id","employee_name","manager_id","salary"]},"rows":{"Employees":[[1,"Alice",null,150000],[2,"Bob",1,120000],[3,"Charlie",1,110000],[4,"David",2,105000],[5,"Eve",2,100000],[6,"Frank",3,95000],[7,"Grace",3,98000],[8,"Helen",5,90000]]}}
{"mysql": ["Create table if not exists employees(employee_id int, employee_name varchar(100), manager_id int, salary int)"], "mssql": ["Create table employees(employee_id int, employee_name varchar(100), manager_id int, salary int)"], "oraclesql": ["Create table employees(employee_id NUMBER, employee_name varchar2(100)...
{"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']
3,237
Alt and Tab Simulation
alt-and-tab-simulation
null
Medium
920
1.9K
920
1,916
48.0%
[]
[]
Algorithms
null
[1,2,3] [3,3,2]
{ "name": "simulationResult", "params": [ { "name": "windows", "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', 'Simulation']
3,238
Find the Number of Winning Players
find-the-number-of-winning-players
<p>You are given an integer <code>n</code> representing the number of players in a game and a 2D array <code>pick</code> where <code>pick[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> represents that the player <code>x<sub>i</sub></code> picked a ball of color <code>y<sub>i</sub></code>.</p> <p>Player <code>i</code> <str...
Easy
42.7K
71.8K
42,748
71,754
59.6%
['can-i-win', 'predict-the-winner']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int winningPlayerCount(int n, vector<vector<int>>& pick) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int winningPlayerCount(int n, int[][] pick) {\n \n }\n}"}, {"value":...
4 [[0,0],[1,0],[1,0],[2,1],[2,1],[2,0]]
{ "name": "winningPlayerCount", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "pick" } ], "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', 'Counting']
3,239
Minimum Number of Flips to Make Binary Grid Palindromic I
minimum-number-of-flips-to-make-binary-grid-palindromic-i
<p>You are given an <code>m x n</code> binary matrix <code>grid</code>.</p> <p>A row or column is considered <strong>palindromic</strong> if its values read the same forward and backward.</p> <p>You can <strong>flip</strong> any number of cells in <code>grid</code> from <code>0</code> to <code>1</code>, or from <code...
Medium
35.4K
47.7K
35,402
47,739
74.2%
['minimum-number-of-moves-to-make-palindrome']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minFlips(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minFlips(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[[1,0,0],[0,0,0],[0,0,1]]
{ "name": "minFlips", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Two Pointers', 'Matrix']
3,240
Minimum Number of Flips to Make Binary Grid Palindromic II
minimum-number-of-flips-to-make-binary-grid-palindromic-ii
<p>You are given an <code>m x n</code> binary matrix <code>grid</code>.</p> <p>A row or column is considered <strong>palindromic</strong> if its values read the same forward and backward.</p> <p>You can <strong>flip</strong> any number of cells in <code>grid</code> from <code>0</code> to <code>1</code>, or from <code...
Medium
11K
45.8K
10,953
45,792
23.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minFlips(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minFlips(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[[1,0,0],[0,1,0],[0,0,1]]
{ "name": "minFlips", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Two Pointers', 'Matrix']
3,241
Time Taken to Mark All Nodes
time-taken-to-mark-all-nodes
<p>There exists an <strong>undirected</strong> tree with <code>n</code> nodes numbered <code>0</code> to <code>n - 1</code>. You are given a 2D integer array <code>edges</code> of length <code>n - 1</code>, where <code>edges[i] = [u<sub>i</sub>, v<sub>i</sub>]</code> indicates that there is an edge between nodes <code>...
Hard
4.9K
20.6K
4,915
20,629
23.8%
['sum-of-distances-in-tree', 'most-profitable-path-in-a-tree', 'find-the-last-marked-nodes-in-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> timeTaken(vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] timeTaken(int[][] edges) {\n \n }\n}"}, {"value": "python", "text": "...
[[0,1],[0,2]]
{ "name": "timeTaken", "params": [ { "name": "edges", "type": "integer[][]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Dynamic Programming', 'Tree', 'Depth-First Search', 'Graph']
3,242
Design Neighbor Sum Service
design-neighbor-sum-service
<p>You are given a <code>n x n</code> 2D array <code>grid</code> containing <strong>distinct</strong> elements in the range <code>[0, n<sup>2</sup> - 1]</code>.</p> <p>Implement the <code>NeighborSum</code> class:</p> <ul> <li><code>NeighborSum(int [][]grid)</code> initializes the object.</li> <li><code>int adjacen...
Easy
40.1K
48.5K
40,062
48,496
82.6%
['matrix-block-sum', 'array-with-elements-not-equal-to-average-of-neighbors']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class NeighborSum {\npublic:\n NeighborSum(vector<vector<int>>& grid) {\n \n }\n \n int adjacentSum(int value) {\n \n }\n \n int diagonalSum(int value) {\n \n }\n};\n\n/**\n * Your NeighborSum object will be instantiated and c...
["NeighborSum","adjacentSum","adjacentSum","diagonalSum","diagonalSum"] [[[[0,1,2],[3,4,5],[6,7,8]]],[1],[4],[4],[8]]
{ "classname": "NeighborSum", "constructor": { "params": [ { "type": "integer[][]", "name": "grid" } ] }, "methods": [ { "params": [ { "type": "integer", "name": "value" } ], "name": "adjacentSum", "return": { ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Design', 'Matrix', 'Simulation']
3,243
Shortest Distance After Road Addition Queries I
shortest-distance-after-road-addition-queries-i
<p>You are given an integer <code>n</code> and a 2D integer array <code>queries</code>.</p> <p>There are <code>n</code> cities numbered from <code>0</code> to <code>n - 1</code>. Initially, there is a <strong>unidirectional</strong> road from city <code>i</code> to city <code>i + 1</code> for all <code>0 &lt;= i &lt; ...
Medium
110.1K
177.4K
110,137
177,403
62.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> shortestDistanceAfterQueries(int n, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] shortestDistanceAfterQueries(int n, int[][] queries...
5 [[2,4],[0,2],[0,4]]
{ "name": "shortestDistanceAfterQueries", "params": [ { "name": "n", "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', 'Breadth-First Search', 'Graph']
3,244
Shortest Distance After Road Addition Queries II
shortest-distance-after-road-addition-queries-ii
<p>You are given an integer <code>n</code> and a 2D integer array <code>queries</code>.</p> <p>There are <code>n</code> cities numbered from <code>0</code> to <code>n - 1</code>. Initially, there is a <strong>unidirectional</strong> road from city <code>i</code> to city <code>i + 1</code> for all <code>0 &lt;= i &lt; ...
Hard
13.3K
53K
13,276
53,024
25.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> shortestDistanceAfterQueries(int n, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] shortestDistanceAfterQueries(int n, int[][] queries...
5 [[2,4],[0,2],[0,4]]
{ "name": "shortestDistanceAfterQueries", "params": [ { "name": "n", "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', 'Greedy', 'Graph', 'Ordered Set']
3,245
Alternating Groups III
alternating-groups-iii
<p>There are some red and blue tiles arranged circularly. You are given an array of integers <code>colors</code> and a 2D integers array <code>queries</code>.</p> <p>The color of tile <code>i</code> is represented by <code>colors[i]</code>:</p> <ul> <li><code>colors[i] == 0</code> means that tile <code>i</code> is <...
Hard
1.9K
13.1K
1,899
13,091
14.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> numberOfAlternatingGroups(vector<int>& colors, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> numberOfAlternatingGroups(int[] ...
[0,1,1,0,1] [[2,1,0],[1,4]]
{ "name": "numberOfAlternatingGroups", "params": [ { "name": "colors", "type": "integer[]" }, { "type": "integer[][]", "name": "queries" } ], "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', 'Binary Indexed Tree']
3,246
Premier League Table Ranking
premier-league-table-ranking
null
Easy
2.2K
2.7K
2,211
2,694
82.1%
[]
['Create table if not exists TeamStats( team_id int, team_name varchar(100),matches_played int, wins int,draws int,losses int)', 'Truncate table TeamStats', "insert into TeamStats (team_id, team_name, matches_played, wins, draws, losses) values ('1', 'Manchester City', '10', '6', '2', '2')", "insert into TeamStats (tea...
Database
null
{"headers":{"TeamStats":["team_id","team_name","matches_played","wins","draws","losses"]},"rows":{"TeamStats":[[1,"Manchester City",10,6,2,2],[2,"Liverpool",10,6,2,2],[3,"Chelsea",10,5,3,2],[4,"Arsenal",10,4,4,2],[5,"Tottenham",10,3,5,2]]}}
{"mysql": ["Create table if not exists TeamStats( team_id int, team_name varchar(100),matches_played int, wins int,draws int,losses int)"], "mssql": ["Create table TeamStats( team_id int, team_name varchar(100),matches_played int, wins int,draws int,losses int)"], "oraclesql": ["Create table TeamStats( team_id NUMBER...
{"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']
3,247
Number of Subsequences with Odd Sum
number-of-subsequences-with-odd-sum
null
Medium
771
1.6K
771
1,637
47.1%
[]
[]
Algorithms
null
[1,1,1]
{ "name": "subsequenceCount", "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', 'Combinatorics']
3,248
Snake in Matrix
snake-in-matrix
<p>There is a snake in an <code>n x n</code> matrix <code>grid</code> and can move in <strong>four possible directions</strong>. Each cell in the <code>grid</code> is identified by the position: <code>grid[i][j] = (i * n) + j</code>.</p> <p>The snake starts at cell 0 and follows a sequence of commands.</p> <p>You are...
Easy
63K
77.3K
62,956
77,319
81.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int finalPositionOfSnake(int n, vector<string>& commands) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int finalPositionOfSnake(int n, List<String> commands) {\n \n }\n}"...
2 ["RIGHT","DOWN"]
{ "name": "finalPositionOfSnake", "params": [ { "name": "n", "type": "integer" }, { "type": "list<string>", "name": "commands" } ], "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', 'Simulation']
3,249
Count the Number of Good Nodes
count-the-number-of-good-nodes
<p>There is an <strong>undirected</strong> tree with <code>n</code> nodes labeled from <code>0</code> to <code>n - 1</code>, and rooted at node <code>0</code>. You are given a 2D integer array <code>edges</code> of length <code>n - 1</code>, where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates that th...
Medium
28.1K
51.7K
28,146
51,671
54.5%
['maximum-depth-of-n-ary-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countGoodNodes(vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countGoodNodes(int[][] edges) {\n \n }\n}"}, {"value": "python", "text": "...
[[0,1],[0,2],[1,3],[1,4],[2,5],[2,6]]
{ "name": "countGoodNodes", "params": [ { "name": "edges", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search']
3,250
Find the Count of Monotonic Pairs I
find-the-count-of-monotonic-pairs-i
<p>You are given an array of <strong>positive</strong> integers <code>nums</code> of length <code>n</code>.</p> <p>We call a pair of <strong>non-negative</strong> integer arrays <code>(arr1, arr2)</code> <strong>monotonic</strong> if:</p> <ul> <li>The lengths of both arrays are <code>n</code>.</li> <li><code>arr1</...
Hard
17.1K
37.7K
17,107
37,660
45.4%
['monotonic-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countOfPairs(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countOfPairs(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[2,3,2]
{ "name": "countOfPairs", "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', 'Combinatorics', 'Prefix Sum']
3,251
Find the Count of Monotonic Pairs II
find-the-count-of-monotonic-pairs-ii
<p>You are given an array of <strong>positive</strong> integers <code>nums</code> of length <code>n</code>.</p> <p>We call a pair of <strong>non-negative</strong> integer arrays <code>(arr1, arr2)</code> <strong>monotonic</strong> if:</p> <ul> <li>The lengths of both arrays are <code>n</code>.</li> <li><code>arr1</...
Hard
6.8K
30K
6,783
29,959
22.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countOfPairs(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countOfPairs(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[2,3,2]
{ "name": "countOfPairs", "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', 'Combinatorics', 'Prefix Sum']
3,252
Premier League Table Ranking II
premier-league-table-ranking-ii
null
Medium
1.2K
2K
1,179
1,957
60.2%
[]
['Create table if not exists TeamStats( team_id int, team_name varchar(100),matches_played int, wins int,draws int,losses int)', 'Truncate table TeamStats', "insert into TeamStats (team_id, team_name, matches_played, wins, draws, losses) values ('1', 'Chelsea', '22', '13', '2', '7')", "insert into TeamStats (team_id, t...
Database
null
{"headers": {"TeamStats": ["team_id", "team_name", "matches_played", "wins", "draws", "losses"]}, "rows": {"TeamStats": [[1, "Chelsea", 22, 13, 2, 7], [2, "Nottingham Forest", 27, 6, 6, 15], [3, "Liverpool", 17, 1, 8, 8], [4, "Aston Villa", 20, 1, 6, 13], [5, "Fulham", 31, 18, 1, 12], [6, "Burnley", 26, 6, 9, 11], [7, ...
{"mysql": ["Create table if not exists TeamStats( team_id int, team_name varchar(100),matches_played int, wins int,draws int,losses int)"], "mssql": ["Create table TeamStats( team_id int, team_name varchar(100),matches_played int, wins int,draws int,losses int)"], "oraclesql": ["Create table TeamStats( team_id NUMBER...
{"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']
3,253
Construct String with Minimum Cost (Easy)
construct-string-with-minimum-cost-easy
null
Medium
611
1K
611
1,046
58.4%
[]
[]
Algorithms
null
"abcdef" ["abdef","abc","d","def","ef"] [100,1,1,10,5]
{ "name": "minimumCost", "params": [ { "name": "target", "type": "string" }, { "type": "string[]", "name": "words" }, { "type": "integer[]", "name": "costs" } ], "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...
[]
3,254
Find the Power of K-Size Subarrays I
find-the-power-of-k-size-subarrays-i
<p>You are given an array of integers <code>nums</code> of length <code>n</code> and a <em>positive</em> integer <code>k</code>.</p> <p>The <strong>power</strong> of an array is defined as:</p> <ul> <li>Its <strong>maximum</strong> element if <em>all</em> of its elements are <strong>consecutive</strong> and <strong>...
Medium
143.3K
229.1K
143,267
229,050
62.5%
['maximum-sum-of-distinct-subarrays-with-length-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> resultsArray(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] resultsArray(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "...
[1,2,3,4,3,2,5] 3
{ "name": "resultsArray", "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']
3,255
Find the Power of K-Size Subarrays II
find-the-power-of-k-size-subarrays-ii
<p>You are given an array of integers <code>nums</code> of length <code>n</code> and a <em>positive</em> integer <code>k</code>.</p> <p>The <strong>power</strong> of an array is defined as:</p> <ul> <li>Its <strong>maximum</strong> element if <em>all</em> of its elements are <strong>consecutive</strong> and <strong>...
Medium
28.8K
99.1K
28,751
99,103
29.0%
['maximum-sum-of-distinct-subarrays-with-length-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> resultsArray(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] resultsArray(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "...
[1,2,3,4,3,2,5] 3
{ "name": "resultsArray", "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']
3,256
Maximum Value Sum by Placing Three Rooks I
maximum-value-sum-by-placing-three-rooks-i
<p>You are given a <code>m x n</code> 2D array <code>board</code> representing a chessboard, where <code>board[i][j]</code> represents the <strong>value</strong> of the cell <code>(i, j)</code>.</p> <p>Rooks in the <strong>same</strong> row or column <strong>attack</strong> each other. You need to place <em>three</em>...
Hard
8.3K
55.8K
8,339
55,769
15.0%
['available-captures-for-rook']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumValueSum(vector<vector<int>>& board) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumValueSum(int[][] board) {\n \n }\n}"}, {"value": "python", ...
[[-3,1,1,1],[-3,1,-3,1],[-3,2,1,1]]
{ "name": "maximumValueSum", "params": [ { "name": "board", "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', 'Enumeration']
3,257
Maximum Value Sum by Placing Three Rooks II
maximum-value-sum-by-placing-three-rooks-ii
<p>You are given a <code>m x n</code> 2D array <code>board</code> representing a chessboard, where <code>board[i][j]</code> represents the <strong>value</strong> of the cell <code>(i, j)</code>.</p> <p>Rooks in the <strong>same</strong> row or column <strong>attack</strong> each other. You need to place <em>three</em>...
Hard
4.9K
18.5K
4,853
18,475
26.3%
['available-captures-for-rook']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumValueSum(vector<vector<int>>& board) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumValueSum(int[][] board) {\n \n }\n}"}, {"value": "python", ...
[[-3,1,1,1],[-3,1,-3,1],[-3,2,1,1]]
{ "name": "maximumValueSum", "params": [ { "name": "board", "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', 'Enumeration']
3,258
Count Substrings That Satisfy K-Constraint I
count-substrings-that-satisfy-k-constraint-i
<p>You are given a <strong>binary</strong> string <code>s</code> and an integer <code>k</code>.</p> <p>A <strong>binary string</strong> satisfies the <strong>k-constraint</strong> if <strong>either</strong> of the following conditions holds:</p> <ul> <li>The number of <code>0</code>&#39;s in the string is at most <c...
Easy
46.8K
60.2K
46,766
60,243
77.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countKConstraintSubstrings(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countKConstraintSubstrings(String s, int k) {\n \n }\n}"}, {"value": "pyt...
"10101" 1
{ "name": "countKConstraintSubstrings", "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', 'Sliding Window']
3,259
Maximum Energy Boost From Two Drinks
maximum-energy-boost-from-two-drinks
<p>You are given two integer arrays <code>energyDrinkA</code> and <code>energyDrinkB</code> of the same length <code>n</code> by a futuristic sports scientist. These arrays represent the energy boosts per hour provided by two different energy drinks, A and B, respectively.</p> <p>You want to <em>maximize</em> your tot...
Medium
32.4K
66K
32,437
65,960
49.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxEnergyBoost(vector<int>& energyDrinkA, vector<int>& energyDrinkB) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxEnergyBoost(int[] energyDrinkA, int[] energyDrin...
[1,3,1] [3,1,1]
{ "name": "maxEnergyBoost", "params": [ { "name": "energyDrinkA", "type": "integer[]" }, { "type": "integer[]", "name": "energyDrinkB" } ], "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']
3,260
Find the Largest Palindrome Divisible by K
find-the-largest-palindrome-divisible-by-k
<p>You are given two <strong>positive</strong> integers <code>n</code> and <code>k</code>.</p> <p>An integer <code>x</code> is called <strong>k-palindromic</strong> if:</p> <ul> <li><code>x</code> is a <span data-keyword="palindrome-integer">palindrome</span>.</li> <li><code>x</code> is divisible by <code>k</code>....
Hard
7.6K
50.1K
7,610
50,061
15.2%
['palindrome-number', 'find-the-closest-palindrome']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string largestPalindrome(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String largestPalindrome(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Pyt...
3 5
{ "name": "largestPalindrome", "params": [ { "name": "n", "type": "integer" }, { "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...
['Math', 'String', 'Dynamic Programming', 'Greedy', 'Number Theory']
3,261
Count Substrings That Satisfy K-Constraint II
count-substrings-that-satisfy-k-constraint-ii
<p>You are given a <strong>binary</strong> string <code>s</code> and an integer <code>k</code>.</p> <p>You are also given a 2D integer array <code>queries</code>, where <code>queries[i] = [l<sub>i</sub>, r<sub>i</sub>]</code>.</p> <p>A <strong>binary string</strong> satisfies the <strong>k-constraint</strong> if <str...
Hard
4.8K
22.7K
4,813
22,654
21.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<long long> countKConstraintSubstrings(string s, int k, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long[] countKConstraintSubstrings(String s,...
"0001111" 2 [[0,6]]
{ "name": "countKConstraintSubstrings", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" }, { "type": "integer[][]", "name": "queries" } ], "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', 'String', 'Binary Search', 'Sliding Window', 'Prefix Sum']
3,262
Find Overlapping Shifts
find-overlapping-shifts
null
Medium
1.3K
2.2K
1,346
2,179
61.8%
[]
['Create table if not exists EmployeeShifts(employee_id int, start_time time, end_time time)', 'Truncate table EmployeeShifts', "insert into EmployeeShifts (employee_id, start_time, end_time) values ('1', '08:00:00', '12:00:00')", "insert into EmployeeShifts (employee_id, start_time, end_time) values ('1', '11:00:00', ...
Database
null
{"headers":{"EmployeeShifts":["employee_id","start_time","end_time"]},"rows":{"EmployeeShifts":[[1,"08:00:00","12:00:00"],[1,"11:00:00","15:00:00"],[1,"14:00:00","18:00:00"],[2,"09:00:00","17:00:00"],[2,"16:00:00","20:00:00"],[3,"10:00:00","12:00:00"],[3,"13:00:00","15:00:00"],[3,"16:00:00","18:00:00"],[4,"08:00:00","1...
{"mysql": ["Create table if not exists EmployeeShifts(employee_id int, start_time time, end_time time)"], "mssql": ["Create table EmployeeShifts(employee_id int, start_time time, end_time time)"], "oraclesql": ["Create table EmployeeShifts(employee_id number, start_time date, end_time date)", "ALTER SESSION SET nls_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']
3,263
Convert Doubly Linked List to Array I
convert-doubly-linked-list-to-array-i
null
Easy
5.3K
5.5K
5,256
5,545
94.8%
['remove-linked-list-elements']
[]
Algorithms
null
[1,2,3,4,3,2,1]
{ "name": "toArray", "params": [ { "type": "ListNode", "name": "head" } ], "return": { "type": "integer[]" }, "manual": true, "languages": [ "cpp", "java", "python", "javascript", "python3", "c", "csharp", "golang", "php", "typescript", "...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Linked List', 'Doubly-Linked List']
3,264
Final Array State After K Multiplication Operations I
final-array-state-after-k-multiplication-operations-i
<p>You are given an integer array <code>nums</code>, an integer <code>k</code>, and an integer <code>multiplier</code>.</p> <p>You need to perform <code>k</code> operations on <code>nums</code>. In each operation:</p> <ul> <li>Find the <strong>minimum</strong> value <code>x</code> in <code>nums</code>. If there are ...
Easy
180.7K
207.3K
180,699
207,293
87.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getFinalState(vector<int>& nums, int k, int multiplier) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getFinalState(int[] nums, int k, int multiplier) {\n \...
[2,1,3,5,6] 5 2
{ "name": "getFinalState", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" }, { "type": "integer", "name": "multiplier" } ], "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', 'Heap (Priority Queue)', 'Simulation']
3,265
Count Almost Equal Pairs I
count-almost-equal-pairs-i
<p>You are given an array <code>nums</code> consisting of positive integers.</p> <p>We call two integers <code>x</code> and <code>y</code> in this problem <strong>almost equal</strong> if both integers can become equal after performing the following operation <strong>at most once</strong>:</p> <ul> <li>Choose <stron...
Medium
27K
72.2K
26,970
72,160
37.4%
['check-if-one-string-swap-can-make-strings-equal']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countPairs(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countPairs(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[3,12,30,17,21]
{ "name": "countPairs", "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', 'Sorting', 'Counting', 'Enumeration']
3,266
Final Array State After K Multiplication Operations II
final-array-state-after-k-multiplication-operations-ii
<p>You are given an integer array <code>nums</code>, an integer <code>k</code>, and an integer <code>multiplier</code>.</p> <p>You need to perform <code>k</code> operations on <code>nums</code>. In each operation:</p> <ul> <li>Find the <strong>minimum</strong> value <code>x</code> in <code>nums</code>. If there are ...
Hard
9.3K
80.4K
9,343
80,351
11.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getFinalState(vector<int>& nums, int k, int multiplier) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getFinalState(int[] nums, int k, int multiplier) {\n \...
[2,1,3,5,6] 5 2
{ "name": "getFinalState", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" }, { "type": "integer", "name": "multiplier" } ], "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', 'Heap (Priority Queue)', 'Simulation']
3,267
Count Almost Equal Pairs II
count-almost-equal-pairs-ii
<p><strong>Attention</strong>: In this version, the number of operations that can be performed, has been increased to <strong>twice</strong>.<!-- notionvc: 278e7cb2-3b05-42fa-8ae9-65f5fd6f7585 --></p> <p>You are given an array <code>nums</code> consisting of positive integers.</p> <p>We call two integers <code>x</cod...
Hard
5.9K
28.3K
5,932
28,310
21.0%
['find-the-occurrence-of-first-almost-equal-substring']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countPairs(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countPairs(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[1023,2310,2130,213]
{ "name": "countPairs", "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', 'Sorting', 'Counting', 'Enumeration']
3,268
Find Overlapping Shifts II
find-overlapping-shifts-ii
null
Hard
756
1.3K
756
1,279
59.1%
[]
['Create table if not exists EmployeeShifts(employee_id int, start_time datetime, end_time datetime)', 'Truncate table EmployeeShifts', "insert into EmployeeShifts (employee_id, start_time, end_time) values ('1', '2023-10-01 09:00:00', '2023-10-01 17:00:00')", "insert into EmployeeShifts (employee_id, start_time, end_t...
Database
null
{"headers": {"EmployeeShifts":["employee_id","start_time","end_time"]},"rows":{"EmployeeShifts":[[1,"2023-10-01 09:00:00","2023-10-01 17:00:00"],[1,"2023-10-01 15:00:00","2023-10-01 23:00:00"],[1,"2023-10-01 16:00:00","2023-10-02 00:00:00"],[2,"2023-10-01 09:00:00","2023-10-01 17:00:00"],[2,"2023-10-01 11:00:00","2023-...
{"mysql": ["Create table if not exists EmployeeShifts(employee_id int, start_time datetime, end_time datetime)"], "mssql": ["Create table EmployeeShifts(employee_id int, start_time datetime, end_time datetime)"], "oraclesql": ["Create table EmployeeShifts(employee_id number, start_time date, end_time date)", "ALTER S...
{"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']
3,269
Constructing Two Increasing Arrays
constructing-two-increasing-arrays
null
Hard
377
591
377
591
63.8%
[]
[]
Algorithms
null
[] [1,0,1,1]
{ "name": "minLargest", "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', 'Dynamic Programming']
3,270
Find the Key of the Numbers
find-the-key-of-the-numbers
<p>You are given three <strong>positive</strong> integers <code>num1</code>, <code>num2</code>, and <code>num3</code>.</p> <p>The <code>key</code> of <code>num1</code>, <code>num2</code>, and <code>num3</code> is defined as a four-digit number such that:</p> <ul> <li>Initially, if any number has <strong>less than</s...
Easy
45.5K
59.9K
45,490
59,900
75.9%
['largest-number']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int generateKey(int num1, int num2, int num3) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int generateKey(int num1, int num2, int num3) {\n \n }\n}"}, {"value": "python"...
1 10 1000
{ "name": "generateKey", "params": [ { "name": "num1", "type": "integer" }, { "type": "integer", "name": "num2" }, { "type": "integer", "name": "num3" } ], "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']
3,271
Hash Divided String
hash-divided-string
<p>You are given a string <code>s</code> of length <code>n</code> and an integer <code>k</code>, where <code>n</code> is a <strong>multiple</strong> of <code>k</code>. Your task is to hash the string <code>s</code> into a new string called <code>result</code>, which has a length of <code>n / k</code>.</p> <p>First, di...
Medium
42.7K
51.5K
42,667
51,486
82.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string stringHash(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String stringHash(String s, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
"abcd" 2
{ "name": "stringHash", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Simulation']
3,272
Find the Count of Good Integers
find-the-count-of-good-integers
<p>You are given two <strong>positive</strong> integers <code>n</code> and <code>k</code>.</p> <p>An integer <code>x</code> is called <strong>k-palindromic</strong> if:</p> <ul> <li><code>x</code> is a <span data-keyword="palindrome-integer">palindrome</span>.</li> <li><code>x</code> is divisible by <code>k</code>....
Hard
19.1K
34.9K
19,132
34,907
54.8%
['palindrome-number', 'find-the-closest-palindrome']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countGoodIntegers(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countGoodIntegers(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Py...
3 5
{ "name": "countGoodIntegers", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "k" } ], "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', 'Math', 'Combinatorics', 'Enumeration']
3,273
Minimum Amount of Damage Dealt to Bob
minimum-amount-of-damage-dealt-to-bob
<p>You are given an integer <code>power</code> and two integer arrays <code>damage</code> and <code>health</code>, both having length <code>n</code>.</p> <p>Bob has <code>n</code> enemies, where enemy <code>i</code> will deal Bob <code>damage[i]</code> <strong>points</strong> of damage per second while they are <em>al...
Hard
12.2K
32.5K
12,233
32,491
37.7%
['minimum-time-to-complete-trips', 'minimum-penalty-for-a-shop']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minDamage(int power, vector<int>& damage, vector<int>& health) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minDamage(int power, int[] damage, int[] health) {\n ...
4 [1,2,3,4] [4,5,6,8]
{ "name": "minDamage", "params": [ { "name": "power", "type": "integer" }, { "type": "integer[]", "name": "damage" }, { "type": "integer[]", "name": "health" } ], "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', 'Sorting']
3,274
Check if Two Chessboard Squares Have the Same Color
check-if-two-chessboard-squares-have-the-same-color
<p>You are given two strings, <code>coordinate1</code> and <code>coordinate2</code>, representing the coordinates of a square on an <code>8 x 8</code> chessboard.</p> <p>Below is the chessboard for reference.</p> <p><img alt="" src="https://assets.leetcode.com/uploads/2024/07/17/screenshot-2021-02-20-at-22159-pm.png"...
Easy
56.4K
79.6K
56,401
79,647
70.8%
['determine-color-of-a-chessboard-square']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkTwoChessboards(string coordinate1, string coordinate2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkTwoChessboards(String coordinate1, String coordinate2) {\...
"a1" "c3"
{ "name": "checkTwoChessboards", "params": [ { "name": "coordinate1", "type": "string" }, { "type": "string", "name": "coordinate2" } ], "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']
3,275
K-th Nearest Obstacle Queries
k-th-nearest-obstacle-queries
<p>There is an infinite 2D plane.</p> <p>You are given a positive integer <code>k</code>. You are also given a 2D array <code>queries</code>, which contains the following queries:</p> <ul> <li><code>queries[i] = [x, y]</code>: Build an obstacle at coordinate <code>(x, y)</code> in the plane. It is guaranteed that th...
Medium
32.9K
68.8K
32,934
68,757
47.9%
['k-closest-points-to-origin']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> resultsArray(vector<vector<int>>& queries, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] resultsArray(int[][] queries, int k) {\n \n }\n}"}, {"val...
[[1,2],[3,4],[2,3],[-3,0]] 2
{ "name": "resultsArray", "params": [ { "name": "queries", "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', 'Heap (Priority Queue)']
3,276
Select Cells in Grid With Maximum Score
select-cells-in-grid-with-maximum-score
<p>You are given a 2D matrix <code>grid</code> consisting of positive integers.</p> <p>You have to select <em>one or more</em> cells from the matrix such that the following conditions are satisfied:</p> <ul> <li>No two selected cells are in the <strong>same</strong> row of the matrix.</li> <li>The values in the set...
Hard
10.6K
74.3K
10,612
74,333
14.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxScore(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxScore(List<List<Integer>> grid) {\n \n }\n}"}, {"value": "python", "text": "Py...
[[1,2,3],[4,3,2],[1,1,1]]
{ "name": "maxScore", "params": [ { "name": "grid", "type": "list<list<integer>>" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Bit Manipulation', 'Matrix', 'Bitmask']
3,277
Maximum XOR Score Subarray Queries
maximum-xor-score-subarray-queries
<p>You are given an array <code>nums</code> of <code>n</code> integers, and a 2D integer array <code>queries</code> of size <code>q</code>, where <code>queries[i] = [l<sub>i</sub>, r<sub>i</sub>]</code>.</p> <p>For each query, you must find the <strong>maximum XOR score</strong> of any <span data-keyword="subarray">su...
Hard
4.7K
11.2K
4,688
11,230
41.7%
['make-the-xor-of-all-segments-equal-to-zero']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> maximumSubarrayXor(vector<int>& nums, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] maximumSubarrayXor(int[] nums, int[][] queries) {...
[2,8,4,32,16,1] [[0,2],[1,4],[0,5]]
{ "name": "maximumSubarrayXor", "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', 'Dynamic Programming']
3,278
Find Candidates for Data Scientist Position II
find-candidates-for-data-scientist-position-ii
null
Medium
1.2K
2.8K
1,209
2,758
43.8%
[]
['Create table if not exists Candidates(candidate_id int, skill varchar(50), proficiency int)', 'Create table if not exists Projects( project_id int, skill varchar(50), importance int)', 'Truncate table Candidates', "insert into Candidates (candidate_id, skill, proficiency) values ('101', 'Python', '5')", "insert into ...
Database
null
{"headers":{"Candidates":["candidate_id","skill","proficiency"],"Projects":["project_id","skill","importance"]},"rows":{"Candidates":[[101,"Python",5],[101,"Tableau",3],[101,"PostgreSQL",4],[101,"TensorFlow",2],[102,"Python",4],[102,"Tableau",5],[102,"PostgreSQL",4],[102,"R",4],[103,"Python",3],[103,"Tableau",5],[103,"...
{"mysql": ["Create table if not exists Candidates(candidate_id int, skill varchar(50), proficiency int)", "Create table if not exists Projects( project_id int, skill varchar(50), importance int)"], "mssql": ["Create table Candidates(candidate_id int, skill varchar(50), proficiency int)", "Create table Projects( projec...
{"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']
3,279
Maximum Total Area Occupied by Pistons
maximum-total-area-occupied-by-pistons
null
Hard
335
611
335
611
54.8%
[]
[]
Algorithms
null
5 [2,5] "UD"
{ "name": "maxArea", "params": [ { "name": "height", "type": "integer" }, { "type": "integer[]", "name": "positions" }, { "type": "string", "name": "directions" } ], "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', 'String', 'Simulation', 'Counting', 'Prefix Sum']
3,280
Convert Date to Binary
convert-date-to-binary
<p>You are given a string <code>date</code> representing a Gregorian calendar date in the <code>yyyy-mm-dd</code> format.</p> <p><code>date</code> can be written in its binary representation obtained by converting year, month, and day to their binary representations without any leading zeroes and writing them down in ...
Easy
63.8K
71.9K
63,840
71,900
88.8%
['number-of-1-bits', 'convert-to-base-2']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string convertDateToBinary(string date) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String convertDateToBinary(String date) {\n \n }\n}"}, {"value": "python", "text": "P...
"2080-02-29"
{ "name": "convertDateToBinary", "params": [ { "name": "date", "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']
3,281
Maximize Score of Numbers in Ranges
maximize-score-of-numbers-in-ranges
<p>You are given an array of integers <code>start</code> and an integer <code>d</code>, representing <code>n</code> intervals <code>[start[i], start[i] + d]</code>.</p> <p>You are asked to choose <code>n</code> integers where the <code>i<sup>th</sup></code> integer must belong to the <code>i<sup>th</sup></code> interv...
Medium
21K
61.2K
21,033
61,236
34.3%
['find-k-th-smallest-pair-distance']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxPossibleScore(vector<int>& start, int d) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxPossibleScore(int[] start, int d) {\n \n }\n}"}, {"value": "python", "...
[6,0,3] 2
{ "name": "maxPossibleScore", "params": [ { "name": "start", "type": "integer[]" }, { "type": "integer", "name": "d" } ], "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', 'Greedy', 'Sorting']
3,282
Reach End of Array With Max Score
reach-end-of-array-with-max-score
<p>You are given an integer array <code>nums</code> of length <code>n</code>.</p> <p>Your goal is to start at index <code>0</code> and reach index <code>n - 1</code>. You can only jump to indices <strong>greater</strong> than your current index.</p> <p>The score for a jump from index <code>i</code> to index <code>j</...
Medium
25.9K
79.8K
25,917
79,832
32.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long findMaximumScore(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long findMaximumScore(List<Integer> nums) {\n \n }\n}"}, {"value": "python", "t...
[1,3,1,5]
{ "name": "findMaximumScore", "params": [ { "name": "nums", "type": "list<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']
3,283
Maximum Number of Moves to Kill All Pawns
maximum-number-of-moves-to-kill-all-pawns
<p>There is a <code>50 x 50</code> chessboard with <strong>one</strong> knight and some pawns on it. You are given two integers <code>kx</code> and <code>ky</code> where <code>(kx, ky)</code> denotes the position of the knight, and a 2D array <code>positions</code> where <code>positions[i] = [x<sub>i</sub>, y<sub>i</su...
Hard
6.1K
19.3K
6,145
19,261
31.9%
['knight-probability-in-chessboard', 'check-knight-tour-configuration']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxMoves(int kx, int ky, vector<vector<int>>& positions) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxMoves(int kx, int ky, int[][] positions) {\n \n }\n}"}, {...
1 1 [[0,0]]
{ "name": "maxMoves", "params": [ { "name": "kx", "type": "integer" }, { "type": "integer", "name": "ky" }, { "type": "integer[][]", "name": "positions" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Bit Manipulation', 'Breadth-First Search', 'Game Theory', 'Bitmask']
3,284
Sum of Consecutive Subarrays
sum-of-consecutive-subarrays
null
Medium
587
1.4K
587
1,421
41.3%
[]
[]
Algorithms
null
[1,2,3]
{ "name": "getSum", "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', 'Two Pointers', 'Dynamic Programming']
3,285
Find Indices of Stable Mountains
find-indices-of-stable-mountains
<p>There are <code>n</code> mountains in a row, and each mountain has a height. You are given an integer array <code>height</code> where <code>height[i]</code> represents the height of mountain <code>i</code>, and an integer <code>threshold</code>.</p> <p>A mountain is called <strong>stable</strong> if the mountain ju...
Easy
52.5K
61.2K
52,522
61,177
85.9%
['find-in-mountain-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> stableMountains(vector<int>& height, int threshold) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> stableMountains(int[] height, int threshold) {\n \...
[1,2,3,4,5] 2
{ "name": "stableMountains", "params": [ { "name": "height", "type": "integer[]" }, { "type": "integer", "name": "threshold" } ], "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']
3,286
Find a Safe Walk Through a Grid
find-a-safe-walk-through-a-grid
<p>You are given an <code>m x n</code> binary matrix <code>grid</code> and an integer <code>health</code>.</p> <p>You start on the upper-left corner <code>(0, 0)</code> and would like to get to the lower-right corner <code>(m - 1, n - 1)</code>.</p> <p>You can move up, down, left, or right from one cell to another ad...
Medium
28.3K
94.5K
28,279
94,550
29.9%
['shortest-path-in-a-grid-with-obstacles-elimination']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool findSafeWalk(vector<vector<int>>& grid, int health) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean findSafeWalk(List<List<Integer>> grid, int health) {\n \n }\...
[[0,1,0,0,0],[0,1,0,1,0],[0,0,0,1,0]] 1
{ "name": "findSafeWalk", "params": [ { "name": "grid", "type": "list<list<integer>>" }, { "type": "integer", "name": "health" } ], "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', 'Breadth-First Search', 'Graph', 'Heap (Priority Queue)', 'Matrix', 'Shortest Path']
3,287
Find the Maximum Sequence Value of Array
find-the-maximum-sequence-value-of-array
<p>You are given an integer array <code>nums</code> and a <strong>positive</strong> integer <code>k</code>.</p> <p>The <strong>value</strong> of a sequence <code>seq</code> of size <code>2 * x</code> is defined as:</p> <ul> <li><code>(seq[0] OR seq[1] OR ... OR seq[x - 1]) XOR (seq[x] OR seq[x + 1] OR ... OR seq[2 *...
Hard
4.6K
25K
4,568
25,023
18.3%
['bitwise-ors-of-subarrays']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxValue(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxValue(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[2,6,7] 1
{ "name": "maxValue", "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', 'Bit Manipulation']
3,288
Length of the Longest Increasing Path
length-of-the-longest-increasing-path
<p>You are given a 2D array of integers <code>coordinates</code> of length <code>n</code> and an integer <code>k</code>, where <code>0 &lt;= k &lt; n</code>.</p> <p><code>coordinates[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> indicates the point <code>(x<sub>i</sub>, y<sub>i</sub>)</code> in a 2D plane.</p> <p>An <st...
Hard
4.7K
27.8K
4,674
27,837
16.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxPathLength(vector<vector<int>>& coordinates, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxPathLength(int[][] coordinates, int k) {\n \n }\n}"}, {"val...
[[3,1],[2,2],[4,1],[0,0],[5,3]] 1
{ "name": "maxPathLength", "params": [ { "name": "coordinates", "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', 'Sorting']
3,289
The Two Sneaky Numbers of Digitville
the-two-sneaky-numbers-of-digitville
<p>In the town of Digitville, there was a list of numbers called <code>nums</code> containing integers from <code>0</code> to <code>n - 1</code>. Each number was supposed to appear <strong>exactly once</strong> in the list, however, <strong>two</strong> mischievous numbers sneaked in an <em>additional time</em>, making...
Easy
85.5K
97K
85,529
96,993
88.2%
['find-all-duplicates-in-an-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getSneakyNumbers(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getSneakyNumbers(int[] nums) {\n \n }\n}"}, {"value": "python", "text":...
[0,1,1,0]
{ "name": "getSneakyNumbers", "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', 'Math']
3,290
Maximum Multiplication Score
maximum-multiplication-score
<p>You are given an integer array <code>a</code> of size 4 and another integer array <code>b</code> of size <strong>at least</strong> 4.</p> <p>You need to choose 4 indices <code>i<sub>0</sub></code>, <code>i<sub>1</sub></code>, <code>i<sub>2</sub></code>, and <code>i<sub>3</sub></code> from the array <code>b</code> s...
Medium
33.6K
82.2K
33,606
82,165
40.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxScore(vector<int>& a, vector<int>& b) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxScore(int[] a, int[] b) {\n \n }\n}"}, {"value": "python", "text":...
[3,2,5,6] [2,-6,4,-5,-3,2,-7]
{ "name": "maxScore", "params": [ { "name": "a", "type": "integer[]" }, { "type": "integer[]", "name": "b" } ], "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']
3,291
Minimum Number of Valid Strings to Form Target I
minimum-number-of-valid-strings-to-form-target-i
<p>You are given an array of strings <code>words</code> and a string <code>target</code>.</p> <p>A string <code>x</code> is called <strong>valid</strong> if <code>x</code> is a <span data-keyword="string-prefix">prefix</span> of <strong>any</strong> string in <code>words</code>.</p> <p>Return the <strong>minimum</str...
Medium
12.1K
61.3K
12,115
61,314
19.8%
['minimum-cost-to-convert-string-ii', 'construct-string-with-minimum-cost']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minValidStrings(vector<string>& words, string target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minValidStrings(String[] words, String target) {\n \n }\n}"}, {...
["abc","aaaaa","bcdef"] "aabcdabc"
{ "name": "minValidStrings", "params": [ { "name": "words", "type": "string[]" }, { "type": "string", "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', 'String', 'Binary Search', 'Dynamic Programming', 'Trie', 'Segment Tree', 'Rolling Hash', 'String Matching', 'Hash Function']
3,292
Minimum Number of Valid Strings to Form Target II
minimum-number-of-valid-strings-to-form-target-ii
<p>You are given an array of strings <code>words</code> and a string <code>target</code>.</p> <p>A string <code>x</code> is called <strong>valid</strong> if <code>x</code> is a <span data-keyword="string-prefix">prefix</span> of <strong>any</strong> string in <code>words</code>.</p> <p>Return the <strong>minimum</str...
Hard
4.2K
23.6K
4,212
23,637
17.8%
['minimum-cost-to-convert-string-ii', 'construct-string-with-minimum-cost']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minValidStrings(vector<string>& words, string target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minValidStrings(String[] words, String target) {\n \n }\n}"}, {...
["abc","aaaaa","bcdef"] "aabcdabc"
{ "name": "minValidStrings", "params": [ { "name": "words", "type": "string[]" }, { "type": "string", "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', 'String', 'Binary Search', 'Dynamic Programming', 'Segment Tree', 'Rolling Hash', 'String Matching', 'Hash Function']
3,293
Calculate Product Final Price
calculate-product-final-price
null
Medium
1.5K
1.9K
1,532
1,900
80.6%
[]
['Create table if not exists Products (product_id int, category varchar(50), price int)', 'Create table if not exists Discounts(category varchar(50), discount int)', 'Truncate table Products', "insert into Products (product_id, category, price) values ('1', 'Electronics', '1000')", "insert into Products (product_id, ca...
Database
null
{"headers":{"Products":["product_id","category","price"],"Discounts":["category","discount"]},"rows":{"Products":[[1,"Electronics",1000],[2,"Clothing",50],[3,"Electronics",1200],[4,"Home",500]],"Discounts":[["Electronics",10],["Clothing",20]]}}
{"mysql": ["Create table if not exists Products (product_id int, category varchar(50), price int)", "Create table if not exists Discounts(category varchar(50), discount int)"], "mssql": ["Create table Products (product_id int, category varchar(50), price int)", "Create table Discounts(category varchar(50), discount 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']
3,294
Convert Doubly Linked List to Array II
convert-doubly-linked-list-to-array-ii
null
Medium
2K
2.4K
1,983
2,432
81.5%
['remove-linked-list-elements']
[]
Algorithms
null
[1,2,3,4,5] 5
{ "name": "foobar", "params": [ { "name": "head", "type": "ListNode" }, { "type": "integer", "name": "node" } ], "return": { "type": "integer" }, "manual": true, "languages": [ "cpp", "java", "python", "c", "csharp", "javascript", "go...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Linked List', 'Doubly-Linked List']
3,295
Report Spam Message
report-spam-message
<p>You are given an array of strings <code>message</code> and an array of strings <code>bannedWords</code>.</p> <p>An array of words is considered <strong>spam</strong> if there are <strong>at least</strong> two words in it that <b>exactly</b> match any word in <code>bannedWords</code>.</p> <p>Return <code>true</code...
Medium
50.7K
107K
50,684
107,017
47.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool reportSpam(vector<string>& message, vector<string>& bannedWords) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean reportSpam(String[] message, String[] bannedWords) {\n ...
["hello","world","leetcode"] ["world","hello"]
{ "name": "reportSpam", "params": [ { "name": "message", "type": "string[]" }, { "type": "string[]", "name": "bannedWords" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String']
3,296
Minimum Number of Seconds to Make Mountain Height Zero
minimum-number-of-seconds-to-make-mountain-height-zero
<p>You are given an integer <code>mountainHeight</code> denoting the height of a mountain.</p> <p>You are also given an integer array <code>workerTimes</code> representing the work time of workers in <strong>seconds</strong>.</p> <p>The workers work <strong>simultaneously</strong> to <strong>reduce</strong> the heigh...
Medium
22.8K
63.9K
22,803
63,868
35.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minNumberOfSeconds(int mountainHeight, vector<int>& workerTimes) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minNumberOfSeconds(int mountainHeight, int[] workerTime...
4 [2,1,1]
{ "name": "minNumberOfSeconds", "params": [ { "name": "mountainHeight", "type": "integer" }, { "type": "integer[]", "name": "workerTimes" } ], "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', 'Math', 'Binary Search', 'Greedy', 'Heap (Priority Queue)']
3,297
Count Substrings That Can Be Rearranged to Contain a String I
count-substrings-that-can-be-rearranged-to-contain-a-string-i
<p>You are given two strings <code>word1</code> and <code>word2</code>.</p> <p>A string <code>x</code> is called <strong>valid</strong> if <code>x</code> can be rearranged to have <code>word2</code> as a <span data-keyword="string-prefix">prefix</span>.</p> <p>Return the total number of <strong>valid</strong> <span d...
Medium
17K
41.3K
16,994
41,305
41.1%
['minimum-window-substring']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long validSubstringCount(string word1, string word2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long validSubstringCount(String word1, String word2) {\n \n }\n}"},...
"bcca" "abc"
{ "name": "validSubstringCount", "params": [ { "name": "word1", "type": "string" }, { "type": "string", "name": "word2" } ], "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', 'Sliding Window']
3,298
Count Substrings That Can Be Rearranged to Contain a String II
count-substrings-that-can-be-rearranged-to-contain-a-string-ii
<p>You are given two strings <code>word1</code> and <code>word2</code>.</p> <p>A string <code>x</code> is called <strong>valid</strong> if <code>x</code> can be rearranged to have <code>word2</code> as a <span data-keyword="string-prefix">prefix</span>.</p> <p>Return the total number of <strong>valid</strong> <span d...
Hard
14.9K
27K
14,910
26,961
55.3%
['minimum-window-substring']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long validSubstringCount(string word1, string word2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long validSubstringCount(String word1, String word2) {\n \n }\n}"},...
"bcca" "abc"
{ "name": "validSubstringCount", "params": [ { "name": "word1", "type": "string" }, { "type": "string", "name": "word2" } ], "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', 'Sliding Window']
3,299
Sum of Consecutive Subsequences
sum-of-consecutive-subsequences
null
Hard
355
889
355
889
39.9%
[]
[]
Algorithms
null
[1,2]
{ "name": "getSum", "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', 'Dynamic Programming']
3,300
Minimum Element After Replacement With Digit Sum
minimum-element-after-replacement-with-digit-sum
<p>You are given an integer array <code>nums</code>.</p> <p>You replace each element in <code>nums</code> with the <strong>sum</strong> of its digits.</p> <p>Return the <strong>minimum</strong> element in <code>nums</code> after all replacements.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> ...
Easy
54.3K
65.2K
54,336
65,235
83.3%
['sum-of-digits-of-string-after-convert']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minElement(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minElement(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[10,12,13,14]
{ "name": "minElement", "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']
3,301
Maximize the Total Height of Unique Towers
maximize-the-total-height-of-unique-towers
<p>You are given an array <code>maximumHeight</code>, where <code>maximumHeight[i]</code> denotes the <strong>maximum</strong> height the <code>i<sup>th</sup></code> tower can be assigned.</p> <p>Your task is to assign a height to each tower so that:</p> <ol> <li>The height of the <code>i<sup>th</sup></code> tower i...
Medium
31.3K
86.8K
31,349
86,833
36.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumTotalSum(vector<int>& maximumHeight) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumTotalSum(int[] maximumHeight) {\n \n }\n}"}, {"value": "pyt...
[2,3,4,3]
{ "name": "maximumTotalSum", "params": [ { "name": "maximumHeight", "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', 'Sorting']
3,302
Find the Lexicographically Smallest Valid Sequence
find-the-lexicographically-smallest-valid-sequence
<p>You are given two strings <code>word1</code> and <code>word2</code>.</p> <p>A string <code>x</code> is called <strong>almost equal</strong> to <code>y</code> if you can change <strong>at most</strong> one character in <code>x</code> to make it <em>identical</em> to <code>y</code>.</p> <p>A sequence of indices <cod...
Medium
6.2K
31K
6,215
31,026
20.0%
['smallest-k-length-subsequence-with-occurrences-of-a-letter']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> validSequence(string word1, string word2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] validSequence(String word1, String word2) {\n \n }\n}"}, {"value"...
"vbcca" "abc"
{ "name": "validSequence", "params": [ { "name": "word1", "type": "string" }, { "type": "string", "name": "word2" } ], "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', 'Dynamic Programming', 'Greedy']
3,303
Find the Occurrence of First Almost Equal Substring
find-the-occurrence-of-first-almost-equal-substring
<p>You are given two strings <code>s</code> and <code>pattern</code>.</p> <p>A string <code>x</code> is called <strong>almost equal</strong> to <code>y</code> if you can change <strong>at most</strong> one character in <code>x</code> to make it <em>identical</em> to <code>y</code>.</p> <p>Return the <strong>smallest<...
Hard
4.2K
30.9K
4,182
30,896
13.5%
['check-whether-two-strings-are-almost-equivalent', 'count-almost-equal-pairs-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minStartingIndex(string s, string pattern) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minStartingIndex(String s, String pattern) {\n \n }\n}"}, {"value": "pytho...
"abcdefg" "bcdffg"
{ "name": "minStartingIndex", "params": [ { "name": "s", "type": "string" }, { "type": "string", "name": "pattern" } ], "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', 'String Matching']
3,304
Find the K-th Character in String Game I
find-the-k-th-character-in-string-game-i
<p>Alice and Bob are playing a game. Initially, Alice has a string <code>word = &quot;a&quot;</code>.</p> <p>You are given a <strong>positive</strong> integer <code>k</code>.</p> <p>Now Bob will ask Alice to perform the following operation <strong>forever</strong>:</p> <ul> <li>Generate a new string by <strong>chan...
Easy
54.9K
75.6K
54,945
75,555
72.7%
['shifting-letters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n char kthCharacter(int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public char kthCharacter(int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class ...
5
{ "name": "kthCharacter", "params": [ { "name": "k", "type": "integer" } ], "return": { "type": "character" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Bit Manipulation', 'Recursion', 'Simulation']
3,305
Count of Substrings Containing Every Vowel and K Consonants I
count-of-substrings-containing-every-vowel-and-k-consonants-i
<p>You are given a string <code>word</code> and a <strong>non-negative</strong> integer <code>k</code>.</p> <p>Return the total number of <span data-keyword="substring-nonempty">substrings</span> of <code>word</code> that contain every vowel (<code>&#39;a&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;i&#39;</code>...
Medium
29.3K
71.4K
29,253
71,402
41.0%
['longest-substring-of-all-vowels-in-order', 'count-vowel-substrings-of-a-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countOfSubstrings(string word, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countOfSubstrings(String word, int k) {\n \n }\n}"}, {"value": "python", "text"...
"aeioqq" 1
{ "name": "countOfSubstrings", "params": [ { "name": "word", "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...
['Hash Table', 'String', 'Sliding Window']
3,306
Count of Substrings Containing Every Vowel and K Consonants II
count-of-substrings-containing-every-vowel-and-k-consonants-ii
<p>You are given a string <code>word</code> and a <strong>non-negative</strong> integer <code>k</code>.</p> <p>Return the total number of <span data-keyword="substring-nonempty">substrings</span> of <code>word</code> that contain every vowel (<code>&#39;a&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;i&#39;</code>...
Medium
108.3K
265.9K
108,286
265,901
40.7%
['longest-substring-of-all-vowels-in-order', 'count-vowel-substrings-of-a-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countOfSubstrings(string word, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countOfSubstrings(String word, int k) {\n \n }\n}"}, {"value": "python",...
"aeioqq" 1
{ "name": "countOfSubstrings", "params": [ { "name": "word", "type": "string" }, { "type": "integer", "name": "k" } ], "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', 'Sliding Window']
3,307
Find the K-th Character in String Game II
find-the-k-th-character-in-string-game-ii
<p>Alice and Bob are playing a game. Initially, Alice has a string <code>word = &quot;a&quot;</code>.</p> <p>You are given a <strong>positive</strong> integer <code>k</code>. You are also given an integer array <code>operations</code>, where <code>operations[i]</code> represents the <strong>type</strong> of the <code>...
Hard
9K
31.2K
9,026
31,214
28.9%
['shifting-letters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n char kthCharacter(long long k, vector<int>& operations) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public char kthCharacter(long k, int[] operations) {\n \n }\n}"}, {"value": ...
5 [0,0,0]
{ "name": "kthCharacter", "params": [ { "name": "k", "type": "long" }, { "type": "integer[]", "name": "operations" } ], "return": { "type": "character" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Bit Manipulation', 'Recursion']
3,308
Find Top Performing Driver
find-top-performing-driver
null
Medium
1.4K
2.7K
1,369
2,729
50.2%
[]
['CREATE TABLE If not exists Drivers (\n driver_id INT ,\n name VARCHAR(100),\n age INT,\n experience INT,\n accidents INT\n)', 'CREATE TABLE If not exists Vehicles (\n vehicle_id INT ,\n driver_id INT,\n model VARCHAR(100),\n fuel_type VARCHAR(50),\n mileage INT)', 'CREATE TABLE If not e...
Database
null
{"headers":{"Drivers":["driver_id","name","age","experience","accidents"],"Vehicles":["vehicle_id","driver_id","model","fuel_type","mileage"],"Trips":["trip_id","vehicle_id","distance","duration","rating"]},"rows":{"Drivers":[[1,"Alice",34,10,1],[2,"Bob",45,20,3],[3,"Charlie",28,5,0]],"Vehicles":[[100,1,"Sedan","Gasoli...
{"mysql": ["CREATE TABLE If not exists Drivers (\n driver_id INT ,\n name VARCHAR(100),\n age INT,\n experience INT,\n accidents INT\n)", "CREATE TABLE If not exists Vehicles (\n vehicle_id INT ,\n driver_id INT,\n model VARCHAR(100),\n fuel_type VARCHAR(50),\n mileage INT)", "CREATE TABLE...
{"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']
3,309
Maximum Possible Number by Binary Concatenation
maximum-possible-number-by-binary-concatenation
<p>You are given an array of integers <code>nums</code> of size 3.</p> <p>Return the <strong>maximum</strong> possible number whose <em>binary representation</em> can be formed by <strong>concatenating</strong> the <em>binary representation</em> of <strong>all</strong> elements in <code>nums</code> in some order.</p> ...
Medium
33.9K
52.2K
33,907
52,221
64.9%
['concatenation-of-consecutive-binary-numbers']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxGoodNumber(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxGoodNumber(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[1,2,3]
{ "name": "maxGoodNumber", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Bit Manipulation', 'Enumeration']