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,401
Circle and Rectangle Overlapping
circle-and-rectangle-overlapping
<p>You are given a circle represented as <code>(radius, xCenter, yCenter)</code> and an axis-aligned rectangle represented as <code>(x1, y1, x2, y2)</code>, where <code>(x1, y1)</code> are the coordinates of the bottom-left corner, and <code>(x2, y2)</code> are the coordinates of the top-right corner of the rectangle.<...
Medium
21.4K
44K
21,395
43,993
48.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkOverlap(int radius, int xCenter, int yCenter, int x1, int y1, int x2, int y2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkOverlap(int radius, int xCenter, i...
1 0 0 1 -1 3 1
{ "name": "checkOverlap", "params": [ { "name": "radius", "type": "integer" }, { "type": "integer", "name": "xCenter" }, { "type": "integer", "name": "yCenter" }, { "type": "integer", "name": "x1" }, { "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', 'Geometry']
1,402
Reducing Dishes
reducing-dishes
<p>A chef has collected data on the <code>satisfaction</code> level of his <code>n</code> dishes. Chef can cook any dish in 1 unit of time.</p> <p><strong>Like-time coefficient</strong> of a dish is defined as the time taken to cook that dish including previous dishes multiplied by its satisfaction level i.e. <code>ti...
Hard
164.9K
216.2K
164,904
216,188
76.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSatisfaction(vector<int>& satisfaction) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSatisfaction(int[] satisfaction) {\n \n }\n}"}, {"value": "python", "te...
[-1,-8,0,5,-7]
{ "name": "maxSatisfaction", "params": [ { "name": "satisfaction", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Greedy', 'Sorting']
1,403
Minimum Subsequence in Non-Increasing Order
minimum-subsequence-in-non-increasing-order
<p>Given the array <code>nums</code>, obtain a subsequence of the array whose sum of elements is <strong>strictly greater</strong> than the sum of the non&nbsp;included elements in such subsequence.&nbsp;</p> <p>If there are multiple solutions, return the subsequence with <strong>minimum size</strong> and if there sti...
Easy
81.3K
111.7K
81,287
111,653
72.8%
['count-hills-and-valleys-in-an-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> minSubsequence(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> minSubsequence(int[] nums) {\n \n }\n}"}, {"value": "python", "te...
[4,3,10,9,8]
{ "name": "minSubsequence", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "list<integer>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting']
1,404
Number of Steps to Reduce a Number in Binary Representation to One
number-of-steps-to-reduce-a-number-in-binary-representation-to-one
<p>Given the binary representation of an integer as a string <code>s</code>, return <em>the number of steps to reduce it to </em><code>1</code><em> under the following rules</em>:</p> <ul> <li> <p>If the current number is even, you have to divide it by <code>2</code>.</p> </li> <li> <p>If the current number is od...
Medium
152.1K
247.8K
152,132
247,825
61.4%
['minimum-moves-to-reach-target-score']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numSteps(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numSteps(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solu...
"1101"
{ "name": "numSteps", "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', 'Bit Manipulation']
1,405
Longest Happy String
longest-happy-string
<p>A string <code>s</code> is called <strong>happy</strong> if it satisfies the following conditions:</p> <ul> <li><code>s</code> only contains the letters <code>&#39;a&#39;</code>, <code>&#39;b&#39;</code>, and <code>&#39;c&#39;</code>.</li> <li><code>s</code> does not contain any of <code>&quot;aaa&quot;</code>, <...
Medium
198.3K
302.9K
198,260
302,860
65.5%
['reorganize-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string longestDiverseString(int a, int b, int c) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String longestDiverseString(int a, int b, int c) {\n \n }\n}"}, {"value": "p...
1 1 7
{ "name": "longestDiverseString", "params": [ { "name": "a", "type": "integer" }, { "type": "integer", "name": "b" }, { "type": "integer", "name": "c" } ], "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', 'Heap (Priority Queue)']
1,406
Stone Game III
stone-game-iii
<p>Alice and Bob continue their games with piles of stones. There are several stones <strong>arranged in a row</strong>, and each stone has an associated value which is an integer given in the array <code>stoneValue</code>.</p> <p>Alice and Bob take turns, with Alice starting first. On each player&#39;s turn, that pla...
Hard
99.1K
156.8K
99,119
156,783
63.2%
['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 string stoneGameIII(vector<int>& stoneValue) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String stoneGameIII(int[] stoneValue) {\n \n }\n}"}, {"value": "python", "text":...
[1,2,3,7]
{ "name": "stoneGameIII", "params": [ { "name": "stoneValue", "type": "integer[]" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Dynamic Programming', 'Game Theory']
1,407
Top Travellers
top-travellers
<p>Table: <code>Users</code></p> <pre> +---------------+---------+ | Column Name | Type | +---------------+---------+ | id | int | | name | varchar | +---------------+---------+ id is the column with unique values for this table. name is the name of the user. </pre> <p>&nbsp;</p> <p>Tabl...
Easy
159.1K
278.5K
159,100
278,458
57.1%
[]
['Create Table If Not Exists Users (id int, name varchar(30))', 'Create Table If Not Exists Rides (id int, user_id int, distance int)', 'Truncate table Users', "insert into Users (id, name) values ('1', 'Alice')", "insert into Users (id, name) values ('2', 'Bob')", "insert into Users (id, name) values ('3', 'Alex')", "...
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":{"Users":["id","name"],"Rides":["id","user_id","distance"]},"rows":{"Users":[[1,"Alice"],[2,"Bob"],[3,"Alex"],[4,"Donald"],[7,"Lee"],[13,"Jonathan"],[19,"Elvis"]],"Rides":[[1,1,120],[2,2,317],[3,3,222],[4,7,100],[5,13,312],[6,19,50],[7,7,120],[8,19,400],[9,7,230]]}}
{"mysql": ["Create Table If Not Exists Users (id int, name varchar(30))", "Create Table If Not Exists Rides (id int, user_id int, distance int)"], "mssql": ["Create Table Users (id int, name varchar(30))", "Create Table Rides (id int, user_id int, distance int)"], "oraclesql": ["Create Table Users (id int, name varchar...
{"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,408
String Matching in an Array
string-matching-in-an-array
<p>Given an array of string <code>words</code>, return all strings in<em> </em><code>words</code><em> </em>that are a <span data-keyword="substring-nonempty">substring</span> of another word. You can return the answer in <strong>any order</strong>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> ...
Easy
263.4K
377.1K
263,442
377,144
69.9%
['substring-xor-queries']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> stringMatching(vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> stringMatching(String[] words) {\n \n }\n}"}, {"value": "py...
["mass","as","hero","superhero"]
{ "name": "stringMatching", "params": [ { "name": "words", "type": "string[]" } ], "return": { "type": "list<string>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'String Matching']
1,409
Queries on a Permutation With Key
queries-on-a-permutation-with-key
<p>Given the array <code>queries</code> of positive integers between <code>1</code> and <code>m</code>, you have to process all <code>queries[i]</code> (from <code>i=0</code> to <code>i=queries.length-1</code>) according to the following rules:</p> <ul> <li>In the beginning, you have the permutation <code>P=[1,2,3,.....
Medium
54.6K
64.6K
54,585
64,625
84.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> processQueries(vector<int>& queries, int m) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] processQueries(int[] queries, int m) {\n \n }\n}"}, {"value": "...
[3,1,2,1] 5
{ "name": "processQueries", "params": [ { "name": "queries", "type": "integer[]" }, { "type": "integer", "name": "m" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Indexed Tree', 'Simulation']
1,410
HTML Entity Parser
html-entity-parser
<p><strong>HTML entity parser</strong> is the parser that takes HTML code as input and replace all the entities of the special characters by the characters itself.</p> <p>The special characters and their entities for HTML are:</p> <ul> <li><strong>Quotation Mark:</strong> the entity is <code>&amp;quot;</code> and sy...
Medium
28.3K
56.3K
28,263
56,261
50.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string entityParser(string text) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String entityParser(String text) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau...
"&amp; is an HTML entity but &ambassador; is not."
{ "name": "entityParser", "params": [ { "name": "text", "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...
['Hash Table', 'String']
1,411
Number of Ways to Paint N × 3 Grid
number-of-ways-to-paint-n-3-grid
<p>You have a <code>grid</code> of size <code>n x 3</code> and you want to paint each cell of the grid with exactly one of the three colors: <strong>Red</strong>, <strong>Yellow,</strong> or <strong>Green</strong> while making sure that no two adjacent cells have the same color (i.e., no two cells that share vertical o...
Hard
37.5K
58.5K
37,516
58,456
64.2%
['painting-a-grid-with-three-different-colors']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numOfWays(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numOfWays(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solution...
1
{ "name": "numOfWays", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Dynamic Programming']
1,412
Find the Quiet Students in All Exams
find-the-quiet-students-in-all-exams
null
Hard
31.5K
53.7K
31,452
53,735
58.5%
[]
['Create table If Not Exists Student (student_id int, student_name varchar(30))', 'Create table If Not Exists Exam (exam_id int, student_id int, score int)', 'Truncate table Student', "insert into Student (student_id, student_name) values ('1', 'Daniel')", "insert into Student (student_id, student_name) values ('2', 'J...
Database
null
{"headers": {"Student": ["student_id", "student_name"], "Exam": ["exam_id", "student_id", "score"]}, "rows": {"Student": [[1, "Daniel"], [2, "Jade"], [3, "Stella"], [4, "Jonathan"], [5, "Will"]], "Exam": [[10, 1, 70], [10, 2, 80], [10, 3, 90], [20, 1, 80], [30, 1, 70], [30, 3, 80], [30, 4, 90], [40, 1, 60], [40, 2, 70]...
{"mysql": ["Create table If Not Exists Student (student_id int, student_name varchar(30))", "Create table If Not Exists Exam (exam_id int, student_id int, score int)"], "mssql": ["Create table Student (student_id int, student_name varchar(30))", "Create table Exam (exam_id int, student_id int, score int)"], "oraclesql"...
{"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,413
Minimum Value to Get Positive Step by Step Sum
minimum-value-to-get-positive-step-by-step-sum
<p>Given an array of integers&nbsp;<code>nums</code>, you start with an initial <strong>positive</strong> value <em>startValue</em><em>.</em></p> <p>In each iteration, you calculate the step by step sum of <em>startValue</em>&nbsp;plus&nbsp;elements in <code>nums</code>&nbsp;(from left to right).</p> <p>Return the mi...
Easy
182.4K
281.3K
182,377
281,309
64.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minStartValue(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minStartValue(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[-3,2,-3,4,2]
{ "name": "minStartValue", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Prefix Sum']
1,414
Find the Minimum Number of Fibonacci Numbers Whose Sum Is K
find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k
<p>Given an integer&nbsp;<code>k</code>, <em>return the minimum number of Fibonacci numbers whose sum is equal to </em><code>k</code>. The same Fibonacci number can be used multiple times.</p> <p>The Fibonacci numbers are defined as:</p> <ul> <li><code>F<sub>1</sub> = 1</code></li> <li><code>F<sub>2</sub> = 1</code...
Medium
47.5K
74K
47,513
73,967
64.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMinFibonacciNumbers(int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMinFibonacciNumbers(int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
7
{ "name": "findMinFibonacciNumbers", "params": [ { "name": "k", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Greedy']
1,415
The k-th Lexicographical String of All Happy Strings of Length n
the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
<p>A <strong>happy string</strong> is a string that:</p> <ul> <li>consists only of letters of the set <code>[&#39;a&#39;, &#39;b&#39;, &#39;c&#39;]</code>.</li> <li><code>s[i] != s[i + 1]</code> for all values of <code>i</code> from <code>1</code> to <code>s.length - 1</code> (string is 1-indexed).</li> </ul> <p>Fo...
Medium
170.2K
200K
170,183
200,042
85.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string getHappyString(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String getHappyString(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", ...
1 3
{ "name": "getHappyString", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "k" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Backtracking']
1,416
Restore The Array
restore-the-array
<p>A program was supposed to print an array of integers. The program forgot to print whitespaces and the array is printed as a string of digits <code>s</code> and all we know is that all integers in the array were in the range <code>[1, k]</code> and there are no leading zeros in the array.</p> <p>Given the string <co...
Hard
63K
134K
62,968
133,997
47.0%
['number-of-ways-to-separate-numbers', 'number-of-beautiful-partitions']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfArrays(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfArrays(String s, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", ...
"1000" 10000
{ "name": "numberOfArrays", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming']
1,417
Reformat The String
reformat-the-string
<p>You are given an alphanumeric string <code>s</code>. (<strong>Alphanumeric string</strong> is a string consisting of lowercase English letters and digits).</p> <p>You have to find a permutation of the string where no letter is followed by another letter and no digit is followed by another digit. That is, no two adj...
Easy
64.9K
124.7K
64,883
124,723
52.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string reformat(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String reformat(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "clas...
"a0b1c2"
{ "name": "reformat", "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,418
Display Table of Food Orders in a Restaurant
display-table-of-food-orders-in-a-restaurant
<p>Given&nbsp;the array <code>orders</code>, which represents the orders that customers have done in a restaurant. More specifically&nbsp;<code>orders[i]=[customerName<sub>i</sub>,tableNumber<sub>i</sub>,foodItem<sub>i</sub>]</code> where <code>customerName<sub>i</sub></code> is the name of the customer, <code>tableNum...
Medium
33.3K
44.1K
33,271
44,065
75.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\r\npublic:\r\n vector<vector<string>> displayTable(vector<vector<string>>& orders) {\r\n \r\n }\r\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\r\n public List<List<String>> displayTable(List<List<String>> orde...
[["David","3","Ceviche"],["Corina","10","Beef Burrito"],["David","3","Fried Chicken"],["Carla","5","Water"],["Carla","5","Ceviche"],["Rous","3","Ceviche"]]
{ "name": "displayTable", "params": [ { "name": "orders", "type": "list<list<string>>" } ], "return": { "type": "list<list<string>>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String', 'Sorting', 'Ordered Set']
1,419
Minimum Number of Frogs Croaking
minimum-number-of-frogs-croaking
<p>You are given the string <code>croakOfFrogs</code>, which represents a combination of the string <code>&quot;croak&quot;</code> from different frogs, that is, multiple frogs can croak at the same time, so multiple <code>&quot;croak&quot;</code> are mixed.</p> <p><em>Return the minimum number of </em>different<em> f...
Medium
57K
112.6K
57,037
112,568
50.7%
['divide-intervals-into-minimum-number-of-groups']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minNumberOfFrogs(string croakOfFrogs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minNumberOfFrogs(String croakOfFrogs) {\n \n }\n}"}, {"value": "python", "text"...
"croakcroak"
{ "name": "minNumberOfFrogs", "params": [ { "name": "croakOfFrogs", "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', 'Counting']
1,420
Build Array Where You Can Find The Maximum Exactly K Comparisons
build-array-where-you-can-find-the-maximum-exactly-k-comparisons
<p>You are given three integers <code>n</code>, <code>m</code> and <code>k</code>. Consider the following algorithm to find the maximum element of an array of positive integers:</p> <img alt="" src="https://assets.leetcode.com/uploads/2020/04/02/e.png" style="width: 424px; height: 372px;" /> <p>You should build the arr...
Hard
67.9K
101.3K
67,856
101,313
67.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numOfArrays(int n, int m, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numOfArrays(int n, int m, int k) {\n \n }\n}"}, {"value": "python", "text": "Python"...
2 3 1
{ "name": "numOfArrays", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "m" }, { "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...
['Dynamic Programming', 'Prefix Sum']
1,421
NPV Queries
npv-queries
null
Easy
29.3K
35.3K
29,280
35,283
83.0%
[]
['Create Table If Not Exists NPV (id int, year int, npv int)', 'Create Table If Not Exists Queries (id int, year int)', 'Truncate table NPV', "insert into NPV (id, year, npv) values ('1', '2018', '100')", "insert into NPV (id, year, npv) values ('7', '2020', '30')", "insert into NPV (id, year, npv) values ('13', '2019'...
Database
null
{"headers":{"NPV":["id","year","npv"],"Queries":["id","year"]},"rows":{"NPV":[[1,2018,100],[7,2020,30],[13,2019,40],[1,2019,113],[2,2008,121],[3,2009,21],[11,2020,99],[7,2019,0]],"Queries":[[1,2019],[2,2008],[3,2009],[7,2018],[7,2019],[7,2020],[13,2019]]}}
{"mysql": ["Create Table If Not Exists NPV (id int, year int, npv int)", "Create Table If Not Exists Queries (id int, year int)"], "mssql": ["Create Table NPV (id int, year int, npv int)", "Create Table Queries (id int, year int)"], "oraclesql": ["Create Table NPV (id int, year int, npv int)", "Create Table Queries (id...
{"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,422
Maximum Score After Splitting a String
maximum-score-after-splitting-a-string
<p>Given a&nbsp;string <code>s</code>&nbsp;of zeros and ones, <em>return the maximum score after splitting the string into two <strong>non-empty</strong> substrings</em> (i.e. <strong>left</strong> substring and <strong>right</strong> substring).</p> <p>The score after splitting a string is the number of <strong>zeros...
Easy
347.4K
533.2K
347,421
533,184
65.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxScore(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxScore(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solu...
"011101"
{ "name": "maxScore", "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', 'Prefix Sum']
1,423
Maximum Points You Can Obtain from Cards
maximum-points-you-can-obtain-from-cards
<p>There are several cards <strong>arranged in a row</strong>, and each card has an associated number of points. The points are given in the integer array <code>cardPoints</code>.</p> <p>In one step, you can take one card from the beginning or from the end of the row. You have to take exactly <code>k</code> cards.</p>...
Medium
370.4K
672.1K
370,426
672,100
55.1%
['maximum-score-from-performing-multiplication-operations', 'removing-minimum-and-maximum-from-array', 'minimum-recolors-to-get-k-consecutive-black-blocks', 'maximum-spending-after-buying-items']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxScore(vector<int>& cardPoints, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxScore(int[] cardPoints, int k) {\n \n }\n}"}, {"value": "python", "text":...
[1,2,3,4,5,6,1] 3
{ "name": "maxScore", "params": [ { "name": "cardPoints", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sliding Window', 'Prefix Sum']
1,424
Diagonal Traverse II
diagonal-traverse-ii
<p>Given a 2D integer array <code>nums</code>, return <em>all elements of </em><code>nums</code><em> in diagonal order as shown in the below images</em>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <img alt="" src="https://assets.leetcode.com/uploads/2020/04/08/sample_1_1784.png" style="width:...
Medium
161.2K
278.8K
161,219
278,810
57.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findDiagonalOrder(vector<vector<int>>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findDiagonalOrder(List<List<Integer>> nums) {\n \n }\n}"}, {"v...
[[1,2,3],[4,5,6],[7,8,9]]
{ "name": "findDiagonalOrder", "params": [ { "name": "nums", "type": "list<list<integer>>" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting', 'Heap (Priority Queue)']
1,425
Constrained Subsequence Sum
constrained-subsequence-sum
<p>Given an integer array <code>nums</code> and an integer <code>k</code>, return the maximum sum of a <strong>non-empty</strong> subsequence of that array such that for every two <strong>consecutive</strong> integers in the subsequence, <code>nums[i]</code> and <code>nums[j]</code>, where <code>i &lt; j</code>, the co...
Hard
84K
149K
84,034
148,990
56.4%
['maximum-element-sum-of-a-complete-subset-of-indices']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int constrainedSubsetSum(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int constrainedSubsetSum(int[] nums, int k) {\n \n }\n}"}, {"value": "pyth...
[10,2,-10,5,20] 2
{ "name": "constrainedSubsetSum", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Queue', 'Sliding Window', 'Heap (Priority Queue)', 'Monotonic Queue']
1,426
Counting Elements
counting-elements
null
Easy
147K
243.4K
147,047
243,436
60.4%
[]
[]
Algorithms
null
[1,2,3]
{ "name": "countElements", "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', 'Hash Table']
1,427
Perform String Shifts
perform-string-shifts
null
Easy
91K
163.1K
91,005
163,090
55.8%
[]
[]
Algorithms
null
"abc" [[0,1],[1,2]]
{ "name": "stringShift", "params": [ { "name": "s", "type": "string" }, { "type": "integer[][]", "name": "shift" } ], "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', 'Math', 'String']
1,428
Leftmost Column with at Least a One
leftmost-column-with-at-least-a-one
null
Medium
191.7K
349.3K
191,749
349,337
54.9%
[]
[]
Algorithms
null
[[0,0],[1,1]]
{ "name": "leftMostColumnWithOne", "params": [ { "name": "mat", "type": "integer[][]" } ], "return": { "type": "integer" }, "manual": true, "typescriptCustomType" : "class BinaryMatrix {\n __mat: number[][];\n __m: number;\n __n: number;\n __guesses: number;\n constru...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Interactive']
1,429
First Unique Number
first-unique-number
null
Medium
96K
174K
95,971
174,007
55.2%
[]
[]
Algorithms
null
["FirstUnique","showFirstUnique","add","showFirstUnique","add","showFirstUnique","add","showFirstUnique"] [[[2,3,5]],[],[5],[],[2],[],[3],[]]
{ "classname": "FirstUnique", "constructor": { "params": [ { "name": "nums", "type": "integer[]" } ] }, "methods": [ { "params": [], "name": "showFirstUnique", "return": { "type": "integer" } }, { "params": [ { ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Design', 'Queue', 'Data Stream']
1,430
Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree
check-if-a-string-is-a-valid-sequence-from-root-to-leaves-path-in-a-binary-tree
null
Medium
45.5K
96.4K
45,529
96,403
47.2%
[]
[]
Algorithms
null
[0,1,0,0,1,0,null,null,1,0,0] [0,1,0,1]
{ "name": "isValidSequence", "params": [ { "type": "TreeNode", "name": "root" }, { "type": "integer[]", "name": "arr" } ], "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...
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
1,431
Kids With the Greatest Number of Candies
kids-with-the-greatest-number-of-candies
<p>There are <code>n</code> kids with candies. You are given an integer array <code>candies</code>, where each <code>candies[i]</code> represents the number of candies the <code>i<sup>th</sup></code> kid has, and an integer <code>extraCandies</code>, denoting the number of extra candies that you have.</p> <p>Return <e...
Easy
1.2M
1.4M
1,247,149
1,416,241
88.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> kidsWithCandies(vector<int>& candies, int extraCandies) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) {\n...
[2,3,5,1,3] 3
{ "name": "kidsWithCandies", "params": [ { "name": "candies", "type": "integer[]" }, { "type": "integer", "name": "extraCandies" } ], "return": { "type": "list<boolean>" }, "manual": false, "languages": [ "cpp", "java", "python", "c", "csharp...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array']
1,432
Max Difference You Can Get From Changing an Integer
max-difference-you-can-get-from-changing-an-integer
<p>You are given an integer <code>num</code>. You will apply the following steps exactly <strong>two</strong> times:</p> <ul> <li>Pick a digit <code>x (0 &lt;= x &lt;= 9)</code>.</li> <li>Pick another digit <code>y (0 &lt;= y &lt;= 9)</code>. The digit <code>y</code> can be equal to <code>x</code>.</li> <li>Replace...
Medium
20.7K
51.3K
20,653
51,318
40.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxDiff(int num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxDiff(int num) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solution...
555
{ "name": "maxDiff", "params": [ { "name": "num", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Greedy']
1,433
Check If a String Can Break Another String
check-if-a-string-can-break-another-string
<p>Given two strings: <code>s1</code> and <code>s2</code> with the same&nbsp;size, check if some&nbsp;permutation of string <code>s1</code> can break&nbsp;some&nbsp;permutation of string <code>s2</code> or vice-versa. In other words <code>s2</code> can break <code>s1</code>&nbsp;or vice-versa.</p> <p>A string <code>x<...
Medium
48.1K
68.6K
48,088
68,573
70.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkIfCanBreak(string s1, string s2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkIfCanBreak(String s1, String s2) {\n \n }\n}"}, {"value": "python", "...
"abc" "xya"
{ "name": "checkIfCanBreak", "params": [ { "name": "s1", "type": "string" }, { "type": "string", "name": "s2" } ], "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', 'Greedy', 'Sorting']
1,434
Number of Ways to Wear Different Hats to Each Other
number-of-ways-to-wear-different-hats-to-each-other
<p>There are <code>n</code> people and <code>40</code> types of hats labeled from <code>1</code> to <code>40</code>.</p> <p>Given a 2D integer array <code>hats</code>, where <code>hats[i]</code> is a list of all hats preferred by the <code>i<sup>th</sup></code> person.</p> <p>Return the number of ways that <code>n</c...
Hard
17.4K
39.3K
17,366
39,312
44.2%
['the-number-of-good-subsets']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberWays(vector<vector<int>>& hats) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberWays(List<List<Integer>> hats) {\n \n }\n}"}, {"value": "python", "text":...
[[3,4],[4,5],[5]]
{ "name": "numberWays", "params": [ { "name": "hats", "type": "list<list<integer>>" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Bit Manipulation', 'Bitmask']
1,435
Create a Session Bar Chart
create-a-session-bar-chart
null
Easy
25.2K
33.5K
25,162
33,546
75.0%
['count-salary-categories']
['Create table If Not Exists Sessions (session_id int, duration int)', 'Truncate table Sessions', "insert into Sessions (session_id, duration) values ('1', '30')", "insert into Sessions (session_id, duration) values ('2', '199')", "insert into Sessions (session_id, duration) values ('3', '299')", "insert into Sessions ...
Database
null
{"headers": {"Sessions": ["session_id", "duration"]}, "rows": {"Sessions": [[1, 30], [2, 199], [3, 299], [4, 580], [5, 1000]]}}
{"mysql": ["Create table If Not Exists Sessions (session_id int, duration int)"], "mssql": ["Create table Sessions (session_id int, duration int)"], "oraclesql": ["Create table Sessions (session_id int, duration int)"], "database": true, "name": "create_bar_chart", "pythondata": ["Sessions = pd.DataFrame([], columns=['...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,436
Destination City
destination-city
<p>You are given the array <code>paths</code>, where <code>paths[i] = [cityA<sub>i</sub>, cityB<sub>i</sub>]</code> means there exists a direct path going from <code>cityA<sub>i</sub></code> to <code>cityB<sub>i</sub></code>. <em>Return the destination city, that is, the city without any path outgoing to another city.<...
Easy
299K
376.4K
299,004
376,434
79.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string destCity(vector<vector<string>>& paths) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String destCity(List<List<String>> paths) {\n \n }\n}"}, {"value": "python", "...
[["London","New York"],["New York","Lima"],["Lima","Sao Paulo"]]
{ "name": "destCity", "params": [ { "name": "paths", "type": "list<list<string>>" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String']
1,437
Check If All 1's Are at Least Length K Places Away
check-if-all-1s-are-at-least-length-k-places-away
<p>Given an binary array <code>nums</code> and an integer <code>k</code>, return <code>true</code><em> if all </em><code>1</code><em>&#39;s are at least </em><code>k</code><em> places away from each other, otherwise return </em><code>false</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <i...
Easy
86.7K
149.4K
86,712
149,441
58.0%
['task-scheduler-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool kLengthApart(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean kLengthApart(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text"...
[1,0,0,0,1,0,0,1] 2
{ "name": "kLengthApart", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array']
1,438
Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
<p>Given an array of integers <code>nums</code> and an integer <code>limit</code>, return the size of the longest <strong>non-empty</strong> subarray such that the absolute difference between any two elements of this subarray is less than or equal to <code>limit</code><em>.</em></p> <p>&nbsp;</p> <p><strong class="exa...
Medium
261.9K
462.5K
261,880
462,497
56.6%
['partition-array-such-that-maximum-difference-is-k', 'count-subarrays-with-fixed-bounds']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestSubarray(vector<int>& nums, int limit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestSubarray(int[] nums, int limit) {\n \n }\n}"}, {"value": "python...
[8,2,4,7] 4
{ "name": "longestSubarray", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "limit" } ], "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', 'Queue', 'Sliding Window', 'Heap (Priority Queue)', 'Ordered Set', 'Monotonic Queue']
1,439
Find the Kth Smallest Sum of a Matrix With Sorted Rows
find-the-kth-smallest-sum-of-a-matrix-with-sorted-rows
<p>You are given an <code>m x n</code> matrix <code>mat</code> that has its rows sorted in non-decreasing order and an integer <code>k</code>.</p> <p>You are allowed to choose <strong>exactly one element</strong> from each row to form an array.</p> <p>Return <em>the </em><code>k<sup>th</sup></code><em> smallest array...
Hard
38.9K
62.9K
38,935
62,930
61.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int kthSmallest(vector<vector<int>>& mat, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int kthSmallest(int[][] mat, int k) {\n \n }\n}"}, {"value": "python", "text...
[[1,3,11],[2,4,6]] 5
{ "name": "kthSmallest", "params": [ { "name": "mat", "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', 'Heap (Priority Queue)', 'Matrix']
1,440
Evaluate Boolean Expression
evaluate-boolean-expression
null
Medium
34.6K
47.8K
34,557
47,820
72.3%
[]
['Create Table If Not Exists Variables (name varchar(3), value int)', "Create Table If Not Exists Expressions (left_operand varchar(3), operator ENUM('>', '<', '='), right_operand varchar(3))", 'Truncate table Variables', "insert into Variables (name, value) values ('x', '66')", "insert into Variables (name, value) val...
Database
null
{"headers":{"Variables":["name","value"],"Expressions":["left_operand","operator","right_operand"]},"rows":{"Variables":[["x",66],["y",77]],"Expressions":[["x",">","y"],["x","<","y"],["x","=","y"],["y",">","x"],["y","<","x"],["x","=","x"]]}}
{"mysql": ["Create Table If Not Exists Variables (name varchar(3), value int)", "Create Table If Not Exists Expressions (left_operand varchar(3), operator ENUM('>', '<', '='), right_operand varchar(3))"], "mssql": ["Create Table Variables (name varchar(3), value int)", "Create Table Expressions (left_operand varchar(3)...
{"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,441
Build an Array With Stack Operations
build-an-array-with-stack-operations
<p>You are given an integer array <code>target</code> and an integer <code>n</code>.</p> <p>You have an empty stack with the two following operations:</p> <ul> <li><strong><code>&quot;Push&quot;</code></strong>: pushes an integer to the top of the stack.</li> <li><strong><code>&quot;Pop&quot;</code></strong>: remov...
Medium
180.1K
224.8K
180,103
224,833
80.1%
['minimum-operations-to-collect-elements']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> buildArray(vector<int>& target, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> buildArray(int[] target, int n) {\n \n }\n}"}, {"value": "...
[1,3] 3
{ "name": "buildArray", "params": [ { "name": "target", "type": "integer[]" }, { "type": "integer", "name": "n" } ], "return": { "type": "list<string>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Stack', 'Simulation']
1,442
Count Triplets That Can Form Two Arrays of Equal XOR
count-triplets-that-can-form-two-arrays-of-equal-xor
<p>Given an array of integers <code>arr</code>.</p> <p>We want to select three indices <code>i</code>, <code>j</code> and <code>k</code> where <code>(0 &lt;= i &lt; j &lt;= k &lt; arr.length)</code>.</p> <p>Let&#39;s define <code>a</code> and <code>b</code> as follows:</p> <ul> <li><code>a = arr[i] ^ arr[i + 1] ^ ....
Medium
132.7K
156.5K
132,731
156,532
84.8%
['find-the-original-array-of-prefix-xor']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countTriplets(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countTriplets(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[2,3,1,6,7]
{ "name": "countTriplets", "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', 'Hash Table', 'Math', 'Bit Manipulation', 'Prefix Sum']
1,443
Minimum Time to Collect All Apples in a Tree
minimum-time-to-collect-all-apples-in-a-tree
<p>Given an undirected tree consisting of <code>n</code> vertices numbered from <code>0</code> to <code>n-1</code>, which has some apples in their vertices. You spend 1 second to walk over one edge of the tree. <em>Return the minimum time in seconds you have to spend to collect all apples in the tree, starting at <stro...
Medium
139.2K
221.6K
139,217
221,633
62.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minTime(int n, vector<vector<int>>& edges, vector<bool>& hasApple) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minTime(int n, int[][] edges, List<Boolean> hasApple) {\n ...
7 [[0,1],[0,2],[1,4],[1,5],[2,3],[2,6]] [false,false,true,false,true,true,false]
{ "name": "minTime", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "edges" }, { "type": "list<boolean>", "name": "hasApple" } ], "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', 'Tree', 'Depth-First Search', 'Breadth-First Search']
1,444
Number of Ways of Cutting a Pizza
number-of-ways-of-cutting-a-pizza
<p>Given a rectangular pizza represented as a <code>rows x cols</code>&nbsp;matrix containing the following characters: <code>&#39;A&#39;</code> (an apple) and <code>&#39;.&#39;</code> (empty cell) and given the integer <code>k</code>. You have to cut the pizza into <code>k</code> pieces using <code>k-1</code> cuts.&nb...
Hard
72.1K
116.9K
72,055
116,916
61.6%
['selling-pieces-of-wood']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int ways(vector<string>& pizza, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int ways(String[] pizza, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
["A..","AAA","..."] 3
{ "name": "ways", "params": [ { "name": "pizza", "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...
['Array', 'Dynamic Programming', 'Memoization', 'Matrix', 'Prefix Sum']
1,445
Apples & Oranges
apples-oranges
null
Medium
60.4K
70.2K
60,382
70,169
86.1%
[]
["Create table If Not Exists Sales (sale_date date, fruit ENUM('apples', 'oranges'), sold_num int)", 'Truncate table Sales', "insert into Sales (sale_date, fruit, sold_num) values ('2020-05-01', 'apples', '10')", "insert into Sales (sale_date, fruit, sold_num) values ('2020-05-01', 'oranges', '8')", "insert into Sales ...
Database
null
{"headers":{"Sales":["sale_date","fruit","sold_num"]},"rows":{"Sales":[["2020-05-01","apples",10],["2020-05-01","oranges",8],["2020-05-02","apples",15],["2020-05-02","oranges",15],["2020-05-03","apples",20],["2020-05-03","oranges",0],["2020-05-04","apples",15],["2020-05-04","oranges",16]]}}
{"mysql": ["Create table If Not Exists Sales (sale_date date, fruit ENUM('apples', 'oranges'), sold_num int)"], "mssql": ["Create Table Sales (sale_date date, fruit varchar(10) NOT NULL CHECK (fruit IN ('apples', 'oranges')), sold_num int)"], "oraclesql": ["Create Table Sales (sale_date date, fruit varchar(10) NOT NULL...
{"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,446
Consecutive Characters
consecutive-characters
<p>The <strong>power</strong> of the string is the maximum length of a non-empty substring that contains only one unique character.</p> <p>Given a string <code>s</code>, return <em>the <strong>power</strong> of</em> <code>s</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>In...
Easy
192.9K
321.1K
192,884
321,096
60.1%
['max-consecutive-ones', 'longest-continuous-increasing-subsequence', 'check-if-an-array-is-consecutive', 'count-number-of-homogenous-substrings', 'longest-substring-of-one-repeating-character', 'minimum-number-of-chairs-in-a-waiting-room']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxPower(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxPower(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solu...
"leetcode"
{ "name": "maxPower", "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']
1,447
Simplified Fractions
simplified-fractions
<p>Given an integer <code>n</code>, return <em>a list of all <strong>simplified</strong> fractions between </em><code>0</code><em> and </em><code>1</code><em> (exclusive) such that the denominator is less-than-or-equal-to </em><code>n</code>. You can return the answer in <strong>any order</strong>.</p> <p>&nbsp;</p> <...
Medium
38.8K
57K
38,780
57,017
68.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> simplifiedFractions(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> simplifiedFractions(int n) {\n \n }\n}"}, {"value": "python", "text": ...
2
{ "name": "simplifiedFractions", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "list<string>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'String', 'Number Theory']
1,448
Count Good Nodes in Binary Tree
count-good-nodes-in-binary-tree
<p>Given a binary tree <code>root</code>, a node <em>X</em> in the tree is named&nbsp;<strong>good</strong> if in the path from root to <em>X</em> there are no nodes with a value <em>greater than</em> X.</p> <p>Return the number of <strong>good</strong> nodes in the binary tree.</p> <p>&nbsp;</p> <p><strong class="ex...
Medium
689K
939.2K
689,002
939,171
73.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[3,1,4,3,null,1,5]
{ "name": "goodNodes", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
1,449
Form Largest Integer With Digits That Add up to Target
form-largest-integer-with-digits-that-add-up-to-target
<p>Given an array of integers <code>cost</code> and an integer <code>target</code>, return <em>the <strong>maximum</strong> integer you can paint under the following rules</em>:</p> <ul> <li>The cost of painting a digit <code>(i + 1)</code> is given by <code>cost[i]</code> (<strong>0-indexed</strong>).</li> <li>The ...
Hard
20.7K
42.8K
20,748
42,775
48.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string largestNumber(vector<int>& cost, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String largestNumber(int[] cost, int target) {\n \n }\n}"}, {"value": "py...
[4,3,2,5,6,7,2,5,5] 9
{ "name": "largestNumber", "params": [ { "name": "cost", "type": "integer[]" }, { "type": "integer", "name": "target" } ], "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', 'Dynamic Programming']
1,450
Number of Students Doing Homework at a Given Time
number-of-students-doing-homework-at-a-given-time
<p>Given two integer arrays <code>startTime</code> and <code>endTime</code> and given an integer <code>queryTime</code>.</p> <p>The <code>ith</code> student started doing their homework at the time <code>startTime[i]</code> and finished it at time <code>endTime[i]</code>.</p> <p>Return <em>the number of students</em>...
Easy
136.6K
180.6K
136,565
180,573
75.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int busyStudent(vector<int>& startTime, vector<int>& endTime, int queryTime) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int busyStudent(int[] startTime, int[] endTime, int queryT...
[1,2,3] [3,2,7] 4
{ "name": "busyStudent", "params": [ { "name": "startTime", "type": "integer[]" }, { "type": "integer[]", "name": "endTime" }, { "type": "integer", "name": "queryTime" } ], "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,451
Rearrange Words in a Sentence
rearrange-words-in-a-sentence
<p>Given a sentence&nbsp;<code>text</code> (A&nbsp;<em>sentence</em>&nbsp;is a string of space-separated words) in the following format:</p> <ul> <li>First letter is in upper case.</li> <li>Each word in <code>text</code> are separated by a single space.</li> </ul> <p>Your task is to rearrange the words in text such...
Medium
57.8K
88.1K
57,815
88,114
65.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string arrangeWords(string text) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String arrangeWords(String text) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau...
"Leetcode is cool"
{ "name": "arrangeWords", "params": [ { "name": "text", "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,452
People Whose List of Favorite Companies Is Not a Subset of Another List
people-whose-list-of-favorite-companies-is-not-a-subset-of-another-list
<p>Given the array <code>favoriteCompanies</code> where <code>favoriteCompanies[i]</code> is the list of favorites companies for the <code>ith</code> person (<strong>indexed from 0</strong>).</p> <p><em>Return the indices of people whose list of favorite companies is not a <strong>subset</strong> of any other list of ...
Medium
30.1K
51K
30,093
50,998
59.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> peopleIndexes(vector<vector<string>>& favoriteCompanies) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> peopleIndexes(List<List<String>> favoriteCompanies) ...
[["leetcode","google","facebook"],["google","microsoft"],["google","facebook"],["google"],["amazon"]]
{ "name": "peopleIndexes", "params": [ { "type": "list<list<string>>", "name": "favoriteCompanies" } ], "return": { "type": "list<integer>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String']
1,453
Maximum Number of Darts Inside of a Circular Dartboard
maximum-number-of-darts-inside-of-a-circular-dartboard
<p>Alice is throwing <code>n</code> darts on a very large wall. You are given an array <code>darts</code> where <code>darts[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> is the position of the <code>i<sup>th</sup></code> dart that Alice threw on the wall.</p> <p>Bob knows the positions of the <code>n</code> darts on the ...
Hard
7.2K
19K
7,166
18,992
37.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numPoints(vector<vector<int>>& darts, int r) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numPoints(int[][] darts, int r) {\n \n }\n}"}, {"value": "python", "text...
[[-2,0],[2,0],[0,2],[0,-2]] 2
{ "name": "numPoints", "params": [ { "name": "darts", "type": "integer[][]" }, { "type": "integer", "name": "r" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Geometry']
1,454
Active Users
active-users
null
Medium
43.3K
118.1K
43,277
118,149
36.6%
[]
['Create table If Not Exists Accounts (id int, name varchar(10))', 'Create table If Not Exists Logins (id int, login_date date)', 'Truncate table Accounts', "insert into Accounts (id, name) values ('1', 'Winston')", "insert into Accounts (id, name) values ('7', 'Jonathan')", 'Truncate table Logins', "insert into Logins...
Database
null
{"headers":{"Accounts":["id","name"],"Logins":["id","login_date"]},"rows":{"Accounts":[[1,"Winston"],[7,"Jonathan"]],"Logins":[[7,"2020-05-30"],[1,"2020-05-30"],[7,"2020-05-31"],[7,"2020-06-01"],[7,"2020-06-02"],[7,"2020-06-02"],[7,"2020-06-03"],[1,"2020-06-07"],[7,"2020-06-10"]]}}
{"mysql": ["Create table If Not Exists Accounts (id int, name varchar(10))", "Create table If Not Exists Logins (id int, login_date date)"], "mssql": ["Create table Accounts (id int, name varchar(10))", "Create table Logins (id int, login_date date)"], "oraclesql": ["Create table Accounts (id int, name varchar(10))", "...
{"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,455
Check If a Word Occurs As a Prefix of Any Word in a Sentence
check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
<p>Given a <code>sentence</code> that consists of some words separated by a <strong>single space</strong>, and a <code>searchWord</code>, check if <code>searchWord</code> is a prefix of any word in <code>sentence</code>.</p> <p>Return <em>the index of the word in </em><code>sentence</code><em> (<strong>1-indexed</stro...
Easy
219K
318.4K
218,951
318,415
68.8%
['counting-words-with-a-given-prefix', 'count-prefixes-of-a-given-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int isPrefixOfWord(string sentence, string searchWord) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int isPrefixOfWord(String sentence, String searchWord) {\n \n }\n}"}, ...
"i love eating burger" "burg"
{ "name": "isPrefixOfWord", "params": [ { "name": "sentence", "type": "string" }, { "type": "string", "name": "searchWord" } ], "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', 'String Matching']
1,456
Maximum Number of Vowels in a Substring of Given Length
maximum-number-of-vowels-in-a-substring-of-given-length
<p>Given a string <code>s</code> and an integer <code>k</code>, return <em>the maximum number of vowel letters in any substring of </em><code>s</code><em> with length </em><code>k</code>.</p> <p><strong>Vowel letters</strong> in English are <code>&#39;a&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;i&#39;</code>, ...
Medium
506.3K
843.3K
506,313
843,287
60.0%
['maximum-white-tiles-covered-by-a-carpet', 'minimum-recolors-to-get-k-consecutive-black-blocks', 'length-of-the-longest-alphabetical-continuous-substring']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxVowels(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxVowels(String s, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo...
"abciiidef" 3
{ "name": "maxVowels", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Sliding Window']
1,457
Pseudo-Palindromic Paths in a Binary Tree
pseudo-palindromic-paths-in-a-binary-tree
<p>Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be <strong>pseudo-palindromic</strong> if at least one permutation of the node values in the path is a palindrome.</p> <p><em>Return the number of <strong>pseudo-palindromic</strong> paths going from the root node to ...
Medium
227.3K
332.7K
227,254
332,663
68.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[2,3,1,3,1,null,1]
{ "name": "pseudoPalindromicPaths ", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Bit Manipulation', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
1,458
Max Dot Product of Two Subsequences
max-dot-product-of-two-subsequences
<p>Given two arrays <code>nums1</code>&nbsp;and <code><font face="monospace">nums2</font></code><font face="monospace">.</font></p> <p>Return the maximum dot product&nbsp;between&nbsp;<strong>non-empty</strong> subsequences of nums1 and nums2 with the same length.</p> <p>A subsequence of a array is a new array which ...
Hard
81.8K
131.3K
81,820
131,300
62.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxDotProduct(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxDotProduct(int[] nums1, int[] nums2) {\n \n }\n}"}, {"value"...
[2,1,-2,5] [3,0,-6]
{ "name": "maxDotProduct", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" } ], "return": { "type": "integer" }, "manual": false }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
1,459
Rectangles Area
rectangles-area
null
Medium
18.8K
27.3K
18,759
27,324
68.7%
[]
['Create table If Not Exists Points (id int, x_value int, y_value int)', 'Truncate table Points', "insert into Points (id, x_value, y_value) values ('1', '2', '7')", "insert into Points (id, x_value, y_value) values ('2', '4', '8')", "insert into Points (id, x_value, y_value) values ('3', '2', '10')"]
Database
null
{"headers":{"Points":["id","x_value","y_value"]},"rows":{"Points":[[1,2,7],[2,4,8],[3,2,10]]}}
{"mysql": ["Create table If Not Exists Points (id int, x_value int, y_value int)"], "mssql": ["Create table Points (id int, x_value int, y_value int)"], "oraclesql": ["Create table Points (id int, x_value int, y_value int)"], "database": true, "name": "rectangles_area", "pythondata": ["Points = pd.DataFrame([], columns...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,460
Make Two Arrays Equal by Reversing Subarrays
make-two-arrays-equal-by-reversing-subarrays
<p>You are given two integer arrays of equal length <code>target</code> and <code>arr</code>. In one step, you can select any <strong>non-empty subarray</strong> of <code>arr</code> and reverse it. You are allowed to make any number of steps.</p> <p>Return <code>true</code> <em>if you can make </em><code>arr</code><em...
Easy
315K
415.5K
314,983
415,485
75.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canBeEqual(vector<int>& target, vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canBeEqual(int[] target, int[] arr) {\n \n }\n}"}, {"value": "...
[1,2,3,4] [2,4,1,3]
{ "name": "canBeEqual", "params": [ { "name": "target", "type": "integer[]" }, { "type": "integer[]", "name": "arr" } ], "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', 'Sorting']
1,461
Check If a String Contains All Binary Codes of Size K
check-if-a-string-contains-all-binary-codes-of-size-k
<p>Given a binary string <code>s</code> and an integer <code>k</code>, return <code>true</code> <em>if every binary code of length</em> <code>k</code> <em>is a substring of</em> <code>s</code>. Otherwise, return <code>false</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Inp...
Medium
131.8K
232.9K
131,759
232,902
56.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool hasAllCodes(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean hasAllCodes(String s, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
"00110110" 2
{ "name": "hasAllCodes", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Bit Manipulation', 'Rolling Hash', 'Hash Function']
1,462
Course Schedule IV
course-schedule-iv
<p>There are a total of <code>numCourses</code> courses you have to take, labeled from <code>0</code> to <code>numCourses - 1</code>. You are given an array <code>prerequisites</code> where <code>prerequisites[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates that you <strong>must</strong> take course <code>a<sub>i<...
Medium
174K
292.3K
174,047
292,268
59.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> checkIfPrerequisite(int numCourses, vector<vector<int>>& prerequisites, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Boolean> checkI...
2 [[1,0]] [[0,1],[1,0]]
{ "name": "checkIfPrerequisite", "params": [ { "name": "numCourses", "type": "integer" }, { "type": "integer[][]", "name": "prerequisites" }, { "type": "integer[][]", "name": "queries" } ], "return": { "type": "list<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...
['Depth-First Search', 'Breadth-First Search', 'Graph', 'Topological Sort']
1,463
Cherry Pickup II
cherry-pickup-ii
<p>You are given a <code>rows x cols</code> matrix <code>grid</code> representing a field of cherries where <code>grid[i][j]</code> represents the number of cherries that you can collect from the <code>(i, j)</code> cell.</p> <p>You have two robots that can collect cherries for you:</p> <ul> <li><strong>Robot #1</st...
Hard
191.1K
265.9K
191,077
265,910
71.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int cherryPickup(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int cherryPickup(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python...
[[3,1,1],[2,5,1],[1,5,5],[2,1,1]]
{ "name": "cherryPickup", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Matrix']
1,464
Maximum Product of Two Elements in an Array
maximum-product-of-two-elements-in-an-array
Given the array of integers <code>nums</code>, you will choose two different indices <code>i</code> and <code>j</code> of that array. <em>Return the maximum value of</em> <code>(nums[i]-1)*(nums[j]-1)</code>. <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> nums = [3,4,5,2...
Easy
428K
514.9K
428,028
514,887
83.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxProduct(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxProduct(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[3,4,5,2]
{ "name": "maxProduct", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting', 'Heap (Priority Queue)']
1,465
Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts
maximum-area-of-a-piece-of-cake-after-horizontal-and-vertical-cuts
<p>You are given a rectangular cake of size <code>h x w</code> and two arrays of integers <code>horizontalCuts</code> and <code>verticalCuts</code> where:</p> <ul> <li><code>horizontalCuts[i]</code> is the distance from the top of the rectangular cake to the <code>i<sup>th</sup></code> horizontal cut and similarly, a...
Medium
171.6K
416.8K
171,640
416,792
41.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxArea(int h, int w, vector<int>& horizontalCuts, vector<int>& verticalCuts) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxArea(int h, int w, int[] horizontalCuts, int[]...
5 4 [1,2,4] [1,3]
{ "name": "maxArea", "params": [ { "name": "h", "type": "integer" }, { "type": "integer", "name": "w" }, { "type": "integer[]", "name": "horizontalCuts" }, { "type": "integer[]", "name": "verticalCuts" } ], "return": { "type": "...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting']
1,466
Reorder Routes to Make All Paths Lead to the City Zero
reorder-routes-to-make-all-paths-lead-to-the-city-zero
<p>There are <code>n</code> cities numbered from <code>0</code> to <code>n - 1</code> and <code>n - 1</code> roads such that there is only one way to travel between two different cities (this network form a tree). Last year, The ministry of transport decided to orient the roads in one direction because they are too nar...
Medium
256.1K
395.2K
256,077
395,174
64.8%
['minimum-edge-reversals-so-every-node-is-reachable']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minReorder(int n, vector<vector<int>>& connections) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minReorder(int n, int[][] connections) {\n \n }\n}"}, {"value": "...
6 [[0,1],[1,3],[2,3],[4,0],[4,5]]
{ "name": "minReorder", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "connections" } ], "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...
['Depth-First Search', 'Breadth-First Search', 'Graph']
1,467
Probability of a Two Boxes Having The Same Number of Distinct Balls
probability-of-a-two-boxes-having-the-same-number-of-distinct-balls
<p>Given <code>2n</code> balls of <code>k</code> distinct colors. You will be given an integer array <code>balls</code> of size <code>k</code> where <code>balls[i]</code> is the number of balls of color <code>i</code>.</p> <p>All the balls will be <strong>shuffled uniformly at random</strong>, then we will distribute ...
Hard
9.9K
16.6K
9,934
16,591
59.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double getProbability(vector<int>& balls) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double getProbability(int[] balls) {\n \n }\n}"}, {"value": "python", "text": "Pyth...
[1,1]
{ "name": "getProbability", "params": [ { "name": "balls", "type": "integer[]" } ], "return": { "type": "double" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Dynamic Programming', 'Backtracking', 'Combinatorics', 'Probability and Statistics']
1,468
Calculate Salaries
calculate-salaries
null
Medium
27K
34.6K
27,029
34,592
78.1%
[]
['Create table If Not Exists Salaries (company_id int, employee_id int, employee_name varchar(13), salary int)', 'Truncate table Salaries', "insert into Salaries (company_id, employee_id, employee_name, salary) values ('1', '1', 'Tony', '2000')", "insert into Salaries (company_id, employee_id, employee_name, salary) va...
Database
null
{"headers":{"Salaries":["company_id","employee_id","employee_name","salary"]},"rows":{"Salaries":[[1,1,"Tony",2000],[1,2,"Pronub",21300],[1,3,"Tyrrox",10800],[2,1,"Pam",300],[2,7,"Bassem",450],[2,9,"Hermione",700],[3,7,"Bocaben",100],[3,2,"Ognjen",2200],[3,13,"Nyancat",3300],[3,15,"Morninngcat",7777]]}}
{"mysql": ["Create table If Not Exists Salaries (company_id int, employee_id int, employee_name varchar(13), salary int)"], "mssql": ["Create table Salaries (company_id int, employee_id int, employee_name varchar(13), salary int)"], "oraclesql": ["Create table Salaries (company_id int, employee_id int, employee_name va...
{"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,469
Find All The Lonely Nodes
find-all-the-lonely-nodes
null
Easy
58.8K
70K
58,756
69,975
84.0%
['binary-tree-tilt', 'univalued-binary-tree']
[]
Algorithms
null
[1,2,3,null,4]
{ "name": "getLonelyNodes", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "list<integer>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
1,470
Shuffle the Array
shuffle-the-array
<p>Given the array <code>nums</code> consisting of <code>2n</code> elements in the form <code>[x<sub>1</sub>,x<sub>2</sub>,...,x<sub>n</sub>,y<sub>1</sub>,y<sub>2</sub>,...,y<sub>n</sub>]</code>.</p> <p><em>Return the array in the form</em> <code>[x<sub>1</sub>,y<sub>1</sub>,x<sub>2</sub>,y<sub>2</sub>,...,x<sub>n</su...
Easy
785.5K
884.6K
785,541
884,592
88.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> shuffle(vector<int>& nums, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] shuffle(int[] nums, int n) {\n \n }\n}"}, {"value": "python", "text": "Py...
[2,5,1,3,4,7] 3
{ "name": "shuffle", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "n" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array']
1,471
The k Strongest Values in an Array
the-k-strongest-values-in-an-array
<p>Given an array of integers <code>arr</code> and an integer <code>k</code>.</p> <p>A value <code>arr[i]</code> is said to be stronger than a value <code>arr[j]</code> if <code>|arr[i] - m| &gt; |arr[j] - m|</code> where <code>m</code> is the <strong>centre</strong> of the array.<br /> If <code>|arr[i] - m| == |arr[j...
Medium
42.7K
69.1K
42,657
69,097
61.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getStrongest(vector<int>& arr, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getStrongest(int[] arr, int k) {\n \n }\n}"}, {"value": "python", "te...
[1,2,3,4,5] 2
{ "name": "getStrongest", "params": [ { "name": "arr", "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', 'Two Pointers', 'Sorting']
1,472
Design Browser History
design-browser-history
<p>You have a <strong>browser</strong> of one tab where you start on the <code>homepage</code> and you can visit another <code>url</code>, get back in the history number of <code>steps</code> or move forward in the history number of <code>steps</code>.</p> <p>Implement the <code>BrowserHistory</code> class:</p> <ul> ...
Medium
283K
362.8K
283,004
362,829
78.0%
['design-video-sharing-platform']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class BrowserHistory {\npublic:\n BrowserHistory(string homepage) {\n \n }\n \n void visit(string url) {\n \n }\n \n string back(int steps) {\n \n }\n \n string forward(int steps) {\n \n }\n};\n\n/**\n * Your B...
["BrowserHistory","visit","visit","visit","back","back","forward","visit","forward","back","back"] [["leetcode.com"],["google.com"],["facebook.com"],["youtube.com"],[1],[1],[1],["linkedin.com"],[2],[2],[7]]
{ "classname": "BrowserHistory", "constructor": { "params": [ { "type": "string", "name": "homepage" } ] }, "methods": [ { "params": [ { "type": "string", "name": "url" } ], "name": "visit", "return": { "...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Linked List', 'Stack', 'Design', 'Doubly-Linked List', 'Data Stream']
1,473
Paint House III
paint-house-iii
<p>There is a row of <code>m</code> houses in a small city, each house must be painted with one of the <code>n</code> colors (labeled from <code>1</code> to <code>n</code>), some houses that have been painted last summer should not be painted again.</p> <p>A neighborhood is a maximal group of continuous houses that ar...
Hard
66.9K
109.7K
66,907
109,722
61.0%
['number-of-distinct-roll-sequences', 'paint-house-iv']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minCost(vector<int>& houses, vector<vector<int>>& cost, int m, int n, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minCost(int[] houses, int[][] cost, int m, in...
[0,0,0,0,0] [[1,10],[10,1],[10,1],[1,10],[5,1]] 5 2 3
{ "name": "minCost", "params": [ { "name": "houses", "type": "integer[]" }, { "type": "integer[][]", "name": "cost" }, { "type": "integer", "name": "m" }, { "type": "integer", "name": "n" }, { "type": "integer", "name": ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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,474
Delete N Nodes After M Nodes of a Linked List
delete-n-nodes-after-m-nodes-of-a-linked-list
null
Easy
36K
48.9K
35,967
48,948
73.5%
['remove-nth-node-from-end-of-list', 'remove-zero-sum-consecutive-nodes-from-linked-list']
[]
Algorithms
null
[1,2,3,4,5,6,7,8,9,10,11,12,13] 2 3
{ "name": "deleteNodes", "params": [ { "name": "head", "type": "ListNode" }, { "type": "integer", "name": "m" }, { "type": "integer", "name": "n" } ], "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...
['Linked List']
1,475
Final Prices With a Special Discount in a Shop
final-prices-with-a-special-discount-in-a-shop
<p>You are given an integer array <code>prices</code> where <code>prices[i]</code> is the price of the <code>i<sup>th</sup></code> item in a shop.</p> <p>There is a special discount for items in the shop. If you buy the <code>i<sup>th</sup></code> item, then you will receive a discount equivalent to <code>prices[j]</c...
Easy
310.4K
373.1K
310,413
373,098
83.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> finalPrices(vector<int>& prices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] finalPrices(int[] prices) {\n \n }\n}"}, {"value": "python", "text": "Pyth...
[8,4,6,2,3]
{ "name": "finalPrices", "params": [ { "name": "prices", "type": "integer[]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Stack', 'Monotonic Stack']
1,476
Subrectangle Queries
subrectangle-queries
<p>Implement the class <code>SubrectangleQueries</code>&nbsp;which receives a <code>rows x cols</code> rectangle as a matrix of integers in the constructor and supports two methods:</p> <p>1.<code>&nbsp;updateSubrectangle(int row1, int col1, int row2, int col2, int newValue)</code></p> <ul> <li>Updates all values wi...
Medium
119.9K
135.8K
119,893
135,750
88.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class SubrectangleQueries {\npublic:\n SubrectangleQueries(vector<vector<int>>& rectangle) {\n \n }\n \n void updateSubrectangle(int row1, int col1, int row2, int col2, int newValue) {\n \n }\n \n int getValue(int row, int col) {\n ...
["SubrectangleQueries","getValue","updateSubrectangle","getValue","getValue","updateSubrectangle","getValue","getValue"] [[[[1,2,1],[4,3,4],[3,2,1],[1,1,1]]],[0,2],[0,0,3,2,5],[0,2],[3,1],[3,0,3,2,10],[3,1],[0,2]]
{ "classname": "SubrectangleQueries", "constructor": { "params": [ { "type": "integer[][]", "name": "rectangle" } ] }, "methods": [ { "params": [ { "type": "integer", "name": "row1" }, { "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', 'Design', 'Matrix']
1,477
Find Two Non-overlapping Sub-arrays Each With Target Sum
find-two-non-overlapping-sub-arrays-each-with-target-sum
<p>You are given an array of integers <code>arr</code> and an integer <code>target</code>.</p> <p>You have to find <strong>two non-overlapping sub-arrays</strong> of <code>arr</code> each with a sum equal <code>target</code>. There can be multiple answers so you have to find an answer where the sum of the lengths of t...
Medium
51.3K
140.8K
51,327
140,836
36.4%
['find-subarrays-with-equal-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minSumOfLengths(vector<int>& arr, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minSumOfLengths(int[] arr, int target) {\n \n }\n}"}, {"value": "python...
[3,2,2,4,3] 3
{ "name": "minSumOfLengths", "params": [ { "name": "arr", "type": "integer[]" }, { "type": "integer", "name": "target" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Binary Search', 'Dynamic Programming', 'Sliding Window']
1,478
Allocate Mailboxes
allocate-mailboxes
<p>Given the array <code>houses</code> where <code>houses[i]</code> is the location of the <code>i<sup>th</sup></code> house along a street and an integer <code>k</code>, allocate <code>k</code> mailboxes in the street.</p> <p>Return <em>the <strong>minimum</strong> total distance between each house and its nearest ma...
Hard
29.4K
52.7K
29,353
52,705
55.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minDistance(vector<int>& houses, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minDistance(int[] houses, int k) {\n \n }\n}"}, {"value": "python", "text": "...
[1,4,8,10,20] 3
{ "name": "minDistance", "params": [ { "name": "houses", "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', 'Dynamic Programming', 'Sorting']
1,479
Sales by Day of the Week
sales-by-day-of-the-week
null
Hard
19.6K
25.4K
19,608
25,354
77.3%
[]
['Create table If Not Exists Orders (order_id int, customer_id int, order_date date, item_id varchar(30), quantity int)', 'Create table If Not Exists Items (item_id varchar(30), item_name varchar(30), item_category varchar(30))', 'Truncate table Orders', "insert into Orders (order_id, customer_id, order_date, item_id, ...
Database
null
{"headers": {"Orders": ["order_id", "customer_id", "order_date", "item_id", "quantity"], "Items": ["item_id", "item_name", "item_category"]}, "rows": {"Orders": [[1, 1, "2020-06-01", 1, 10], [2, 1, "2020-06-08", 2, 10], [3, 2, "2020-06-02", 1, 5], [4, 3, "2020-06-03", 3, 5], [5, 4, "2020-06-04", 4, 1], [6, 4, "2020-06-...
{"mysql": ["Create table If Not Exists Orders (order_id int, customer_id int, order_date date, item_id varchar(30), quantity int)", "Create table If Not Exists Items (item_id varchar(30), item_name varchar(30), item_category varchar(30))"], "mssql": ["Create table Orders (order_id int, customer_id int, order_date date,...
{"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,480
Running Sum of 1d Array
running-sum-of-1d-array
<p>Given an array <code>nums</code>. We define a running sum of an array as&nbsp;<code>runningSum[i] = sum(nums[0]&hellip;nums[i])</code>.</p> <p>Return the running sum of <code>nums</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> nums = [1,2,3,4] <strong>Ou...
Easy
2M
2.4M
2,048,426
2,355,615
87.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> runningSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] runningSum(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[1,2,3,4]
{ "name": "runningSum", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer[]" }, "manual": false }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Prefix Sum']
1,481
Least Number of Unique Integers after K Removals
least-number-of-unique-integers-after-k-removals
<p>Given an array of integers&nbsp;<code>arr</code>&nbsp;and an integer <code>k</code>.&nbsp;Find the <em>least number of unique integers</em>&nbsp;after removing <strong>exactly</strong> <code>k</code> elements<b>.</b></p> <ol> </ol> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Inp...
Medium
263.3K
415.8K
263,283
415,798
63.3%
['maximum-number-of-distinct-elements-after-operations']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\r\npublic:\r\n int findLeastNumOfUniqueInts(vector<int>& arr, int k) {\r\n \r\n }\r\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\r\n public int findLeastNumOfUniqueInts(int[] arr, int k) {\r\n \r\n }...
[5,5,4] 1
{ "name": "findLeastNumOfUniqueInts", "params": [ { "name": "arr", "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', 'Greedy', 'Sorting', 'Counting']
1,482
Minimum Number of Days to Make m Bouquets
minimum-number-of-days-to-make-m-bouquets
<p>You are given an integer array <code>bloomDay</code>, an integer <code>m</code> and an integer <code>k</code>.</p> <p>You want to make <code>m</code> bouquets. To make a bouquet, you need to use <code>k</code> <strong>adjacent flowers</strong> from the garden.</p> <p>The garden consists of <code>n</code> flowers, ...
Medium
342.8K
619.6K
342,765
619,640
55.3%
['maximize-the-confusion-of-an-exam', 'earliest-possible-day-of-full-bloom']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minDays(vector<int>& bloomDay, int m, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minDays(int[] bloomDay, int m, int k) {\n \n }\n}"}, {"value": "python",...
[1,10,3,10,2] 3 1
{ "name": "minDays", "params": [ { "name": "bloomDay", "type": "integer[]" }, { "type": "integer", "name": "m" }, { "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,483
Kth Ancestor of a Tree Node
kth-ancestor-of-a-tree-node
<p>You are given a tree with <code>n</code> nodes numbered from <code>0</code> to <code>n - 1</code> in the form of a parent array <code>parent</code> where <code>parent[i]</code> is the parent of <code>i<sup>th</sup></code> node. The root of the tree is node <code>0</code>. Find the <code>k<sup>th</sup></code> ancesto...
Hard
42.1K
118.6K
42,074
118,606
35.5%
['minimum-edge-weight-equilibrium-queries-in-a-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class TreeAncestor {\npublic:\n TreeAncestor(int n, vector<int>& parent) {\n \n }\n \n int getKthAncestor(int node, int k) {\n \n }\n};\n\n/**\n * Your TreeAncestor object will be instantiated and called as such:\n * TreeAncestor* obj = new T...
["TreeAncestor","getKthAncestor","getKthAncestor","getKthAncestor"] [[7,[-1,0,0,1,1,2,2]],[3,1],[5,2],[6,3]]
{ "classname": "TreeAncestor", "constructor": { "params": [ { "type": "integer", "name": "n" }, { "name": "parent", "type": "integer[]" } ] }, "methods": [ { "params": [ { "type": "integer", "name": "node" ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Dynamic Programming', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Design']
1,484
Group Sold Products By The Date
group-sold-products-by-the-date
<p>Table <code>Activities</code>:</p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | sell_date | date | | product | varchar | +-------------+---------+ There is no primary key (column with unique values) for this table. It may contain duplicates. Each row of this table c...
Easy
302.2K
389.3K
302,155
389,324
77.6%
['finding-the-topic-of-each-post']
['Create table If Not Exists Activities (sell_date date, product varchar(20))', 'Truncate table Activities', "insert into Activities (sell_date, product) values ('2020-05-30', 'Headphone')", "insert into Activities (sell_date, product) values ('2020-06-01', 'Pencil')", "insert into Activities (sell_date, product) value...
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":{"Activities":["sell_date","product"]},"rows":{"Activities":[["2020-05-30","Headphone"],["2020-06-01","Pencil"],["2020-06-02","Mask"],["2020-05-30","Basketball"],["2020-06-01","Bible"],["2020-06-02","Mask"],["2020-05-30","T-Shirt"]]}}
{"mysql": ["Create table If Not Exists Activities (sell_date date, product varchar(20))"], "mssql": ["Create table Activities (sell_date date, product varchar(20))"], "oraclesql": ["Create table Activities (sell_date date, product varchar(20))", "ALTER SESSION SET nls_date_format='YYYY-MM-DD'"], "database": true, "name...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,485
Clone Binary Tree With Random Pointer
clone-binary-tree-with-random-pointer
null
Medium
31.7K
39.2K
31,664
39,181
80.8%
['clone-graph', 'copy-list-with-random-pointer', 'clone-n-ary-tree']
[]
Algorithms
null
[[1,null],null,[4,3],[7,0]]
{ "name": "copyRandomBinaryTree", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "TreeNode" }, "manual": true, "languages": [ "cpp", "java", "python", "csharp", "python3", "javascript", "typescript", "kotlin", "scala", ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
1,486
XOR Operation in an Array
xor-operation-in-an-array
<p>You are given an integer <code>n</code> and an integer <code>start</code>.</p> <p>Define an array <code>nums</code> where <code>nums[i] = start + 2 * i</code> (<strong>0-indexed</strong>) and <code>n == nums.length</code>.</p> <p>Return <em>the bitwise XOR of all elements of</em> <code>nums</code>.</p> <p>&nbsp;<...
Easy
223.6K
257.9K
223,556
257,854
86.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int xorOperation(int n, int start) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int xorOperation(int n, int start) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
5 0
{ "name": "xorOperation", "params": [ { "name": "n", "type": "integer" }, { "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...
['Math', 'Bit Manipulation']
1,487
Making File Names Unique
making-file-names-unique
<p>Given an array of strings <code>names</code> of size <code>n</code>. You will create <code>n</code> folders in your file system <strong>such that</strong>, at the <code>i<sup>th</sup></code> minute, you will create a folder with the name <code>names[i]</code>.</p> <p>Since two files <strong>cannot</strong> have the...
Medium
36.5K
96.7K
36,478
96,676
37.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> getFolderNames(vector<string>& names) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String[] getFolderNames(String[] names) {\n \n }\n}"}, {"value": "python...
["pes","fifa","gta","pes(2019)"]
{ "name": "getFolderNames", "params": [ { "name": "names", "type": "string[]" } ], "return": { "type": "string[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String']
1,488
Avoid Flood in The City
avoid-flood-in-the-city
<p>Your country has an infinite number of lakes. Initially, all the lakes are empty, but when it rains over the <code>nth</code> lake, the <code>nth</code> lake becomes full of water. If it rains over a lake that is <strong>full of water</strong>, there will be a <strong>flood</strong>. Your goal is to avoid floods in ...
Medium
39.9K
146.5K
39,932
146,536
27.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> avoidFlood(vector<int>& rains) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] avoidFlood(int[] rains) {\n \n }\n}"}, {"value": "python", "text": "Python",...
[1,2,3,4]
{ "name": "avoidFlood", "params": [ { "name": "rains", "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', 'Binary Search', 'Greedy', 'Heap (Priority Queue)']
1,489
Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree
find-critical-and-pseudo-critical-edges-in-minimum-spanning-tree
<p>Given a weighted undirected connected graph with <code>n</code>&nbsp;vertices numbered from <code>0</code> to <code>n - 1</code>,&nbsp;and an array <code>edges</code>&nbsp;where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>, weight<sub>i</sub>]</code> represents a bidirectional and weighted edge between nodes&nbsp;...
Hard
61.3K
92.2K
61,317
92,213
66.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> findCriticalAndPseudoCriticalEdges(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> findCriticalAndPseudoCrit...
5 [[0,1,1],[1,2,1],[2,3,2],[0,3,2],[0,4,3],[3,4,3],[1,4,6]]
{ "name": "findCriticalAndPseudoCriticalEdges", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "edges" } ], "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...
['Union Find', 'Graph', 'Sorting', 'Minimum Spanning Tree', 'Strongly Connected Component']
1,490
Clone N-ary Tree
clone-n-ary-tree
null
Medium
32K
38.5K
32,031
38,512
83.2%
['clone-graph', 'copy-list-with-random-pointer', 'clone-binary-tree-with-random-pointer']
[]
Algorithms
null
[1,null,3,2,4,null,5,6]
{ "name": "cloneTree", "params": [ { "name": "root", "type": "integer" } ], "return": { "type": "integer" }, "manual": true, "languages": [ "cpp", "java", "python", "python3", "javascript", "csharp", "typescript", "ruby", "swift", "golang", ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Tree', 'Depth-First Search', 'Breadth-First Search']
1,491
Average Salary Excluding the Minimum and Maximum Salary
average-salary-excluding-the-minimum-and-maximum-salary
<p>You are given an array of <strong>unique</strong> integers <code>salary</code> where <code>salary[i]</code> is the salary of the <code>i<sup>th</sup></code> employee.</p> <p>Return <em>the average salary of employees excluding the minimum and maximum salary</em>. Answers within <code>10<sup>-5</sup></code> of the a...
Easy
364.9K
575.1K
364,860
575,101
63.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double average(vector<int>& salary) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double average(int[] salary) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[4000,3000,1000,2000]
{ "name": "average", "params": [ { "name": "salary", "type": "integer[]" } ], "return": { "type": "double" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting']
1,492
The kth Factor of n
the-kth-factor-of-n
<p>You are given two positive integers <code>n</code> and <code>k</code>. A factor of an integer <code>n</code> is defined as an integer <code>i</code> where <code>n % i == 0</code>.</p> <p>Consider a list of all factors of <code>n</code> sorted in <strong>ascending order</strong>, return <em>the </em><code>k<sup>th</...
Medium
319.2K
459.9K
319,239
459,946
69.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int kthFactor(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int kthFactor(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
12 3
{ "name": "kthFactor", "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', 'Number Theory']
1,493
Longest Subarray of 1's After Deleting One Element
longest-subarray-of-1s-after-deleting-one-element
<p>Given a binary array <code>nums</code>, you should delete one element from it.</p> <p>Return <em>the size of the longest non-empty subarray containing only </em><code>1</code><em>&#39;s in the resulting array</em>. Return <code>0</code> if there is no such subarray.</p> <p>&nbsp;</p> <p><strong class="example">Exa...
Medium
406.4K
589.4K
406,406
589,446
68.9%
['max-consecutive-ones-iii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestSubarray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestSubarray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[1,1,0,1]
{ "name": "longestSubarray", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Sliding Window']
1,494
Parallel Courses II
parallel-courses-ii
<p>You are given an integer <code>n</code>, which indicates that there are <code>n</code> courses labeled from <code>1</code> to <code>n</code>. You are also given an array <code>relations</code> where <code>relations[i] = [prevCourse<sub>i</sub>, nextCourse<sub>i</sub>]</code>, representing a prerequisite relationship...
Hard
21.8K
73.9K
21,772
73,886
29.5%
['parallel-courses']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minNumberOfSemesters(int n, vector<vector<int>>& relations, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minNumberOfSemesters(int n, int[][] relations, int k) {\n ...
4 [[2,1],[3,1],[1,4]] 2
{ "name": "minNumberOfSemesters", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "relations" }, { "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...
['Dynamic Programming', 'Bit Manipulation', 'Graph', 'Bitmask']
1,495
Friendly Movies Streamed Last Month
friendly-movies-streamed-last-month
null
Easy
36.6K
74.7K
36,585
74,723
49.0%
[]
['Create table If Not Exists TVProgram (program_date date, content_id int, channel varchar(30))', "Create table If Not Exists Content (content_id varchar(30), title varchar(30), Kids_content ENUM('Y', 'N'), content_type varchar(30))", 'Truncate table TVProgram', "insert into TVProgram (program_date, content_id, channel...
Database
null
{"headers": {"TVProgram": ["program_date", "content_id", "channel"], "Content": ["content_id", "title", "Kids_content", "content_type"]}, "rows": {"TVProgram": [["2020-06-10 08:00", 1, "LC-Channel"], ["2020-05-11 12:00", 2, "LC-Channel"], ["2020-05-12 12:00", 3, "LC-Channel"], ["2020-05-13 14:00", 4, "Disney Ch"], ["20...
{"mysql": ["Create table If Not Exists TVProgram (program_date date, content_id int, channel varchar(30))", "Create table If Not Exists Content (content_id varchar(30), title varchar(30), Kids_content ENUM('Y', 'N'), content_type varchar(30))"], "mssql": ["Create table TVProgram (program_date date, content_id int, chan...
{"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,496
Path Crossing
path-crossing
<p>Given a string <code>path</code>, where <code>path[i] = &#39;N&#39;</code>, <code>&#39;S&#39;</code>, <code>&#39;E&#39;</code> or <code>&#39;W&#39;</code>, each representing moving one unit north, south, east, or west, respectively. You start at the origin <code>(0, 0)</code> on a 2D plane and walk on the path speci...
Easy
179.8K
287.6K
179,813
287,599
62.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isPathCrossing(string path) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isPathCrossing(String path) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
"NES"
{ "name": "isPathCrossing", "params": [ { "name": "path", "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,497
Check If Array Pairs Are Divisible by k
check-if-array-pairs-are-divisible-by-k
<p>Given an array of integers <code>arr</code> of even length <code>n</code> and an integer <code>k</code>.</p> <p>We want to divide the array into exactly <code>n / 2</code> pairs such that the sum of each pair is divisible by <code>k</code>.</p> <p>Return <code>true</code><em> If you can find a way to do that or </...
Medium
196.1K
424.5K
196,133
424,496
46.2%
['count-array-pairs-divisible-by-k', 'minimum-deletions-to-make-array-divisible', 'count-pairs-that-form-a-complete-day-ii', 'count-pairs-that-form-a-complete-day-i']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canArrange(vector<int>& arr, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canArrange(int[] arr, int k) {\n \n }\n}"}, {"value": "python", "text": "Pyt...
[1,2,3,4,5,10,6,7,8,9] 5
{ "name": "canArrange", "params": [ { "name": "arr", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Counting']
1,498
Number of Subsequences That Satisfy the Given Sum Condition
number-of-subsequences-that-satisfy-the-given-sum-condition
<p>You are given an array of integers <code>nums</code> and an integer <code>target</code>.</p> <p>Return <em>the number of <strong>non-empty</strong> subsequences of </em><code>nums</code><em> such that the sum of the minimum and maximum element on it is less or equal to </em><code>target</code>. Since the answer may...
Medium
140.4K
320.7K
140,399
320,692
43.8%
['minimum-operations-to-form-subsequence-with-target-sum', 'find-the-sum-of-subsequence-powers', 'find-the-sum-of-the-power-of-all-subsequences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numSubseq(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numSubseq(int[] nums, int target) {\n \n }\n}"}, {"value": "python", "text":...
[3,5,6,7] 9
{ "name": "numSubseq", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "target" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Two Pointers', 'Binary Search', 'Sorting']
1,499
Max Value of Equation
max-value-of-equation
<p>You are given an array <code>points</code> containing the coordinates of points on a 2D plane, sorted by the x-values, where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> such that <code>x<sub>i</sub> &lt; x<sub>j</sub></code> for all <code>1 &lt;= i &lt; j &lt;= points.length</code>. You are also given an...
Hard
49.4K
111.1K
49,368
111,103
44.4%
['count-pairs-in-two-arrays']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMaxValueOfEquation(vector<vector<int>>& points, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMaxValueOfEquation(int[][] points, int k) {\n \n }\n}"...
[[1,3],[2,0],[5,10],[6,-10]] 1
{ "name": "findMaxValueOfEquation", "params": [ { "name": "points", "type": "integer[][]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Queue', 'Sliding Window', 'Heap (Priority Queue)', 'Monotonic Queue']
1,500
Design a File Sharing System
design-a-file-sharing-system
null
Medium
5.2K
12.5K
5,204
12,488
41.7%
['design-twitter']
[]
Algorithms
null
["FileSharing","join","join","join","request","request","leave","request","leave","join"] [[4],[[1,2]],[[2,3]],[[4]],[1,3],[2,2],[1],[2,1],[2],[[]]]
{ "classname": "FileSharing", "constructor": { "params": [ { "type": "integer", "name": "m" } ] }, "methods": [ { "params": [ { "type": "list<integer>", "name": "ownedChunks" } ], "name": "join", "return": { ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Design', 'Sorting', 'Heap (Priority Queue)', 'Data Stream']