questionFrontendId
int64
1
3.51k
questionTitle
stringlengths
3
79
TitleSlug
stringlengths
3
79
content
stringlengths
431
25.4k
difficulty
stringclasses
3 values
totalAccepted
stringlengths
2
6
totalSubmission
stringlengths
2
6
totalAcceptedRaw
int64
124
16.8M
totalSubmissionRaw
int64
285
30.3M
acRate
stringlengths
4
5
similarQuestions
stringlengths
2
714
mysqlSchemas
stringclasses
295 values
category
stringclasses
6 values
codeDefinition
stringlengths
122
24.9k
sampleTestCase
stringlengths
1
4.33k
metaData
stringlengths
37
3.13k
envInfo
stringclasses
26 values
topicTags
stringlengths
2
153
1,802
Maximum Value at a Given Index in a Bounded Array
maximum-value-at-a-given-index-in-a-bounded-array
<p>You are given three positive integers:&nbsp;<code>n</code>, <code>index</code>, and <code>maxSum</code>. You want to construct an array <code>nums</code> (<strong>0-indexed</strong>)<strong> </strong>that satisfies the following conditions:</p> <ul> <li><code>nums.length == n</code></li> <li><code>nums[i]</code> ...
Medium
81.7K
210.4K
81,660
210,386
38.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxValue(int n, int index, int maxSum) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxValue(int n, int index, int maxSum) {\n \n }\n}"}, {"value": "python", "tex...
4 2 6
{ "name": "maxValue", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "index" }, { "type": "integer", "name": "maxSum" } ], "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...
['Binary Search', 'Greedy']
1,803
Count Pairs With XOR in a Range
count-pairs-with-xor-in-a-range
<p>Given a <strong>(0-indexed)</strong> integer array <code>nums</code> and two integers <code>low</code> and <code>high</code>, return <em>the number of <strong>nice pairs</strong></em>.</p> <p>A <strong>nice pair</strong> is a pair <code>(i, j)</code> where <code>0 &lt;= i &lt; j &lt; nums.length</code> and <code>lo...
Hard
10.7K
23.4K
10,724
23,390
45.8%
['count-paths-with-the-given-xor-value']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countPairs(vector<int>& nums, int low, int high) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countPairs(int[] nums, int low, int high) {\n \n }\n}"}, {"value": "...
[1,4,2,7] 2 6
{ "name": "countPairs", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "low" }, { "type": "integer", "name": "high" } ], "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', 'Trie']
1,804
Implement Trie II (Prefix Tree)
implement-trie-ii-prefix-tree
null
Medium
23.8K
37.8K
23,799
37,759
63.0%
['implement-trie-prefix-tree', 'encrypt-and-decrypt-strings']
[]
Algorithms
null
["Trie","insert","insert","countWordsEqualTo","countWordsStartingWith","erase","countWordsEqualTo","countWordsStartingWith","erase","countWordsStartingWith"] [[],["apple"],["apple"],["apple"],["app"],["apple"],["apple"],["app"],["apple"],["app"]]
{ "classname": "Trie", "constructor": { "params": [] }, "methods": [ { "params": [ { "type": "string", "name": "word" } ], "name": "insert", "return": { "type": "void" } }, { "params": [ { "type": "...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Design', 'Trie']
1,805
Number of Different Integers in a String
number-of-different-integers-in-a-string
<p>You are given a string <code>word</code> that consists of digits and lowercase English letters.</p> <p>You will replace every non-digit character with a space. For example, <code>&quot;a123bc34d8ef34&quot;</code> will become <code>&quot; 123&nbsp; 34 8&nbsp; 34&quot;</code>. Notice that you are left with some integ...
Easy
55.8K
143.2K
55,780
143,244
38.9%
['longest-subarray-with-maximum-bitwise-and']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numDifferentIntegers(string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numDifferentIntegers(String word) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
"a123bc34d8ef34"
{ "name": "numDifferentIntegers", "params": [ { "name": "word", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String']
1,806
Minimum Number of Operations to Reinitialize a Permutation
minimum-number-of-operations-to-reinitialize-a-permutation
<p>You are given an <strong>even</strong> integer <code>n</code>​​​​​​. You initially have a permutation <code>perm</code> of size <code>n</code>​​ where <code>perm[i] == i</code>​ <strong>(0-indexed)</strong>​​​​.</p> <p>In one operation, you will create a new array <code>arr</code>, and for each <code>i</code>:</p> ...
Medium
21K
29.2K
21,031
29,226
72.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int reinitializePermutation(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int reinitializePermutation(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
2
{ "name": "reinitializePermutation", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Simulation']
1,807
Evaluate the Bracket Pairs of a String
evaluate-the-bracket-pairs-of-a-string
<p>You are given a string <code>s</code> that contains some bracket pairs, with each pair containing a <strong>non-empty</strong> key.</p> <ul> <li>For example, in the string <code>&quot;(name)is(age)yearsold&quot;</code>, there are <strong>two</strong> bracket pairs that contain the keys <code>&quot;name&quot;</code...
Medium
35.5K
52.3K
35,517
52,339
67.9%
['apply-substitutions']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string evaluate(string s, vector<vector<string>>& knowledge) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String evaluate(String s, List<List<String>> knowledge) {\n \n }...
"(name)is(age)yearsold" [["name","bob"],["age","two"]]
{ "name": "evaluate", "params": [ { "type": "string", "name": "s" }, { "type": "list<list<string>>", "name": "knowledge" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String']
1,808
Maximize Number of Nice Divisors
maximize-number-of-nice-divisors
<p>You are given a positive integer <code>primeFactors</code>. You are asked to construct a positive integer <code>n</code> that satisfies the following conditions:</p> <ul> <li>The number of prime factors of <code>n</code> (not necessarily distinct) is <strong>at most</strong> <code>primeFactors</code>.</li> <li>...
Hard
8.4K
25.6K
8,360
25,592
32.7%
['integer-break']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxNiceDivisors(int primeFactors) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxNiceDivisors(int primeFactors) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
5
{ "name": "maxNiceDivisors", "params": [ { "name": "primeFactors", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Recursion', 'Number Theory']
1,809
Ad-Free Sessions
ad-free-sessions
null
Easy
17.7K
30.3K
17,743
30,264
58.6%
[]
['Create table If Not Exists Playback(session_id int,customer_id int,start_time int,end_time int)', 'Create table If Not Exists Ads (ad_id int, customer_id int, timestamp int)', 'Truncate table Playback', "insert into Playback (session_id, customer_id, start_time, end_time) values ('1', '1', '1', '5')", "insert into Pl...
Database
null
{"headers":{"Playback":["session_id","customer_id","start_time","end_time"],"Ads":["ad_id","customer_id","timestamp"]},"rows":{"Playback":[[1,1,1,5],[2,1,15,23],[3,2,10,12],[4,2,17,28],[5,2,2,8]],"Ads":[[1,1,5],[2,2,17],[3,2,20]]}}
{"mysql": ["Create table If Not Exists Playback(session_id int,customer_id int,start_time int,end_time int)", "Create table If Not Exists Ads (ad_id int, customer_id int, timestamp int)"], "mssql": ["Create table Playback(session_id int,customer_id int,start_time int,end_time int)", "Create table Ads (ad_id int, custom...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,810
Minimum Path Cost in a Hidden Grid
minimum-path-cost-in-a-hidden-grid
null
Medium
4.8K
8.3K
4,805
8,261
58.2%
['robot-room-cleaner', 'shortest-path-in-a-hidden-grid']
[]
Algorithms
null
[[2,3],[1,1]] 0 1 1 0
{ "name": "findShortestPath", "params": [ { "type": "integer[][]", "name": "grid" }, { "type": "integer", "name": "r1" }, { "type": "integer", "name": "c1" }, { "type": "integer", "name": "r2" }, { "type": "integer", "na...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Depth-First Search', 'Breadth-First Search', 'Graph', 'Heap (Priority Queue)', 'Interactive']
1,811
Find Interview Candidates
find-interview-candidates
null
Medium
17.4K
28.7K
17,392
28,674
60.7%
[]
['Create table If Not Exists Contests (contest_id int, gold_medal int, silver_medal int, bronze_medal int)', 'Create table If Not Exists Users (user_id int, mail varchar(50), name varchar(30))', 'Truncate table Contests', "insert into Contests (contest_id, gold_medal, silver_medal, bronze_medal) values ('190', '1', '5'...
Database
null
{"headers":{"Contests":["contest_id","gold_medal","silver_medal","bronze_medal"],"Users":["user_id","mail","name"]},"rows":{"Contests":[[190,1,5,2],[191,2,3,5],[192,5,2,3],[193,1,3,5],[194,4,5,2],[195,4,2,1],[196,1,5,2]],"Users":[[1,"sarah@leetcode.com","Sarah"],[2,"bob@leetcode.com","Bob"],[3,"alice@leetcode.com","Ali...
{"mysql": ["Create table If Not Exists Contests (contest_id int, gold_medal int, silver_medal int, bronze_medal int)", "Create table If Not Exists Users (user_id int, mail varchar(50), name varchar(30))"], "mssql": ["Create table Contests (contest_id int, gold_medal int, silver_medal int, bronze_medal int)", "Create ta...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,812
Determine Color of a Chessboard Square
determine-color-of-a-chessboard-square
<p>You are given <code>coordinates</code>, a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference.</p> <p><img alt="" src="https://assets.leetcode.com/uploads/2021/02/19/screenshot-2021-02-20-at-22159-pm.png" style="width: 400px; height: 396px;" /></p> <p>Retu...
Easy
100K
126.4K
100,023
126,431
79.1%
['check-if-two-chessboard-squares-have-the-same-color']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean squareIsWhite(String coordinates) {\n \n }\n}"}, {"value": "python", "text": "...
"a1"
{ "name": "squareIsWhite", "params": [ { "name": "coordinates", "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']
1,813
Sentence Similarity III
sentence-similarity-iii
<p>You are given two strings <code>sentence1</code> and <code>sentence2</code>, each representing a <strong>sentence</strong> composed of words. A sentence is a list of <strong>words</strong> that are separated by a <strong>single</strong> space with no leading or trailing spaces. Each word consists of only uppercase a...
Medium
126.5K
260K
126,480
260,008
48.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool areSentencesSimilar(string sentence1, string sentence2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean areSentencesSimilar(String sentence1, String sentence2) {\n ...
"My name is Haley" "My Haley"
{ "name": "areSentencesSimilar", "params": [ { "name": "sentence1", "type": "string" }, { "type": "string", "name": "sentence2" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Two Pointers', 'String']
1,814
Count Nice Pairs in an Array
count-nice-pairs-in-an-array
<p>You are given an array <code>nums</code> that consists of non-negative integers. Let us define <code>rev(x)</code> as the reverse of the non-negative integer <code>x</code>. For example, <code>rev(123) = 321</code>, and <code>rev(120) = 21</code>. A pair of indices <code>(i, j)</code> is <strong>nice</strong> if it ...
Medium
121.1K
249.3K
121,071
249,310
48.6%
['number-of-pairs-of-interchangeable-rectangles', 'count-number-of-bad-pairs', 'number-of-pairs-satisfying-inequality']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countNicePairs(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countNicePairs(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
[42,11,1,97]
{ "name": "countNicePairs", "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', 'Counting']
1,815
Maximum Number of Groups Getting Fresh Donuts
maximum-number-of-groups-getting-fresh-donuts
<p>There is a donuts shop that bakes donuts in batches of <code>batchSize</code>. They have a rule where they must serve <strong>all</strong> of the donuts of a batch before serving any donuts of the next batch. You are given an integer <code>batchSize</code> and an integer array <code>groups</code>, where <code>groups...
Hard
7.4K
18.5K
7,447
18,513
40.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxHappyGroups(int batchSize, vector<int>& groups) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxHappyGroups(int batchSize, int[] groups) {\n \n }\n}"}, {"value...
3 [1,2,3,4,5,6]
{ "name": "maxHappyGroups", "params": [ { "name": "batchSize", "type": "integer" }, { "type": "integer[]", "name": "groups" } ], "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', 'Memoization', 'Bitmask']
1,816
Truncate Sentence
truncate-sentence
<p>A <strong>sentence</strong> is a list of words that are separated by a single space with no leading or trailing spaces. Each of the words consists of <strong>only</strong> uppercase and lowercase English letters (no punctuation).</p> <ul> <li>For example, <code>&quot;Hello World&quot;</code>, <code>&quot;HELLO&quo...
Easy
200.6K
233.4K
200,567
233,387
85.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string truncateSentence(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String truncateSentence(String s, int k) {\n \n }\n}"}, {"value": "python", "text": ...
"Hello how are you Contestant" 4
{ "name": "truncateSentence", "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...
['Array', 'String']
1,817
Finding the Users Active Minutes
finding-the-users-active-minutes
<p>You are given the logs for users&#39; actions on LeetCode, and an integer <code>k</code>. The logs are represented by a 2D integer array <code>logs</code> where each <code>logs[i] = [ID<sub>i</sub>, time<sub>i</sub>]</code> indicates that the user with <code>ID<sub>i</sub></code> performed an action at the minute <c...
Medium
63.9K
79.4K
63,877
79,442
80.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findingUsersActiveMinutes(vector<vector<int>>& logs, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findingUsersActiveMinutes(int[][] logs, int k) {\n ...
[[0,5],[1,2],[0,2],[0,5],[1,3]] 5
{ "name": "findingUsersActiveMinutes", "params": [ { "name": "logs", "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']
1,818
Minimum Absolute Sum Difference
minimum-absolute-sum-difference
<p>You are given two positive integer arrays <code>nums1</code> and <code>nums2</code>, both of length <code>n</code>.</p> <p>The <strong>absolute sum difference</strong> of arrays <code>nums1</code> and <code>nums2</code> is defined as the <strong>sum</strong> of <code>|nums1[i] - nums2[i]|</code> for each <code>0 &l...
Medium
28.4K
91.2K
28,406
91,210
31.1%
['minimum-sum-of-squared-difference', 'minimize-the-maximum-adjacent-element-difference']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minAbsoluteSumDiff(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minAbsoluteSumDiff(int[] nums1, int[] nums2) {\n \n }\n}"}...
[1,7,5] [2,3,5]
{ "name": "minAbsoluteSumDiff", "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', 'Binary Search', 'Sorting', 'Ordered Set']
1,819
Number of Different Subsequences GCDs
number-of-different-subsequences-gcds
<p>You are given an array <code>nums</code> that consists of positive integers.</p> <p>The <strong>GCD</strong> of a sequence of numbers is defined as the greatest integer that divides <strong>all</strong> the numbers in the sequence evenly.</p> <ul> <li>For example, the GCD of the sequence <code>[4,6,16]</code> is ...
Hard
10.4K
25.2K
10,446
25,164
41.5%
['find-greatest-common-divisor-of-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countDifferentSubsequenceGCDs(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countDifferentSubsequenceGCDs(int[] nums) {\n \n }\n}"}, {"value": "...
[6,10,3]
{ "name": "countDifferentSubsequenceGCDs", "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', 'Counting', 'Number Theory']
1,820
Maximum Number of Accepted Invitations
maximum-number-of-accepted-invitations
null
Medium
10.1K
19.6K
10,137
19,635
51.6%
[]
[]
Algorithms
null
[[1,1,1],[1,0,1],[0,0,1]]
{ "name": "maximumInvitations", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Depth-First Search', 'Graph', 'Matrix']
1,821
Find Customers With Positive Revenue this Year
find-customers-with-positive-revenue-this-year
null
Easy
31.5K
36K
31,519
35,958
87.7%
[]
['Create table If Not Exists Customers (customer_id int, year int, revenue int)', 'Truncate table Customers', "insert into Customers (customer_id, year, revenue) values ('1', '2018', '50')", "insert into Customers (customer_id, year, revenue) values ('1', '2021', '30')", "insert into Customers (customer_id, year, reven...
Database
null
{"headers":{"Customers":["customer_id","year","revenue"]},"rows":{"Customers":[["1","2018","50"],["1","2021","30"],["1","2020","70"],["2","2021","-50"],["3","2018","10"],["3","2016","50"],["4","2021","20"]]}}
{"mysql": ["Create table If Not Exists Customers (customer_id int, year int, revenue int)"], "mssql": ["Create table Customers (customer_id int, year int, revenue int)"], "oraclesql": ["Create table Customers (customer_id int, year int, revenue int)"], "database": true, "name": "find_customers", "pythondata": ["Custome...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,822
Sign of the Product of an Array
sign-of-the-product-of-an-array
<p>Implement a function <code>signFunc(x)</code> that returns:</p> <ul> <li><code>1</code> if <code>x</code> is positive.</li> <li><code>-1</code> if <code>x</code> is negative.</li> <li><code>0</code> if <code>x</code> is equal to <code>0</code>.</li> </ul> <p>You are given an integer array <code>nums</code>. Let...
Easy
379.6K
582.6K
379,568
582,591
65.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int arraySign(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int arraySign(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode"...
[-1,-2,-3,-4,3,2,1]
{ "name": "arraySign", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math']
1,823
Find the Winner of the Circular Game
find-the-winner-of-the-circular-game
<p>There are <code>n</code> friends that are playing a game. The friends are sitting in a circle and are numbered from <code>1</code> to <code>n</code> in <strong>clockwise order</strong>. More formally, moving clockwise from the <code>i<sup>th</sup></code> friend brings you to the <code>(i+1)<sup>th</sup></code> frien...
Medium
325.2K
396.6K
325,207
396,579
82.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findTheWinner(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findTheWinner(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "default...
5 2
{ "name": "findTheWinner", "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...
['Array', 'Math', 'Recursion', 'Queue', 'Simulation']
1,824
Minimum Sideway Jumps
minimum-sideway-jumps
<p>There is a <strong>3 lane road</strong> of length <code>n</code> that consists of <code>n + 1</code> <strong>points</strong> labeled from <code>0</code> to <code>n</code>. A frog <strong>starts</strong> at point <code>0</code> in the <strong>second </strong>lane<strong> </strong>and wants to jump to point <code>n</c...
Medium
50.5K
99.8K
50,504
99,836
50.6%
['frog-jump']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minSideJumps(vector<int>& obstacles) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minSideJumps(int[] obstacles) {\n \n }\n}"}, {"value": "python", "text": "Python...
[0,1,2,3,0]
{ "name": "minSideJumps", "params": [ { "name": "obstacles", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Greedy']
1,825
Finding MK Average
finding-mk-average
<p>You are given two integers, <code>m</code> and <code>k</code>, and a stream of integers. You are tasked to implement a data structure that calculates the <strong>MKAverage</strong> for the stream.</p> <p>The <strong>MKAverage</strong> can be calculated using these steps:</p> <ol> <li>If the number of the elements...
Hard
24.8K
65.2K
24,785
65,152
38.0%
['find-median-from-data-stream', 'kth-largest-element-in-a-stream', 'sequentially-ordinal-rank-tracker']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class MKAverage {\npublic:\n MKAverage(int m, int k) {\n \n }\n \n void addElement(int num) {\n \n }\n \n int calculateMKAverage() {\n \n }\n};\n\n/**\n * Your MKAverage object will be instantiated and called as such:\n * MKAv...
["MKAverage","addElement","addElement","calculateMKAverage","addElement","calculateMKAverage","addElement","addElement","addElement","calculateMKAverage"] [[3,1],[3],[1],[],[10],[],[5],[5],[5],[]]
{ "classname": "MKAverage", "constructor": { "params": [ { "name": "m", "type": "integer" }, { "name": "k", "type": "integer" } ] }, "methods": [ { "params": [ { "type": "integer", "name": "num" } ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Design', 'Queue', 'Heap (Priority Queue)', 'Data Stream', 'Ordered Set']
1,826
Faulty Sensor
faulty-sensor
null
Easy
6.4K
12.7K
6,412
12,741
50.3%
[]
[]
Algorithms
null
[2,3,4,5] [2,1,3,4]
{ "name": "badSensor", "params": [ { "name": "sensor1", "type": "integer[]" }, { "type": "integer[]", "name": "sensor2" } ], "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']
1,827
Minimum Operations to Make the Array Increasing
minimum-operations-to-make-the-array-increasing
<p>You are given an integer array <code>nums</code> (<strong>0-indexed</strong>). In one operation, you can choose an element of the array and increment it by <code>1</code>.</p> <ul> <li>For example, if <code>nums = [1,2,3]</code>, you can choose to increment <code>nums[1]</code> to make <code>nums = [1,<u><b>3</b><...
Easy
115K
142.2K
115,009
142,207
80.9%
['minimum-increment-to-make-array-unique', 'make-array-non-decreasing-or-non-increasing', 'maximum-product-after-k-increments', 'minimum-replacements-to-sort-the-array', 'minimum-operations-to-make-columns-strictly-increasing']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[1,1,1]
{ "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', 'Greedy']
1,828
Queries on Number of Points Inside a Circle
queries-on-number-of-points-inside-a-circle
<p>You are given an array <code>points</code> where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> is the coordinates of the <code>i<sup>th</sup></code> point on a 2D plane. Multiple points can have the <strong>same</strong> coordinates.</p> <p>You are also given an array <code>queries</code> where <code>quer...
Medium
85.6K
99.2K
85,585
99,158
86.3%
['count-lattice-points-inside-a-circle', 'count-number-of-rectangles-containing-each-point', 'check-if-the-rectangle-corner-is-reachable']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> countPoints(vector<vector<int>>& points, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] countPoints(int[][] points, int[][] queries) {...
[[1,3],[3,3],[5,3],[2,2]] [[2,3,1],[4,3,1],[1,1,2]]
{ "name": "countPoints", "params": [ { "name": "points", "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', 'Math', 'Geometry']
1,829
Maximum XOR for Each Query
maximum-xor-for-each-query
<p>You are given a <strong>sorted</strong> array <code>nums</code> of <code>n</code> non-negative integers and an integer <code>maximumBit</code>. You want to perform the following query <code>n</code> <strong>times</strong>:</p> <ol> <li>Find a non-negative integer <code>k &lt; 2<sup>maximumBit</sup></code> such tha...
Medium
138.5K
163.3K
138,511
163,322
84.8%
['count-the-number-of-beautiful-subarrays']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getMaximumXor(vector<int>& nums, int maximumBit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getMaximumXor(int[] nums, int maximumBit) {\n \n }\n}"}, {...
[0,1,1,3] 2
{ "name": "getMaximumXor", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "maximumBit" } ], "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', 'Prefix Sum']
1,830
Minimum Number of Operations to Make String Sorted
minimum-number-of-operations-to-make-string-sorted
<p>You are given a string <code>s</code> (<strong>0-indexed</strong>)​​​​​​. You are asked to perform the following operation on <code>s</code>​​​​​​ until you get a sorted string:</p> <ol> <li>Find <strong>the largest index</strong> <code>i</code> such that <code>1 &lt;= i &lt; s.length</code> and <code>s[i] &lt; s[...
Hard
4.7K
9.5K
4,715
9,469
49.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int makeStringSorted(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int makeStringSorted(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo...
"cba"
{ "name": "makeStringSorted", "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...
['Math', 'String', 'Combinatorics']
1,831
Maximum Transaction Each Day
maximum-transaction-each-day
null
Medium
24.1K
29.3K
24,147
29,299
82.4%
[]
['Create table If Not Exists Transactions (transaction_id int, day date, amount int)', 'Truncate table Transactions', "insert into Transactions (transaction_id, day, amount) values ('8', '2021-4-3 15:57:28', '57')", "insert into Transactions (transaction_id, day, amount) values ('9', '2021-4-28 08:47:25', '21')", "inse...
Database
null
{"headers": {"Transactions": ["transaction_id", "day", "amount"]}, "rows": {"Transactions": [[8, "2021-4-3 15:57:28", 57], [9, "2021-4-28 08:47:25", 21], [1, "2021-4-29 13:28:30", 58], [5, "2021-4-28 16:39:59", 40], [6, "2021-4-29 23:39:28", 58]]}}
{"mysql": ["Create table If Not Exists Transactions (transaction_id int, day date, amount int)"], "mssql": ["Create table Transactions (transaction_id int, day datetime, amount int)"], "oraclesql": ["Create table Transactions (transaction_id int, day date, amount int)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD HH...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,832
Check if the Sentence Is Pangram
check-if-the-sentence-is-pangram
<p>A <strong>pangram</strong> is a sentence where every letter of the English alphabet appears at least once.</p> <p>Given a string <code>sentence</code> containing only lowercase English letters, return<em> </em><code>true</code><em> if </em><code>sentence</code><em> is a <strong>pangram</strong>, or </em><code>false...
Easy
426.1K
508.8K
426,093
508,807
83.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkIfPangram(string sentence) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkIfPangram(String sentence) {\n \n }\n}"}, {"value": "python", "text": "Pyth...
"thequickbrownfoxjumpsoverthelazydog"
{ "name": "checkIfPangram", "params": [ { "name": "sentence", "type": "string" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String']
1,833
Maximum Ice Cream Bars
maximum-ice-cream-bars
<p>It is a sweltering summer day, and a boy wants to buy some ice cream bars.</p> <p>At the store, there are <code>n</code> ice cream bars. You are given an array <code>costs</code> of length <code>n</code>, where <code>costs[i]</code> is the price of the <code>i<sup>th</sup></code> ice cream bar in coins. The boy ini...
Medium
172.4K
233.5K
172,369
233,452
73.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxIceCream(vector<int>& costs, int coins) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxIceCream(int[] costs, int coins) {\n \n }\n}"}, {"value": "python", "te...
[1,3,2,4,1] 7
{ "name": "maxIceCream", "params": [ { "name": "costs", "type": "integer[]" }, { "type": "integer", "name": "coins" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting', 'Counting Sort']
1,834
Single-Threaded CPU
single-threaded-cpu
<p>You are given <code>n</code>​​​​​​ tasks labeled from <code>0</code> to <code>n - 1</code> represented by a 2D integer array <code>tasks</code>, where <code>tasks[i] = [enqueueTime<sub>i</sub>, processingTime<sub>i</sub>]</code> means that the <code>i<sup>​​​​​​th</sup></code>​​​​ task will be available to process a...
Medium
124.8K
270.4K
124,834
270,390
46.2%
['parallel-courses-iii', 'minimum-time-to-complete-all-tasks']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getOrder(vector<vector<int>>& tasks) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getOrder(int[][] tasks) {\n \n }\n}"}, {"value": "python", "text": "Py...
[[1,2],[2,4],[3,2],[4,1]]
{ "name": "getOrder", "params": [ { "name": "tasks", "type": "integer[][]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting', 'Heap (Priority Queue)']
1,835
Find XOR Sum of All Pairs Bitwise AND
find-xor-sum-of-all-pairs-bitwise-and
<p>The <strong>XOR sum</strong> of a list is the bitwise <code>XOR</code> of all its elements. If the list only contains one element, then its <strong>XOR sum</strong> will be equal to this element.</p> <ul> <li>For example, the <strong>XOR sum</strong> of <code>[1,2,3,4]</code> is equal to <code>1 XOR 2 XOR 3 XOR 4 ...
Hard
22.8K
37.2K
22,839
37,201
61.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getXORSum(vector<int>& arr1, vector<int>& arr2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getXORSum(int[] arr1, int[] arr2) {\n \n }\n}"}, {"value": "python", ...
[1,2,3] [6,5]
{ "name": "getXORSum", "params": [ { "name": "arr1", "type": "integer[]" }, { "type": "integer[]", "name": "arr2" } ], "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']
1,836
Remove Duplicates From an Unsorted Linked List
remove-duplicates-from-an-unsorted-linked-list
null
Medium
37.7K
50.1K
37,684
50,090
75.2%
['remove-duplicates-from-sorted-list-ii', 'remove-duplicates-from-sorted-list']
[]
Algorithms
null
[1,2,3,2]
{ "name": "deleteDuplicatesUnsorted", "params": [ { "name": "head", "type": "ListNode" } ], "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...
['Hash Table', 'Linked List']
1,837
Sum of Digits in Base K
sum-of-digits-in-base-k
<p>Given an integer <code>n</code> (in base <code>10</code>) and a base <code>k</code>, return <em>the <strong>sum</strong> of the digits of </em><code>n</code><em> <strong>after</strong> converting </em><code>n</code><em> from base </em><code>10</code><em> to base </em><code>k</code>.</p> <p>After converting, each di...
Easy
65.9K
84.6K
65,891
84,611
77.9%
['count-symmetric-integers']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumBase(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumBase(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "clas...
34 6
{ "name": "sumBase", "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...
['Math']
1,838
Frequency of the Most Frequent Element
frequency-of-the-most-frequent-element
<p>The <strong>frequency</strong> of an element is the number of times it occurs in an array.</p> <p>You are given an integer array <code>nums</code> and an integer <code>k</code>. In one operation, you can choose an index of <code>nums</code> and increment the element at that index by <code>1</code>.</p> <p>Return <...
Medium
197K
447.7K
197,021
447,720
44.0%
['find-all-lonely-numbers-in-the-array', 'longest-nice-subarray', 'apply-operations-to-maximize-frequency-score', 'maximum-frequency-of-an-element-after-performing-operations-i', 'maximum-frequency-of-an-element-after-performing-operations-ii', 'maximum-difference-between-even-and-odd-frequency-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxFrequency(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxFrequency(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Py...
[1,2,4] 5
{ "name": "maxFrequency", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Greedy', 'Sliding Window', 'Sorting', 'Prefix Sum']
1,839
Longest Substring Of All Vowels in Order
longest-substring-of-all-vowels-in-order
<p>A string is considered <strong>beautiful</strong> if it satisfies the following conditions:</p> <ul> <li>Each of the 5 English vowels (<code>&#39;a&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;i&#39;</code>, <code>&#39;o&#39;</code>, <code>&#39;u&#39;</code>) must appear <strong>at least once</strong> in it.<...
Medium
38.3K
76.4K
38,314
76,439
50.1%
['count-vowel-substrings-of-a-string', 'longest-nice-subarray', 'count-of-substrings-containing-every-vowel-and-k-consonants-ii', 'count-of-substrings-containing-every-vowel-and-k-consonants-i']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestBeautifulSubstring(string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestBeautifulSubstring(String word) {\n \n }\n}"}, {"value": "python", "tex...
"aeiaaioaaaaeiiiiouuuooaauuaeiu"
{ "name": "longestBeautifulSubstring", "params": [ { "name": "word", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Sliding Window']
1,840
Maximum Building Height
maximum-building-height
<p>You want to build <code>n</code> new buildings in a city. The new buildings will be built in a line and are labeled from <code>1</code> to <code>n</code>.</p> <p>However, there are city restrictions on the heights of the new buildings:</p> <ul> <li>The height of each building must be a non-negative integer.</li> ...
Hard
8.3K
22.4K
8,334
22,439
37.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxBuilding(int n, vector<vector<int>>& restrictions) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxBuilding(int n, int[][] restrictions) {\n \n }\n}"}, {"value...
5 [[2,1],[4,1]]
{ "name": "maxBuilding", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "restrictions" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Sorting']
1,841
League Statistics
league-statistics
null
Medium
15K
28.1K
14,997
28,070
53.4%
[]
['Create table If Not Exists Teams (team_id int, team_name varchar(20))', 'Create table If Not Exists Matches (home_team_id int, away_team_id int, home_team_goals int, away_team_goals int)', 'Truncate table Teams', "insert into Teams (team_id, team_name) values ('1', 'Ajax')", "insert into Teams (team_id, team_name) va...
Database
null
{"headers":{"Teams":["team_id","team_name"],"Matches":["home_team_id","away_team_id","home_team_goals","away_team_goals"]},"rows":{"Teams":[[1,"Ajax"],[4,"Dortmund"],[6,"Arsenal"]],"Matches":[[1,4,0,1],[1,6,3,3],[4,1,5,2],[6,1,0,0]]}}
{"mysql": ["Create table If Not Exists Teams (team_id int, team_name varchar(20))", "Create table If Not Exists Matches (home_team_id int, away_team_id int, home_team_goals int, away_team_goals int)"], "mssql": ["Create table Teams (team_id int, team_name varchar(20))", "Create table Matches (home_team_id int, away_tea...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,842
Next Palindrome Using Same Digits
next-palindrome-using-same-digits
null
Hard
6.3K
11.7K
6,293
11,728
53.7%
['next-greater-element-iii', 'find-the-closest-palindrome']
[]
Algorithms
null
"1221"
{ "name": "nextPalindrome", "params": [ { "name": "num", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Two Pointers', 'String']
1,843
Suspicious Bank Accounts
suspicious-bank-accounts
null
Medium
13.2K
29.3K
13,210
29,346
45.0%
[]
['Create table If Not Exists Accounts (account_id int, max_income int)', "Create table If Not Exists Transactions (transaction_id int, account_id int, type ENUM('creditor', 'debtor'), amount int, day datetime)", 'Truncate table Accounts', "insert into Accounts (account_id, max_income) values ('3', '21000')", "insert in...
Database
null
{"headers": {"Accounts": ["account_id", "max_income"], "Transactions": ["transaction_id", "account_id", "type", "amount", "day"]}, "rows": {"Accounts": [[3, 21000], [4, 10400]], "Transactions": [[2, 3, "Creditor", 107100, "2021-06-02 11:38:14"], [4, 4, "Creditor", 10400, "2021-06-20 12:39:18"], [11, 4, "Debtor", 58800,...
{"mysql": ["Create table If Not Exists Accounts (account_id int, max_income int)", "Create table If Not Exists Transactions (transaction_id int, account_id int, type ENUM('creditor', 'debtor'), amount int, day datetime)"], "mssql": ["Create table Accounts (account_id int, max_income int)", "Create table Transactions (t...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,844
Replace All Digits with Characters
replace-all-digits-with-characters
<p>You are given a <strong>0-indexed</strong> string <code>s</code> that has lowercase English letters in its <strong>even</strong> indices and digits in its <strong>odd</strong> indices.</p> <p>You must perform an operation <code>shift(c, x)</code>, where <code>c</code> is a character and <code>x</code> is a digit, t...
Easy
100.5K
122.7K
100,533
122,663
82.0%
['shifting-letters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string replaceDigits(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String replaceDigits(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo...
"a1c1e1"
{ "name": "replaceDigits", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
1,845
Seat Reservation Manager
seat-reservation-manager
<p>Design a system that manages the reservation state of <code>n</code> seats that are numbered from <code>1</code> to <code>n</code>.</p> <p>Implement the <code>SeatManager</code> class:</p> <ul> <li><code>SeatManager(int n)</code> Initializes a <code>SeatManager</code> object that will manage <code>n</code> seats ...
Medium
137.1K
195.4K
137,130
195,426
70.2%
['design-phone-directory', 'design-a-number-container-system']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class SeatManager {\npublic:\n SeatManager(int n) {\n \n }\n \n int reserve() {\n \n }\n \n void unreserve(int seatNumber) {\n \n }\n};\n\n/**\n * Your SeatManager object will be instantiated and called as such:\n * SeatManage...
["SeatManager","reserve","reserve","unreserve","reserve","reserve","reserve","reserve","unreserve"] [[5],[],[],[2],[],[],[],[],[5]]
{ "classname": "SeatManager", "constructor": { "params": [ { "type": "integer", "name": "n" } ] }, "methods": [ { "params": [], "name": "reserve", "return": { "type": "integer" } }, { "params": [ { "type": "i...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Design', 'Heap (Priority Queue)']
1,846
Maximum Element After Decreasing and Rearranging
maximum-element-after-decreasing-and-rearranging
<p>You are given an array of positive integers <code>arr</code>. Perform some operations (possibly none) on <code>arr</code> so that it satisfies these conditions:</p> <ul> <li>The value of the <strong>first</strong> element in <code>arr</code> must be <code>1</code>.</li> <li>The absolute difference between any 2 a...
Medium
109.4K
166.4K
109,368
166,420
65.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumElementAfterDecrementingAndRearranging(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumElementAfterDecrementingAndRearranging(int[] arr) {\n ...
[2,2,1,2,1]
{ "name": "maximumElementAfterDecrementingAndRearranging", "params": [ { "name": "arr", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting']
1,847
Closest Room
closest-room
<p>There is a hotel with <code>n</code> rooms. The rooms are represented by a 2D integer array <code>rooms</code> where <code>rooms[i] = [roomId<sub>i</sub>, size<sub>i</sub>]</code> denotes that there is a room with room number <code>roomId<sub>i</sub></code> and size equal to <code>size<sub>i</sub></code>. Each <code...
Hard
10.8K
27.5K
10,825
27,508
39.4%
['most-beautiful-item-for-each-query', 'minimum-time-to-kill-all-monsters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> closestRoom(vector<vector<int>>& rooms, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] closestRoom(int[][] rooms, int[][] queries) {\n...
[[2,2],[1,2],[3,2]] [[3,1],[3,3],[5,2]]
{ "name": "closestRoom", "params": [ { "name": "rooms", "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', 'Binary Search', 'Sorting', 'Ordered Set']
1,848
Minimum Distance to the Target Element
minimum-distance-to-the-target-element
<p>Given an integer array <code>nums</code> <strong>(0-indexed)</strong> and two integers <code>target</code> and <code>start</code>, find an index <code>i</code> such that <code>nums[i] == target</code> and <code>abs(i - start)</code> is <strong>minimized</strong>. Note that&nbsp;<code>abs(x)</code>&nbsp;is the absolu...
Easy
52.8K
97.3K
52,836
97,334
54.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getMinDistance(vector<int>& nums, int target, int start) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getMinDistance(int[] nums, int target, int start) {\n \n }\n...
[1,2,3,4,5] 5 3
{ "name": "getMinDistance", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "target" }, { "type": "integer", "name": "start" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array']
1,849
Splitting a String Into Descending Consecutive Values
splitting-a-string-into-descending-consecutive-values
<p>You are given a string <code>s</code> that consists of only digits.</p> <p>Check if we can split <code>s</code> into <strong>two or more non-empty substrings</strong> such that the <strong>numerical values</strong> of the substrings are in <strong>descending order</strong> and the <strong>difference</strong> betwee...
Medium
30.6K
83.6K
30,643
83,559
36.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool splitString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean splitString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ...
"1234"
{ "name": "splitString", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Backtracking']
1,850
Minimum Adjacent Swaps to Reach the Kth Smallest Number
minimum-adjacent-swaps-to-reach-the-kth-smallest-number
<p>You are given a string <code>num</code>, representing a large integer, and an integer <code>k</code>.</p> <p>We call some integer <strong>wonderful</strong> if it is a <strong>permutation</strong> of the digits in <code>num</code> and is <strong>greater in value</strong> than <code>num</code>. There can be many won...
Medium
24.5K
34.5K
24,508
34,479
71.1%
['next-permutation']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getMinSwaps(string num, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getMinSwaps(String num, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
"5489355142" 4
{ "name": "getMinSwaps", "params": [ { "name": "num", "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...
['Two Pointers', 'String', 'Greedy']
1,851
Minimum Interval to Include Each Query
minimum-interval-to-include-each-query
<p>You are given a 2D integer array <code>intervals</code>, where <code>intervals[i] = [left<sub>i</sub>, right<sub>i</sub>]</code> describes the <code>i<sup>th</sup></code> interval starting at <code>left<sub>i</sub></code> and ending at <code>right<sub>i</sub></code> <strong>(inclusive)</strong>. The <strong>size</st...
Hard
50K
96.4K
49,978
96,353
51.9%
['number-of-flowers-in-full-bloom']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> minInterval(vector<vector<int>>& intervals, vector<int>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] minInterval(int[][] intervals, int[] queries) {\n ...
[[1,4],[2,4],[3,6],[4,4]] [2,3,4,5]
{ "name": "minInterval", "params": [ { "name": "intervals", "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', 'Binary Search', 'Line Sweep', 'Sorting', 'Heap (Priority Queue)']
1,852
Distinct Numbers in Each Subarray
distinct-numbers-in-each-subarray
null
Medium
15.6K
20.3K
15,633
20,325
76.9%
[]
[]
Algorithms
null
[1,2,3,2,2,1,3] 3
{ "name": "distinctNumbers", "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', 'Sliding Window']
1,853
Convert Date Format
convert-date-format
null
Easy
14.5K
17K
14,548
16,998
85.6%
[]
['Create table If Not Exists Days (day date)', 'Truncate table Days', "insert into Days (day) values ('2022-04-12')", "insert into Days (day) values ('2021-08-09')", "insert into Days (day) values ('2020-06-26')"]
Database
null
{"headers":{"Days":["day"]},"rows":{"Days":[["2022-04-12"],["2021-08-09"],["2020-06-26"]]}}
{"mysql": ["Create table If Not Exists Days (day date)"], "mssql": ["Create table Days (day date)"], "oraclesql": ["Create table Days (day date)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD'"], "database": true, "name": "convert_date_format", "pythondata": ["Days = pd.DataFrame([], columns=['day']).astype({'day':'d...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,854
Maximum Population Year
maximum-population-year
<p>You are given a 2D integer array <code>logs</code> where each <code>logs[i] = [birth<sub>i</sub>, death<sub>i</sub>]</code> indicates the birth and death years of the <code>i<sup>th</sup></code> person.</p> <p>The <strong>population</strong> of some year <code>x</code> is the number of people alive during that year...
Easy
91.2K
146.2K
91,152
146,164
62.4%
['shifting-letters-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumPopulation(vector<vector<int>>& logs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumPopulation(int[][] logs) {\n \n }\n}"}, {"value": "python", "text...
[[1993,1999],[2000,2010]]
{ "name": "maximumPopulation", "params": [ { "name": "logs", "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', 'Counting', 'Prefix Sum']
1,855
Maximum Distance Between a Pair of Values
maximum-distance-between-a-pair-of-values
<p>You are given two <strong>non-increasing 0-indexed </strong>integer arrays <code>nums1</code>​​​​​​ and <code>nums2</code>​​​​​​.</p> <p>A pair of indices <code>(i, j)</code>, where <code>0 &lt;= i &lt; nums1.length</code> and <code>0 &lt;= j &lt; nums2.length</code>, is <strong>valid</strong> if both <code>i &lt;=...
Medium
55.2K
103K
55,199
102,991
53.6%
['two-furthest-houses-with-different-colors']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxDistance(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxDistance(int[] nums1, int[] nums2) {\n \n }\n}"}, {"value": "p...
[55,30,5,4,2] [100,20,10,10,5]
{ "name": "maxDistance", "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', 'Two Pointers', 'Binary Search']
1,856
Maximum Subarray Min-Product
maximum-subarray-min-product
<p>The <strong>min-product</strong> of an array is equal to the <strong>minimum value</strong> in the array <strong>multiplied by</strong> the array&#39;s <strong>sum</strong>.</p> <ul> <li>For example, the array <code>[3,2,5]</code> (minimum value is <code>2</code>) has a min-product of <code>2 * (3+2+5) = 2 * 10 = ...
Medium
33K
85.2K
32,987
85,176
38.7%
['subarray-with-elements-greater-than-varying-threshold']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSumMinProduct(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSumMinProduct(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",...
[1,2,3,2]
{ "name": "maxSumMinProduct", "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', 'Stack', 'Monotonic Stack', 'Prefix Sum']
1,857
Largest Color Value in a Directed Graph
largest-color-value-in-a-directed-graph
<p>There is a <strong>directed graph</strong> of <code>n</code> colored nodes and <code>m</code> edges. The nodes are numbered from <code>0</code> to <code>n - 1</code>.</p> <p>You are given a string <code>colors</code> where <code>colors[i]</code> is a lowercase English letter representing the <strong>color</strong> ...
Hard
73.2K
148K
73,193
148,031
49.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\r\npublic:\r\n int largestPathValue(string colors, vector<vector<int>>& edges) {\r\n \r\n }\r\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\r\n public int largestPathValue(String colors, int[][] edges) {\r\n ...
"abaca" [[0,1],[0,2],[2,3],[3,4]]
{ "name": "largestPathValue", "params": [ { "name": "colors", "type": "string" }, { "type": "integer[][]", "name": "edges" } ], "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', 'Dynamic Programming', 'Graph', 'Topological Sort', 'Memoization', 'Counting']
1,858
Longest Word With All Prefixes
longest-word-with-all-prefixes
null
Medium
13.3K
18.7K
13,314
18,654
71.4%
['longest-word-in-dictionary']
[]
Algorithms
null
["k","ki","kir","kira","kiran"]
{ "name": "longestWord", "params": [ { "name": "words", "type": "string[]" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Depth-First Search', 'Trie']
1,859
Sorting the Sentence
sorting-the-sentence
<p>A <strong>sentence</strong> is a list of words that are separated by a single space with no leading or trailing spaces. Each word consists of lowercase and uppercase English letters.</p> <p>A sentence can be <strong>shuffled</strong> by appending the <strong>1-indexed word position</strong> to each word then rearra...
Easy
199.5K
238.5K
199,528
238,492
83.7%
['check-if-numbers-are-ascending-in-a-sentence']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string sortSentence(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String sortSentence(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode...
"is2 sentence4 This1 a3"
{ "name": "sortSentence", "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', 'Sorting']
1,860
Incremental Memory Leak
incremental-memory-leak
<p>You are given two integers <code>memory1</code> and <code>memory2</code> representing the available memory in bits on two memory sticks. There is currently a faulty program running that consumes an increasing amount of memory every second.</p> <p>At the <code>i<sup>th</sup></code> second (starting from 1), <code>i<...
Medium
23.2K
32K
23,190
32,022
72.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> memLeak(int memory1, int memory2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] memLeak(int memory1, int memory2) {\n \n }\n}"}, {"value": "python", "tex...
2 2
{ "name": "memLeak", "params": [ { "name": "memory1", "type": "integer" }, { "type": "integer", "name": "memory2" } ], "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', 'Simulation']
1,861
Rotating the Box
rotating-the-box
<p>You are given an <code>m x n</code> matrix of characters <code>boxGrid</code> representing a side-view of a box. Each cell of the box is one of the following:</p> <ul> <li>A stone <code>&#39;#&#39;</code></li> <li>A stationary obstacle <code>&#39;*&#39;</code></li> <li>Empty <code>&#39;.&#39;</code></li> </ul> ...
Medium
149.3K
189K
149,346
188,993
79.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<char>> rotateTheBox(vector<vector<char>>& boxGrid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public char[][] rotateTheBox(char[][] boxGrid) {\n \n }\n}"}, {"val...
[["#",".","#"]]
{ "name": "rotateTheBox", "params": [ { "name": "boxGrid", "type": "character[][]" } ], "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...
['Array', 'Two Pointers', 'Matrix']
1,862
Sum of Floored Pairs
sum-of-floored-pairs
<p>Given an integer array <code>nums</code>, return the sum of <code>floor(nums[i] / nums[j])</code> for all pairs of indices <code>0 &lt;= i, j &lt; nums.length</code> in the array. Since the answer may be too large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p> <p>The <code>floor()</code> fu...
Hard
10.6K
35.9K
10,564
35,900
29.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumOfFlooredPairs(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumOfFlooredPairs(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python...
[2,5,9]
{ "name": "sumOfFlooredPairs", "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', 'Binary Search', 'Prefix Sum']
1,863
Sum of All Subset XOR Totals
sum-of-all-subset-xor-totals
<p>The <strong>XOR total</strong> of an array is defined as the bitwise <code>XOR</code> of<strong> all its elements</strong>, or <code>0</code> if the array is<strong> empty</strong>.</p> <ul> <li>For example, the <strong>XOR total</strong> of the array <code>[2,5,6]</code> is <code>2 XOR 5 XOR 6 = 1</code>.</li> </...
Easy
308.5K
342.6K
308,516
342,564
90.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int subsetXORSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int subsetXORSum(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[1,3]
{ "name": "subsetXORSum", "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', 'Backtracking', 'Bit Manipulation', 'Combinatorics', 'Enumeration']
1,864
Minimum Number of Swaps to Make the Binary String Alternating
minimum-number-of-swaps-to-make-the-binary-string-alternating
<p>Given a binary string <code>s</code>, return <em>the <strong>minimum</strong> number of character swaps to make it <strong>alternating</strong>, or </em><code>-1</code><em> if it is impossible.</em></p> <p>The string is called <strong>alternating</strong> if no two adjacent characters are equal. For example, the st...
Medium
31.2K
72K
31,178
71,999
43.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minSwaps(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minSwaps(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solu...
"111000"
{ "name": "minSwaps", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Greedy']
1,865
Finding Pairs With a Certain Sum
finding-pairs-with-a-certain-sum
<p>You are given two integer arrays <code>nums1</code> and <code>nums2</code>. You are tasked to implement a data structure that supports queries of two types:</p> <ol> <li><strong>Add</strong> a positive integer to an element of a given index in the array <code>nums2</code>.</li> <li><strong>Count</strong> the numb...
Medium
31.1K
60K
31,069
60,036
51.8%
['count-number-of-pairs-with-absolute-difference-k', 'number-of-distinct-averages', 'count-the-number-of-fair-pairs']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class FindSumPairs {\npublic:\n FindSumPairs(vector<int>& nums1, vector<int>& nums2) {\n \n }\n \n void add(int index, int val) {\n \n }\n \n int count(int tot) {\n \n }\n};\n\n/**\n * Your FindSumPairs object will be instanti...
["FindSumPairs","count","add","count","count","add","add","count"] [[[1,1,2,2,2,3],[1,4,5,2,5,4]],[7],[3,2],[8],[4],[0,1],[1,1],[7]]
{ "classname": "FindSumPairs", "constructor": { "params": [ { "type": "integer[]", "name": "nums1" }, { "name": "nums2", "type": "integer[]" } ] }, "methods": [ { "params": [ { "type": "integer", "name": "index...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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']
1,866
Number of Ways to Rearrange Sticks With K Sticks Visible
number-of-ways-to-rearrange-sticks-with-k-sticks-visible
<p>There are <code>n</code> uniquely-sized sticks whose lengths are integers from <code>1</code> to <code>n</code>. You want to arrange the sticks such that <strong>exactly</strong> <code>k</code>&nbsp;sticks are <strong>visible</strong> from the left. A stick&nbsp;is <strong>visible</strong> from the left if there are...
Hard
16.9K
29.3K
16,863
29,303
57.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int rearrangeSticks(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int rearrangeSticks(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
3 2
{ "name": "rearrangeSticks", "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...
['Math', 'Dynamic Programming', 'Combinatorics']
1,867
Orders With Maximum Quantity Above Average
orders-with-maximum-quantity-above-average
null
Medium
17.9K
25.3K
17,929
25,320
70.8%
[]
['Create table If Not Exists OrdersDetails (order_id int, product_id int, quantity int)', 'Truncate table OrdersDetails', "insert into OrdersDetails (order_id, product_id, quantity) values ('1', '1', '12')", "insert into OrdersDetails (order_id, product_id, quantity) values ('1', '2', '10')", "insert into OrdersDetails...
Database
null
{"headers": {"OrdersDetails": ["order_id", "product_id", "quantity"]}, "rows": {"OrdersDetails": [[1 ,1, 12], [1 ,2, 10], [1 ,3, 15], [2 ,1, 8], [2 ,4, 4], [2 ,5, 6], [3 , 3, 5], [3 ,4, 18], [4 ,5, 2], [4 ,6, 8], [5 ,7, 9], [5 ,8, 9], [3 ,9, 20], [2 ,9, 4]]}}
{"mysql": ["Create table If Not Exists OrdersDetails (order_id int, product_id int, quantity int)"], "mssql": ["Create table OrdersDetails (order_id int, product_id int, quantity int)"], "oraclesql": ["Create table OrdersDetails (order_id int, product_id int, quantity int)"], "database": true, "name": "orders_above_ave...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,868
Product of Two Run-Length Encoded Arrays
product-of-two-run-length-encoded-arrays
null
Medium
57.2K
96.6K
57,193
96,585
59.2%
[]
[]
Algorithms
null
[[1,3],[2,3]] [[6,3],[3,3]]
{ "name": "findRLEArray", "params": [ { "name": "encoded1", "type": "integer[][]" }, { "type": "integer[][]", "name": "encoded2" } ], "return": { "type": "list<list<integer>>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Two Pointers']
1,869
Longer Contiguous Segments of Ones than Zeros
longer-contiguous-segments-of-ones-than-zeros
<p>Given a binary string <code>s</code>, return <code>true</code><em> if the <strong>longest</strong> contiguous segment of </em><code>1</code>&#39;<em>s is <strong>strictly longer</strong> than the <strong>longest</strong> contiguous segment of </em><code>0</code>&#39;<em>s in </em><code>s</code>, or return <code>fals...
Easy
55K
89.4K
54,971
89,380
61.5%
['max-consecutive-ones', 'count-subarrays-with-more-ones-than-zeros', 'check-if-binary-string-has-at-most-one-segment-of-ones']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkZeroOnes(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkZeroOnes(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
"1101"
{ "name": "checkZeroOnes", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
1,870
Minimum Speed to Arrive on Time
minimum-speed-to-arrive-on-time
<p>You are given a floating-point number <code>hour</code>, representing the amount of time you have to reach the office. To commute to the office, you must take <code>n</code> trains in sequential order. You are also given an integer array <code>dist</code> of length <code>n</code>, where <code>dist[i]</code> describe...
Medium
111.5K
236.5K
111,472
236,532
47.1%
['maximum-candies-allocated-to-k-children', 'minimum-skips-to-arrive-at-meeting-on-time', 'minimum-time-to-complete-trips', 'the-latest-time-to-catch-a-bus', 'minimize-maximum-of-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minSpeedOnTime(vector<int>& dist, double hour) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minSpeedOnTime(int[] dist, double hour) {\n \n }\n}"}, {"value": "pyth...
[1,3,2] 6
{ "name": "minSpeedOnTime", "params": [ { "name": "dist", "type": "integer[]" }, { "type": "double", "name": "hour" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search']
1,871
Jump Game VII
jump-game-vii
<p>You are given a <strong>0-indexed</strong> binary string <code>s</code> and two integers <code>minJump</code> and <code>maxJump</code>. In the beginning, you are standing at index <code>0</code>, which is equal to <code>&#39;0&#39;</code>. You can move from index <code>i</code> to index <code>j</code> if the followi...
Medium
55.4K
217.9K
55,355
217,920
25.4%
['jump-game-ii', 'jump-game', 'jump-game-iii', 'jump-game-iv', 'jump-game-v', 'jump-game-vi', 'jump-game-vii', 'jump-game-viii', 'count-vowel-strings-in-ranges', 'maximum-number-of-jumps-to-reach-the-last-index']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canReach(string s, int minJump, int maxJump) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canReach(String s, int minJump, int maxJump) {\n \n }\n}"}, {"value...
"011010" 2 3
{ "name": "canReach", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "minJump" }, { "type": "integer", "name": "maxJump" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming', 'Sliding Window', 'Prefix Sum']
1,872
Stone Game VIII
stone-game-viii
<p>Alice and Bob take turns playing a game, with <strong>Alice starting first</strong>.</p> <p>There are <code>n</code> stones arranged in a row. On each player&#39;s turn, while the number of stones is <strong>more than one</strong>, they will do the following:</p> <ol> <li>Choose an integer <code>x &gt; 1</code>, ...
Hard
11.1K
21.1K
11,125
21,070
52.8%
['stone-game', 'stone-game-ii', 'stone-game-iii', 'stone-game-iv', 'stone-game-v', 'stone-game-vi', 'stone-game-vii', 'stone-game-viii', 'stone-game-ix']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int stoneGameVIII(vector<int>& stones) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int stoneGameVIII(int[] stones) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[-1,2,-3,4,-5]
{ "name": "stoneGameVIII", "params": [ { "name": "stones", "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', 'Prefix Sum', 'Game Theory']
1,873
Calculate Special Bonus
calculate-special-bonus
<p>Table: <code>Employees</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | employee_id | int | | name | varchar | | salary | int | +-------------+---------+ employee_id is the primary key (column with unique values) for this table. Each row of this ta...
Easy
282.7K
492.9K
282,688
492,904
57.4%
[]
['Create table If Not Exists Employees (employee_id int, name varchar(30), salary int)', 'Truncate table Employees', "insert into Employees (employee_id, name, salary) values ('2', 'Meir', '3000')", "insert into Employees (employee_id, name, salary) values ('3', 'Michael', '3800')", "insert into Employees (employee_id,...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers":{"Employees":["employee_id","name","salary"]},"rows":{"Employees":[[2,"Meir",3000],[3,"Michael",3800],[7,"Addilyn",7400],[8,"Juan",6100],[9,"Kannon",7700]]}}
{"mysql": ["Create table If Not Exists Employees (employee_id int, name varchar(30), salary int)"], "mssql": ["Create table Employees (employee_id int, name varchar(30), salary int)"], "oraclesql": ["Create table Employees (employee_id int, name varchar(30), salary int)"], "database": true, "name": "calculate_special_b...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,874
Minimize Product Sum of Two Arrays
minimize-product-sum-of-two-arrays
null
Medium
21.2K
23.8K
21,230
23,848
89.0%
['choose-numbers-from-two-arrays-in-range']
[]
Algorithms
null
[5,3,4,2] [4,2,2,5]
{ "name": "minProductSum", "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', 'Greedy', 'Sorting']
1,875
Group Employees of the Same Salary
group-employees-of-the-same-salary
null
Medium
13.7K
20.5K
13,672
20,524
66.6%
[]
['Create table If Not Exists Employees (employee_id int, name varchar(30), salary int)', 'Truncate table Employees', "insert into Employees (employee_id, name, salary) values ('2', 'Meir', '3000')", "insert into Employees (employee_id, name, salary) values ('3', 'Michael', '3000')", "insert into Employees (employee_id,...
Database
null
{"headers":{"Employees":["employee_id","name","salary"]},"rows":{"Employees":[[2,"Meir",3000],[3,"Michael",3000],[7,"Addilyn",7400],[8,"Juan",6100],[9,"Kannon",7400]]}}
{"mysql": ["Create table If Not Exists Employees (employee_id int, name varchar(30), salary int)"], "mssql": ["Create table Employees (employee_id int, name varchar(30), salary int)"], "oraclesql": ["Create table Employees (employee_id int, name varchar(30), salary int)"], "database": true, "name": "employees_of_same_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']
1,876
Substrings of Size Three with Distinct Characters
substrings-of-size-three-with-distinct-characters
<p>A string is <strong>good</strong> if there are no repeated characters.</p> <p>Given a string <code>s</code>​​​​​, return <em>the number of <strong>good substrings</strong> of length <strong>three </strong>in </em><code>s</code>​​​​​​.</p> <p>Note that if there are multiple occurrences of the same substring, every ...
Easy
158.3K
210.7K
158,268
210,689
75.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countGoodSubstrings(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countGoodSubstrings(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
"xyzzaz"
{ "name": "countGoodSubstrings", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Sliding Window', 'Counting']
1,877
Minimize Maximum Pair Sum in Array
minimize-maximum-pair-sum-in-array
<p>The <strong>pair sum</strong> of a pair <code>(a,b)</code> is equal to <code>a + b</code>. The <strong>maximum pair sum</strong> is the largest <strong>pair sum</strong> in a list of pairs.</p> <ul> <li>For example, if we have pairs <code>(1,5)</code>, <code>(2,3)</code>, and <code>(4,4)</code>, the <strong>maximu...
Medium
194.1K
238.3K
194,067
238,335
81.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minPairSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minPairSum(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[3,5,2,3]
{ "name": "minPairSum", "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', 'Greedy', 'Sorting']
1,878
Get Biggest Three Rhombus Sums in a Grid
get-biggest-three-rhombus-sums-in-a-grid
<p>You are given an <code>m x n</code> integer matrix <code>grid</code>​​​.</p> <p>A <strong>rhombus sum</strong> is the sum of the elements that form <strong>the</strong> <strong>border</strong> of a regular rhombus shape in <code>grid</code>​​​. The rhombus must have the shape of a square rotated 45 degrees with eac...
Medium
18.4K
37.6K
18,384
37,562
48.9%
['count-fertile-pyramids-in-a-land']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getBiggestThree(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getBiggestThree(int[][] grid) {\n \n }\n}"}, {"value": "python",...
[[3,4,5,1,3],[3,3,4,2,3],[20,30,200,40,10],[1,5,5,4,1],[4,3,2,2,5]]
{ "name": "getBiggestThree", "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', 'Math', 'Sorting', 'Heap (Priority Queue)', 'Matrix', 'Prefix Sum']
1,879
Minimum XOR Sum of Two Arrays
minimum-xor-sum-of-two-arrays
<p>You are given two integer arrays <code>nums1</code> and <code>nums2</code> of length <code>n</code>.</p> <p>The <strong>XOR sum</strong> of the two integer arrays is <code>(nums1[0] XOR nums2[0]) + (nums1[1] XOR nums2[1]) + ... + (nums1[n - 1] XOR nums2[n - 1])</code> (<strong>0-indexed</strong>).</p> <ul> <li>Fo...
Hard
16.8K
34.5K
16,800
34,503
48.7%
['fair-distribution-of-cookies', 'choose-numbers-from-two-arrays-in-range', 'maximum-and-sum-of-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumXORSum(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumXORSum(int[] nums1, int[] nums2) {\n \n }\n}"}, {"value"...
[1,2] [2,3]
{ "name": "minimumXORSum", "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', 'Bit Manipulation', 'Bitmask']
1,880
Check if Word Equals Summation of Two Words
check-if-word-equals-summation-of-two-words
<p>The <strong>letter value</strong> of a letter is its position in the alphabet <strong>starting from 0</strong> (i.e. <code>&#39;a&#39; -&gt; 0</code>, <code>&#39;b&#39; -&gt; 1</code>, <code>&#39;c&#39; -&gt; 2</code>, etc.).</p> <p>The <strong>numerical value</strong> of some string of lowercase English letters <c...
Easy
75K
100.5K
74,989
100,526
74.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isSumEqual(string firstWord, string secondWord, string targetWord) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isSumEqual(String firstWord, String secondWord, String ...
"acb" "cba" "cdb"
{ "name": "isSumEqual", "params": [ { "name": "firstWord", "type": "string" }, { "type": "string", "name": "secondWord" }, { "type": "string", "name": "targetWord" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
1,881
Maximum Value after Insertion
maximum-value-after-insertion
<p>You are given a very large integer <code>n</code>, represented as a string,​​​​​​ and an integer digit <code>x</code>. The digits in <code>n</code> and the digit <code>x</code> are in the <strong>inclusive</strong> range <code>[1, 9]</code>, and <code>n</code> may represent a <b>negative</b> number.</p> <p>You want...
Medium
30.7K
80K
30,711
79,994
38.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string maxValue(string n, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String maxValue(String n, int x) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau...
"99" 9
{ "name": "maxValue", "params": [ { "name": "n", "type": "string" }, { "type": "integer", "name": "x" } ], "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']
1,882
Process Tasks Using Servers
process-tasks-using-servers
<p>You are given two <strong>0-indexed</strong> integer arrays <code>servers</code> and <code>tasks</code> of lengths <code>n</code>​​​​​​ and <code>m</code>​​​​​​ respectively. <code>servers[i]</code> is the <strong>weight</strong> of the <code>i<sup>​​​​​​th</sup></code>​​​​ server, and <code>tasks[j]</code> is the <...
Medium
39.2K
96.1K
39,241
96,112
40.8%
['parallel-courses-iii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> assignTasks(vector<int>& servers, vector<int>& tasks) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] assignTasks(int[] servers, int[] tasks) {\n \n }\n}"}...
[3,3,2] [1,2,3,2,1,2]
{ "name": "assignTasks", "params": [ { "name": "servers", "type": "integer[]" }, { "type": "integer[]", "name": "tasks" } ], "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)']
1,883
Minimum Skips to Arrive at Meeting On Time
minimum-skips-to-arrive-at-meeting-on-time
<p>You are given an integer <code>hoursBefore</code>, the number of hours you have to travel to your meeting. To arrive at your meeting, you have to travel through <code>n</code> roads. The road lengths are given as an integer array <code>dist</code> of length <code>n</code>, where <code>dist[i]</code> describes the le...
Hard
7.8K
20.4K
7,779
20,411
38.1%
['minimum-speed-to-arrive-on-time', 'minimum-time-to-finish-the-race']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minSkips(vector<int>& dist, int speed, int hoursBefore) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minSkips(int[] dist, int speed, int hoursBefore) {\n \n }\n}"...
[1,3,2] 4 2
{ "name": "minSkips", "params": [ { "name": "dist", "type": "integer[]" }, { "type": "integer", "name": "speed" }, { "type": "integer", "name": "hoursBefore" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
1,884
Egg Drop With 2 Eggs and N Floors
egg-drop-with-2-eggs-and-n-floors
<p>You are given <strong>two identical</strong> eggs and you have access to a building with <code>n</code> floors labeled from <code>1</code> to <code>n</code>.</p> <p>You know that there exists a floor <code>f</code> where <code>0 &lt;= f &lt;= n</code> such that any egg dropped at a floor <strong>higher</strong> tha...
Medium
55.6K
75.6K
55,571
75,587
73.5%
['super-egg-drop']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int twoEggDrop(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int twoEggDrop(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Soluti...
2
{ "name": "twoEggDrop", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Dynamic Programming']
1,885
Count Pairs in Two Arrays
count-pairs-in-two-arrays
null
Medium
11.3K
18.9K
11,350
18,889
60.1%
['max-value-of-equation', 'substrings-that-begin-and-end-with-the-same-letter']
[]
Algorithms
null
[2,1,2,1] [1,2,1,2]
{ "name": "countPairs", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" } ], "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', 'Two Pointers', 'Binary Search', 'Sorting']
1,886
Determine Whether Matrix Can Be Obtained By Rotation
determine-whether-matrix-can-be-obtained-by-rotation
<p>Given two <code>n x n</code> binary matrices <code>mat</code> and <code>target</code>, return <code>true</code><em> if it is possible to make </em><code>mat</code><em> equal to </em><code>target</code><em> by <strong>rotating</strong> </em><code>mat</code><em> in <strong>90-degree increments</strong>, or </em><code>...
Easy
82.7K
142.9K
82,674
142,941
57.8%
['rotate-image']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool findRotation(vector<vector<int>>& mat, vector<vector<int>>& target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean findRotation(int[][] mat, int[][] target) {\n \...
[[0,1],[1,0]] [[1,0],[0,1]]
{ "name": "findRotation", "params": [ { "name": "mat", "type": "integer[][]" }, { "type": "integer[][]", "name": "target" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Matrix']
1,887
Reduction Operations to Make the Array Elements Equal
reduction-operations-to-make-the-array-elements-equal
<p>Given an integer array <code>nums</code>, your goal is to make all elements in <code>nums</code> equal. To complete one operation, follow these steps:</p> <ol> <li>Find the <strong>largest</strong> value in <code>nums</code>. Let its index be <code>i</code> (<strong>0-indexed</strong>) and its value be <code>large...
Medium
98.8K
136.6K
98,771
136,614
72.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int reductionOperations(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int reductionOperations(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Py...
[5,1,3]
{ "name": "reductionOperations", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting']
1,888
Minimum Number of Flips to Make the Binary String Alternating
minimum-number-of-flips-to-make-the-binary-string-alternating
<p>You are given a binary string <code>s</code>. You are allowed to perform two types of operations on the string in any sequence:</p> <ul> <li><strong>Type-1: Remove</strong> the character at the start of the string <code>s</code> and <strong>append</strong> it to the end of the string.</li> <li><strong>Type-2: Pic...
Medium
32.6K
80.7K
32,579
80,739
40.4%
['minimum-operations-to-make-the-array-alternating']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minFlips(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minFlips(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solu...
"111000"
{ "name": "minFlips", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming', 'Greedy', 'Sliding Window']
1,889
Minimum Space Wasted From Packaging
minimum-space-wasted-from-packaging
<p>You have <code>n</code> packages that you are trying to place in boxes, <strong>one package in each box</strong>. There are <code>m</code> suppliers that each produce boxes of <strong>different sizes</strong> (with infinite supply). A package can be placed in a box if the size of the package is <strong>less than or ...
Hard
15K
46.2K
14,976
46,235
32.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minWastedSpace(vector<int>& packages, vector<vector<int>>& boxes) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minWastedSpace(int[] packages, int[][] boxes) {\n \n ...
[2,3,5] [[4,8],[2,8]]
{ "name": "minWastedSpace", "params": [ { "name": "packages", "type": "integer[]" }, { "type": "integer[][]", "name": "boxes" } ], "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', 'Prefix Sum']
1,890
The Latest Login in 2020
the-latest-login-in-2020
<p>Table: <code>Logins</code></p> <pre> +----------------+----------+ | Column Name | Type | +----------------+----------+ | user_id | int | | time_stamp | datetime | +----------------+----------+ (user_id, time_stamp) is the primary key (combination of columns with unique values) for this table...
Easy
109.5K
141.5K
109,500
141,526
77.4%
[]
['Create table If Not Exists Logins (user_id int, time_stamp datetime)', 'Truncate table Logins', "insert into Logins (user_id, time_stamp) values ('6', '2020-06-30 15:06:07')", "insert into Logins (user_id, time_stamp) values ('6', '2021-04-21 14:06:06')", "insert into Logins (user_id, time_stamp) values ('6', '2019-0...
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": {"Logins": ["user_id", "time_stamp"]}, "rows": {"Logins": [[6, "2020-06-30 15:06:07"], [6, "2021-04-21 14:06:06"], [6, "2019-03-07 00:18:15"], [8, "2020-02-01 05:10:53"], [8, "2020-12-30 00:46:50"], [2, "2020-01-16 02:49:50"], [2, "2019-08-25 07:59:08"], [14, "2019-07-14 09:00:00"], [14, "2021-01-06 11:59:5...
{"mysql": ["Create table If Not Exists Logins (user_id int, time_stamp datetime)"], "mssql": ["Create table Logins (user_id int, time_stamp datetime)"], "oraclesql": ["Create table Logins (user_id int, time_stamp date)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'"], "database": true, "name": "latest_log...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,891
Cutting Ribbons
cutting-ribbons
null
Medium
79.2K
152.3K
79,247
152,289
52.0%
['capacity-to-ship-packages-within-d-days', 'add-minimum-number-of-rungs']
[]
Algorithms
null
[9,7,5] 3
{ "name": "maxLength", "params": [ { "name": "ribbons", "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']
1,892
Page Recommendations II
page-recommendations-ii
null
Hard
8.8K
19.8K
8,784
19,774
44.4%
['page-recommendations', 'strong-friendship']
['Create table If Not Exists Friendship (user1_id int, user2_id int)', 'Create table If Not Exists Likes (user_id int, page_id int)', 'Truncate table Friendship', "insert into Friendship (user1_id, user2_id) values ('1', '2')", "insert into Friendship (user1_id, user2_id) values ('1', '3')", "insert into Friendship (us...
Database
null
{"headers":{"Friendship":["user1_id","user2_id"],"Likes":["user_id","page_id"]},"rows":{"Friendship":[[1,2],[1,3],[1,4],[2,3],[2,4],[2,5],[6,1]],"Likes":[[1,88],[2,23],[3,24],[4,56],[5,11],[6,33],[2,77],[3,77],[6,88]]}}
{"mysql": ["Create table If Not Exists Friendship (user1_id int, user2_id int)", "Create table If Not Exists Likes (user_id int, page_id int)"], "mssql": ["Create table Friendship (user1_id int, user2_id int)", "Create table Likes (user_id int, page_id int)"], "oraclesql": ["Create table Friendship (user1_id int, user2...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,893
Check if All the Integers in a Range Are Covered
check-if-all-the-integers-in-a-range-are-covered
<p>You are given a 2D integer array <code>ranges</code> and two integers <code>left</code> and <code>right</code>. Each <code>ranges[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> represents an <strong>inclusive</strong> interval between <code>start<sub>i</sub></code> and <code>end<sub>i</sub></code>.</p> <p>Return ...
Easy
55.5K
110.4K
55,477
110,407
50.2%
['find-maximal-uncovered-ranges']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isCovered(vector<vector<int>>& ranges, int left, int right) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isCovered(int[][] ranges, int left, int right) {\n \n ...
[[1,2],[3,4],[5,6]] 2 5
{ "name": "isCovered", "params": [ { "name": "ranges", "type": "integer[][]" }, { "type": "integer", "name": "left" }, { "type": "integer", "name": "right" } ], "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', 'Prefix Sum']
1,894
Find the Student that Will Replace the Chalk
find-the-student-that-will-replace-the-chalk
<p>There are <code>n</code> students in a class numbered from <code>0</code> to <code>n - 1</code>. The teacher will give each student a problem starting with the student number <code>0</code>, then the student number <code>1</code>, and so on until the teacher reaches the student number <code>n - 1</code>. After that,...
Medium
197.5K
371.5K
197,522
371,498
53.2%
['pass-the-pillow']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int chalkReplacer(vector<int>& chalk, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int chalkReplacer(int[] chalk, int k) {\n \n }\n}"}, {"value": "python", "text":...
[5,1,5] 22
{ "name": "chalkReplacer", "params": [ { "name": "chalk", "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', 'Simulation', 'Prefix Sum']
1,895
Largest Magic Square
largest-magic-square
<p>A <code>k x k</code> <strong>magic square</strong> is a <code>k x k</code> grid filled with integers such that every row sum, every column sum, and both diagonal sums are <strong>all equal</strong>. The integers in the magic square <strong>do not have to be distinct</strong>. Every <code>1 x 1</code> grid is trivial...
Medium
13.2K
25.3K
13,228
25,291
52.3%
['magic-squares-in-grid']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largestMagicSquare(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largestMagicSquare(int[][] grid) {\n \n }\n}"}, {"value": "python", "te...
[[7,1,4,5,6],[2,5,1,6,4],[1,5,4,3,2],[1,2,7,3,4]]
{ "name": "largestMagicSquare", "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', 'Matrix', 'Prefix Sum']
1,896
Minimum Cost to Change the Final Value of Expression
minimum-cost-to-change-the-final-value-of-expression
<p>You are given a <strong>valid</strong> boolean expression as a string <code>expression</code> consisting of the characters <code>&#39;1&#39;</code>,<code>&#39;0&#39;</code>,<code>&#39;&amp;&#39;</code> (bitwise <strong>AND</strong> operator),<code>&#39;|&#39;</code> (bitwise <strong>OR</strong> operator),<code>&#39;...
Hard
4.6K
9.2K
4,646
9,182
50.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperationsToFlip(string expression) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperationsToFlip(String expression) {\n \n }\n}"}, {"value": "python", "tex...
"1&(0|1)"
{ "name": "minOperationsToFlip", "params": [ { "name": "expression", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'String', 'Dynamic Programming', 'Stack']
1,897
Redistribute Characters to Make All Strings Equal
redistribute-characters-to-make-all-strings-equal
<p>You are given an array of strings <code>words</code> (<strong>0-indexed</strong>).</p> <p>In one operation, pick two <strong>distinct</strong> indices <code>i</code> and <code>j</code>, where <code>words[i]</code> is a non-empty string, and move <strong>any</strong> character from <code>words[i]</code> to <strong>a...
Easy
149.5K
223.8K
149,478
223,841
66.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool makeEqual(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean makeEqual(String[] words) {\n \n }\n}"}, {"value": "python", "text": "Python", ...
["abc","aabc","bc"]
{ "name": "makeEqual", "params": [ { "name": "words", "type": "string[]" } ], "return": { "type": "boolean" }, "manual": false }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Counting']
1,898
Maximum Number of Removable Characters
maximum-number-of-removable-characters
<p>You are given two strings <code>s</code> and <code>p</code> where <code>p</code> is a <strong>subsequence </strong>of <code>s</code>. You are also given a <strong>distinct 0-indexed </strong>integer array <code>removable</code> containing a subset of indices of <code>s</code> (<code>s</code> is also <strong>0-indexe...
Medium
36.7K
80.9K
36,738
80,914
45.4%
['maximum-candies-allocated-to-k-children']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumRemovals(string s, string p, vector<int>& removable) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumRemovals(String s, String p, int[] removable) {\n \n ...
"abcacb" "ab" [3,1,0]
{ "name": "maximumRemovals", "params": [ { "name": "s", "type": "string" }, { "type": "string", "name": "p" }, { "type": "integer[]", "name": "removable" } ], "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', 'String', 'Binary Search']
1,899
Merge Triplets to Form Target Triplet
merge-triplets-to-form-target-triplet
<p>A <strong>triplet</strong> is an array of three integers. You are given a 2D integer array <code>triplets</code>, where <code>triplets[i] = [a<sub>i</sub>, b<sub>i</sub>, c<sub>i</sub>]</code> describes the <code>i<sup>th</sup></code> <strong>triplet</strong>. You are also given an integer array <code>target = [x, y...
Medium
85.9K
127.6K
85,865
127,624
67.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool mergeTriplets(vector<vector<int>>& triplets, vector<int>& target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean mergeTriplets(int[][] triplets, int[] target) {\n ...
[[2,5,3],[1,8,4],[1,7,5]] [2,7,5]
{ "name": "mergeTriplets", "params": [ { "name": "triplets", "type": "integer[][]" }, { "type": "integer[]", "name": "target" } ], "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', 'Greedy']
1,900
The Earliest and Latest Rounds Where Players Compete
the-earliest-and-latest-rounds-where-players-compete
<p>There is a tournament where <code>n</code> players are participating. The players are standing in a single row and are numbered from <code>1</code> to <code>n</code> based on their <strong>initial</strong> standing position (player <code>1</code> is the first player in the row, player <code>2</code> is the second pl...
Hard
6.1K
12.7K
6,072
12,694
47.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> earliestAndLatest(int n, int firstPlayer, int secondPlayer) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] earliestAndLatest(int n, int firstPlayer, int secondPlaye...
11 2 4
{ "name": "earliestAndLatest", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "firstPlayer" }, { "type": "integer", "name": "secondPlayer" } ], "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', 'Memoization']
1,901
Find a Peak Element II
find-a-peak-element-ii
<p>A <strong>peak</strong> element in a 2D grid is an element that is <strong>strictly greater</strong> than all of its <strong>adjacent </strong>neighbors to the left, right, top, and bottom.</p> <p>Given a <strong>0-indexed</strong> <code>m x n</code> matrix <code>mat</code> where <strong>no two adjacent cells are e...
Medium
112.1K
211.9K
112,062
211,930
52.9%
['find-peak-element', 'find-the-peaks']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findPeakGrid(vector<vector<int>>& mat) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findPeakGrid(int[][] mat) {\n \n }\n}"}, {"value": "python", "text":...
[[1,4],[3,2]]
{ "name": "findPeakGrid", "params": [ { "name": "mat", "type": "integer[][]" } ], "return": { "type": "integer[]" }, "manual": false }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Matrix']