questionFrontendId
int64
1
3.51k
questionTitle
stringlengths
3
79
TitleSlug
stringlengths
3
79
content
stringlengths
431
25.4k
difficulty
stringclasses
3 values
totalAccepted
stringlengths
2
6
totalSubmission
stringlengths
2
6
totalAcceptedRaw
int64
124
16.8M
totalSubmissionRaw
int64
285
30.3M
acRate
stringlengths
4
5
similarQuestions
stringlengths
2
714
mysqlSchemas
stringclasses
295 values
category
stringclasses
6 values
codeDefinition
stringlengths
122
24.9k
sampleTestCase
stringlengths
1
4.33k
metaData
stringlengths
37
3.13k
envInfo
stringclasses
26 values
topicTags
stringlengths
2
153
3,110
Score of a String
score-of-a-string
<p>You are given a string <code>s</code>. The <strong>score</strong> of a string is defined as the sum of the absolute difference between the <strong>ASCII</strong> values of adjacent characters.</p> <p>Return the <strong>score</strong> of<em> </em><code>s</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example ...
Easy
343K
373K
343,037
372,995
92.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int scoreOfString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int scoreOfString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
"hello"
{ "name": "scoreOfString", "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']
3,111
Minimum Rectangles to Cover Points
minimum-rectangles-to-cover-points
<p>You are given a 2D integer array <code>points</code>, where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>. You are also given an integer <code>w</code>. Your task is to <strong>cover</strong> <strong>all</strong> the given points with rectangles.</p> <p>Each rectangle has its lower end at some point <code...
Medium
29.3K
47.2K
29,271
47,175
62.0%
['minimum-area-rectangle', 'k-closest-points-to-origin']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minRectanglesToCoverPoints(vector<vector<int>>& points, int w) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minRectanglesToCoverPoints(int[][] points, int w) {\n \n ...
[[2,1],[1,0],[1,4],[1,8],[3,5],[4,6]] 1
{ "name": "minRectanglesToCoverPoints", "params": [ { "name": "points", "type": "integer[][]" }, { "type": "integer", "name": "w" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting']
3,112
Minimum Time to Visit Disappearing Nodes
minimum-time-to-visit-disappearing-nodes
<p>There is an undirected graph of <code>n</code> nodes. You are given a 2D array <code>edges</code>, where <code>edges[i] = [u<sub>i</sub>, v<sub>i</sub>, length<sub>i</sub>]</code> describes an edge between node <code>u<sub>i</sub></code> and node <code>v<sub>i</sub></code> with a traversal time of <code>length<sub>i...
Medium
22.4K
63.8K
22,435
63,761
35.2%
['find-the-last-marked-nodes-in-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> minimumTime(int n, vector<vector<int>>& edges, vector<int>& disappear) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] minimumTime(int n, int[][] edges, int[] disapp...
3 [[0,1,2],[1,2,1],[0,2,4]] [1,1,5]
{ "name": "minimumTime", "params": [ { "type": "integer", "name": "n" }, { "type": "integer[][]", "name": "edges" }, { "type": "integer[]", "name": "disappear" } ], "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', 'Graph', 'Heap (Priority Queue)', 'Shortest Path']
3,113
Find the Number of Subarrays Where Boundary Elements Are Maximum
find-the-number-of-subarrays-where-boundary-elements-are-maximum
<p>You are given an array of <strong>positive</strong> integers <code>nums</code>.</p> <p>Return the number of <span data-keyword="subarray-nonempty">subarrays</span> of <code>nums</code>, where the <strong>first</strong> and the <strong>last</strong> elements of the subarray are <em>equal</em> to the <strong>largest<...
Hard
11.5K
38.7K
11,454
38,707
29.6%
['number-of-subarrays-with-bounded-maximum', 'count-subarrays-with-fixed-bounds', 'count-subarrays-where-max-element-appears-at-least-k-times']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long numberOfSubarrays(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long numberOfSubarrays(int[] nums) {\n \n }\n}"}, {"value": "python", "text": ...
[1,4,3,3,2]
{ "name": "numberOfSubarrays", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Stack', 'Monotonic Stack']
3,114
Latest Time You Can Obtain After Replacing Characters
latest-time-you-can-obtain-after-replacing-characters
<p>You are given a string <code>s</code> representing a 12-hour format time where some of the digits (possibly none) are replaced with a <code>&quot;?&quot;</code>.</p> <p>12-hour times are formatted as <code>&quot;HH:MM&quot;</code>, where <code>HH</code> is between <code>00</code> and <code>11</code>, and <code>MM</...
Easy
37.4K
105.7K
37,431
105,661
35.4%
['latest-time-by-replacing-hidden-digits']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string findLatestTime(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String findLatestTime(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "default...
"1?:?4"
{ "name": "findLatestTime", "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', 'Enumeration']
3,115
Maximum Prime Difference
maximum-prime-difference
<p>You are given an integer array <code>nums</code>.</p> <p>Return an integer that is the <strong>maximum</strong> distance between the <strong>indices</strong> of two (not necessarily different) prime numbers in <code>nums</code><em>.</em></p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <div cl...
Medium
43.1K
75.3K
43,081
75,320
57.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumPrimeDifference(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumPrimeDifference(int[] nums) {\n \n }\n}"}, {"value": "python", "text...
[4,2,9,5,3]
{ "name": "maximumPrimeDifference", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Number Theory']
3,116
Kth Smallest Amount With Single Denomination Combination
kth-smallest-amount-with-single-denomination-combination
<p>You are given an integer array <code>coins</code> representing coins of different denominations and an integer <code>k</code>.</p> <p>You have an infinite number of coins of each denomination. However, you are <strong>not allowed</strong> to combine coins of different denominations.</p> <p>Return the <code>k<sup>t...
Hard
10.1K
55.3K
10,061
55,321
18.2%
['kth-smallest-number-in-multiplication-table', 'find-the-number-of-possible-ways-for-an-event']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long findKthSmallest(vector<int>& coins, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long findKthSmallest(int[] coins, int k) {\n \n }\n}"}, {"value": "pytho...
[3,6,9] 3
{ "name": "findKthSmallest", "params": [ { "name": "coins", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Binary Search', 'Bit Manipulation', 'Combinatorics', 'Number Theory']
3,117
Minimum Sum of Values by Dividing Array
minimum-sum-of-values-by-dividing-array
<p>You are given two arrays <code>nums</code> and <code>andValues</code> of length <code>n</code> and <code>m</code> respectively.</p> <p>The <strong>value</strong> of an array is equal to the <strong>last</strong> element of that array.</p> <p>You have to divide <code>nums</code> into <code>m</code> <strong>disjoint...
Hard
5.8K
21.6K
5,808
21,592
26.9%
['minimum-cost-to-split-an-array', 'split-with-minimum-sum', 'find-subarray-with-bitwise-or-closest-to-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumValueSum(vector<int>& nums, vector<int>& andValues) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumValueSum(int[] nums, int[] andValues) {\n \n }\n}"}...
[1,4,3,3,2] [0,3,3,2]
{ "name": "minimumValueSum", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[]", "name": "andValues" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Dynamic Programming', 'Bit Manipulation', 'Segment Tree', 'Queue']
3,118
Friday Purchase III
friday-purchase-iii
null
Medium
1.6K
2.8K
1,555
2,757
56.4%
[]
['Create Table if Not Exists Purchases( user_id int, purchase_date date, amount_spend int)', "Create Table if Not Exists Users (user_id int, membership enum('Standard', 'Premium', 'VIP'))", 'Truncate table Purchases', "insert into Purchases (user_id, purchase_date, amount_spend) values ('11', '2023-11-03', '1126')", "i...
Database
null
{"headers":{"Purchases":["user_id","purchase_date","amount_spend"],"Users":["user_id","membership"]},"rows":{"Purchases":[[11,"2023-11-03",1126],[15,"2023-11-10",7473],[17,"2023-11-17",2414],[12,"2023-11-24",9692],[8,"2023-11-24",5117],[1,"2023-11-24",5241],[10,"2023-11-22",8266],[13,"2023-11-21",12000]],"Users":[[11,"...
{"mysql": ["Create Table if Not Exists Purchases( user_id int, purchase_date date, amount_spend int)", "Create Table if Not Exists Users (user_id int, membership enum('Standard', 'Premium', 'VIP'))"], "mssql": ["Create Table Purchases( user_id int, purchase_date date, amount_spend int)", "Create Table Users (user_id i...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,119
Maximum Number of Potholes That Can Be Fixed
maximum-number-of-potholes-that-can-be-fixed
null
Medium
3.1K
5.7K
3,057
5,662
54.0%
[]
[]
Algorithms
null
".." 5
{ "name": "maxPotholes", "params": [ { "name": "road", "type": "string" }, { "type": "integer", "name": "budget" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Greedy', 'Sorting']
3,120
Count the Number of Special Characters I
count-the-number-of-special-characters-i
<p>You are given a string <code>word</code>. A letter is called <strong>special</strong> if it appears <strong>both</strong> in lowercase and uppercase in <code>word</code>.</p> <p>Return the number of<em> </em><strong>special</strong> letters in<em> </em><code>word</code>.</p> <p>&nbsp;</p> <p><strong class="example...
Easy
54.5K
83.7K
54,470
83,703
65.1%
['detect-capital', 'greatest-english-letter-in-upper-and-lower-case', 'count-the-number-of-special-characters-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfSpecialChars(string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfSpecialChars(String word) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
"aaAbcBC"
{ "name": "numberOfSpecialChars", "params": [ { "name": "word", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String']
3,121
Count the Number of Special Characters II
count-the-number-of-special-characters-ii
<p>You are given a string <code>word</code>. A letter&nbsp;<code>c</code> is called <strong>special</strong> if it appears <strong>both</strong> in lowercase and uppercase in <code>word</code>, and <strong>every</strong> lowercase occurrence of <code>c</code> appears before the <strong>first</strong> uppercase occurren...
Medium
35.3K
84.5K
35,309
84,545
41.8%
['detect-capital', 'greatest-english-letter-in-upper-and-lower-case', 'count-the-number-of-special-characters-i']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfSpecialChars(string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfSpecialChars(String word) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
"aaAbcBC"
{ "name": "numberOfSpecialChars", "params": [ { "name": "word", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String']
3,122
Minimum Number of Operations to Satisfy Conditions
minimum-number-of-operations-to-satisfy-conditions
<p>You are given a 2D matrix <code>grid</code> of size <code>m x n</code>. In one <strong>operation</strong>, you can change the value of <strong>any</strong> cell to <strong>any</strong> non-negative number. You need to perform some <strong>operations</strong> such that each cell <code>grid[i][j]</code> is:</p> <ul> ...
Medium
16.3K
40.7K
16,312
40,670
40.1%
['candy', 'distribute-candies', 'minimum-cost-of-buying-candies-with-discount']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumOperations(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumOperations(int[][] grid) {\n \n }\n}"}, {"value": "python", "text...
[[1,0,2],[1,0,2]]
{ "name": "minimumOperations", "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']
3,123
Find Edges in Shortest Paths
find-edges-in-shortest-paths
<p>You are given an undirected weighted graph of <code>n</code> nodes numbered from 0 to <code>n - 1</code>. The graph consists of <code>m</code> edges represented by a 2D array <code>edges</code>, where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>, w<sub>i</sub>]</code> indicates that there is an edge between nodes ...
Hard
14.8K
32.6K
14,784
32,642
45.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> findAnswer(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean[] findAnswer(int n, int[][] edges) {\n \n }\n}"}, {"value"...
6 [[0,1,4],[0,2,1],[1,3,2],[1,4,3],[1,5,1],[2,3,1],[3,5,3],[4,5,2]]
{ "name": "findAnswer", "params": [ { "type": "integer", "name": "n" }, { "type": "integer[][]", "name": "edges" } ], "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...
['Depth-First Search', 'Breadth-First Search', 'Graph', 'Heap (Priority Queue)', 'Shortest Path']
3,124
Find Longest Calls
find-longest-calls
null
Medium
1.8K
2.9K
1,810
2,922
61.9%
[]
['Create table if Not Exists Contacts(id int, first_name varchar(20), last_name varchar(20))', "Create table if Not Exists Calls(contact_id int, type ENUM('incoming', 'outgoing'), duration int)", 'Truncate table Contacts', "insert into Contacts (id, first_name, last_name) values ('1', 'John', 'Doe')", "insert into Cont...
Database
null
{"headers":{"Contacts":["id","first_name","last_name"],"Calls":["contact_id","type","duration"]},"rows":{"Contacts":[[1,"John","Doe"],[2,"Jane","Smith"],[3,"Alice","Johnson"],[4,"Michael","Brown"],[5,"Emily","Davis"]],"Calls":[[1,"incoming",120],[1,"outgoing",180],[2,"incoming",300],[2,"outgoing",240],[3,"incoming",150...
{"mysql": ["Create table if Not Exists Contacts(id int, first_name varchar(20), last_name varchar(20))", "Create table if Not Exists Calls(contact_id int, type ENUM('incoming', 'outgoing'), duration int)"], "mssql": ["Create table Contacts(id int, first_name varchar(20), last_name varchar(20))", "Create table Calls(con...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,125
Maximum Number That Makes Result of Bitwise AND Zero
maximum-number-that-makes-result-of-bitwise-and-zero
null
Medium
954
1.4K
954
1,403
68.0%
[]
[]
Algorithms
null
7
{ "name": "maxNumber", "params": [ { "name": "n", "type": "long" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Greedy', 'Sorting']
3,126
Server Utilization Time
server-utilization-time
null
Medium
1.9K
3K
1,860
3,018
61.6%
[]
["Create table if not exists Servers ( server_id int, status_time timestamp, session_status ENUM ('start','stop'))", 'Truncate table Servers', "insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-29 20:22:50', 'start')", "insert into Servers (server_id, status_time, session_status) values...
Database
null
{"headers": {"Servers": ["server_id", "status_time", "session_status"]}, "rows": {"Servers": [[4, "2023-11-29 20:22:50", "start"], [4, "2023-11-30 04:19:50", "stop"], [2, "2023-11-18 21:23:09", "start"], [2, "2023-11-19 00:38:09", "stop"], [5, "2023-11-27 18:38:16", "start"], [5, "2023-11-28 02:46:16", "stop"], [4, "20...
{"mysql": ["Create table if not exists Servers ( server_id int, status_time timestamp, session_status ENUM ('start','stop'))"], "mssql": ["Create table Servers (server_id int, status_time datetime, session_status varchar(20) NOT NULL CHECK (session_status in ('start','stop')))"], "oraclesql": ["Create table Servers (...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,127
Make a Square with the Same Color
make-a-square-with-the-same-color
<p>You are given a 2D matrix <code>grid</code> of size <code>3 x 3</code> consisting only of characters <code>&#39;B&#39;</code> and <code>&#39;W&#39;</code>. Character <code>&#39;W&#39;</code> represents the white color<!-- notionvc: 06a49cc0-a296-4bd2-9bfe-c8818edeb53a -->, and character <code>&#39;B&#39;</code> repr...
Easy
30.1K
58.2K
30,061
58,243
51.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canMakeSquare(vector<vector<char>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canMakeSquare(char[][] grid) {\n \n }\n}"}, {"value": "python", "text"...
[["B","W","B"],["B","W","W"],["B","W","B"]]
{ "name": "canMakeSquare", "params": [ { "name": "grid", "type": "character[][]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Matrix', 'Enumeration']
3,128
Right Triangles
right-triangles
<p>You are given a 2D boolean matrix <code>grid</code>.</p> <p>A collection of 3 elements of <code>grid</code> is a <strong>right triangle</strong> if one of its elements is in the <strong>same row</strong> with another element and in the <strong>same column</strong> with the third element. The 3 elements may <strong>...
Medium
20.8K
44.6K
20,775
44,584
46.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long numberOfRightTriangles(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long numberOfRightTriangles(int[][] grid) {\n \n }\n}"}, {"value"...
[[0,1,0],[0,1,1],[0,1,0]]
{ "name": "numberOfRightTriangles", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Math', 'Combinatorics', 'Counting']
3,129
Find All Possible Stable Binary Arrays I
find-all-possible-stable-binary-arrays-i
<p>You are given 3 positive integers <code>zero</code>, <code>one</code>, and <code>limit</code>.</p> <p>A <span data-keyword="binary-array">binary array</span> <code>arr</code> is called <strong>stable</strong> if:</p> <ul> <li>The number of occurrences of 0 in <code>arr</code> is <strong>exactly </strong><code>zer...
Medium
8.8K
33.9K
8,799
33,872
26.0%
['contiguous-array', 'binary-subarrays-with-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfStableArrays(int zero, int one, int limit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfStableArrays(int zero, int one, int limit) {\n \n }\n}"}, ...
1 1 2
{ "name": "numberOfStableArrays", "params": [ { "name": "zero", "type": "integer" }, { "type": "integer", "name": "one" }, { "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...
['Dynamic Programming', 'Prefix Sum']
3,130
Find All Possible Stable Binary Arrays II
find-all-possible-stable-binary-arrays-ii
<p>You are given 3 positive integers <code>zero</code>, <code>one</code>, and <code>limit</code>.</p> <p>A <span data-keyword="binary-array">binary array</span> <code>arr</code> is called <strong>stable</strong> if:</p> <ul> <li>The number of occurrences of 0 in <code>arr</code> is <strong>exactly </strong><code>zer...
Hard
3.6K
14.2K
3,624
14,235
25.5%
['contiguous-array', 'binary-subarrays-with-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfStableArrays(int zero, int one, int limit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfStableArrays(int zero, int one, int limit) {\n \n }\n}"}, ...
1 1 2
{ "name": "numberOfStableArrays", "params": [ { "name": "zero", "type": "integer" }, { "type": "integer", "name": "one" }, { "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...
['Dynamic Programming', 'Prefix Sum']
3,131
Find the Integer Added to Array I
find-the-integer-added-to-array-i
<p>You are given two arrays of equal length, <code>nums1</code> and <code>nums2</code>.</p> <p>Each element in <code>nums1</code> has been increased (or decreased in the case of negative) by an integer, represented by the variable <code>x</code>.</p> <p>As a result, <code>nums1</code> becomes <strong>equal</strong> t...
Easy
68.8K
84K
68,817
84,045
81.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int addedInteger(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int addedInteger(int[] nums1, int[] nums2) {\n \n }\n}"}, {"value": ...
[2,6,4] [9,7,5]
{ "name": "addedInteger", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array']
3,132
Find the Integer Added to Array II
find-the-integer-added-to-array-ii
<p>You are given two integer arrays <code>nums1</code> and <code>nums2</code>.</p> <p>From <code>nums1</code> two elements have been removed, and all other elements have been increased (or decreased in the case of negative) by an integer, represented by the variable <code>x</code>.</p> <p>As a result, <code>nums1</co...
Medium
23.5K
74.2K
23,453
74,249
31.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumAddedInteger(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumAddedInteger(int[] nums1, int[] nums2) {\n \n }\n}...
[4,20,16,12,8] [14,18,10]
{ "name": "minimumAddedInteger", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Two Pointers', 'Sorting', 'Enumeration']
3,133
Minimum Array End
minimum-array-end
<p>You are given two integers <code>n</code> and <code>x</code>. You have to construct an array of <strong>positive</strong> integers <code>nums</code> of size <code>n</code> where for every <code>0 &lt;= i &lt; n - 1</code>, <code>nums[i + 1]</code> is <strong>greater than</strong> <code>nums[i]</code>, and the result...
Medium
105K
189K
104,995
189,031
55.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minEnd(int n, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minEnd(int n, int x) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ...
3 4
{ "name": "minEnd", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "x" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Bit Manipulation']
3,134
Find the Median of the Uniqueness Array
find-the-median-of-the-uniqueness-array
<p>You are given an integer array <code>nums</code>. The <strong>uniqueness array</strong> of <code>nums</code> is the sorted array that contains the number of distinct elements of all the <span data-keyword="subarray-nonempty">subarrays</span> of <code>nums</code>. In other words, it is a sorted array consisting of <c...
Hard
7.1K
25.7K
7,115
25,682
27.7%
['find-k-th-smallest-pair-distance', 'total-appeal-of-a-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int medianOfUniquenessArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int medianOfUniquenessArray(int[] nums) {\n \n }\n}"}, {"value": "python", "te...
[1,2,3]
{ "name": "medianOfUniquenessArray", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Binary Search', 'Sliding Window']
3,135
Equalize Strings by Adding or Removing Characters at Ends
equalize-strings-by-adding-or-removing-characters-at-ends
null
Medium
1.1K
1.9K
1,069
1,942
55.0%
[]
[]
Algorithms
null
"abcde" "cdef"
{ "name": "minOperations", "params": [ { "name": "initial", "type": "string" }, { "type": "string", "name": "target" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Binary Search', 'Dynamic Programming', 'Sliding Window', 'Hash Function']
3,136
Valid Word
valid-word
<p>A word is considered <strong>valid</strong> if:</p> <ul> <li>It contains a <strong>minimum</strong> of 3 characters.</li> <li>It contains only digits (0-9), and English letters (uppercase and lowercase).</li> <li>It includes <strong>at least</strong> one <strong>vowel</strong>.</li> <li>It includes <strong>at l...
Easy
50.8K
132K
50,753
132,032
38.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isValid(string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isValid(String word) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "c...
"234Adas"
{ "name": "isValid", "params": [ { "name": "word", "type": "string" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
3,137
Minimum Number of Operations to Make Word K-Periodic
minimum-number-of-operations-to-make-word-k-periodic
<p>You are given a string <code>word</code> of size <code>n</code>, and an integer <code>k</code> such that <code>k</code> divides <code>n</code>.</p> <p>In one operation, you can pick any two indices <code>i</code> and <code>j</code>, that are divisible by <code>k</code>, then replace the <span data-keyword="substrin...
Medium
26K
43.7K
26,001
43,691
59.5%
['maximum-repeating-substring']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumOperationsToMakeKPeriodic(string word, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumOperationsToMakeKPeriodic(String word, int k) {\n \n }\n}...
"leetcodeleet" 4
{ "name": "minimumOperationsToMakeKPeriodic", "params": [ { "name": "word", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Counting']
3,138
Minimum Length of Anagram Concatenation
minimum-length-of-anagram-concatenation
<p>You are given a string <code>s</code>, which is known to be a concatenation of <strong>anagrams</strong> of some string <code>t</code>.</p> <p>Return the <strong>minimum</strong> possible length of the string <code>t</code>.</p> <p>An <strong>anagram</strong> is formed by rearranging the letters of a string. For e...
Medium
30.4K
74.9K
30,352
74,881
40.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minAnagramLength(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minAnagramLength(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo...
"abba"
{ "name": "minAnagramLength", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Counting']
3,139
Minimum Cost to Equalize Array
minimum-cost-to-equalize-array
<p>You are given an integer array <code>nums</code> and two integers <code>cost1</code> and <code>cost2</code>. You are allowed to perform <strong>either</strong> of the following operations <strong>any</strong> number of times:</p> <ul> <li>Choose an index <code>i</code> from <code>nums</code> and <strong>increase</...
Hard
5.4K
30.5K
5,382
30,544
17.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minCostToEqualizeArray(vector<int>& nums, int cost1, int cost2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minCostToEqualizeArray(int[] nums, int cost1, int cost2) {\n ...
[4,1] 5 2
{ "name": "minCostToEqualizeArray", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "cost1" }, { "type": "integer", "name": "cost2" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Enumeration']
3,140
Consecutive Available Seats II
consecutive-available-seats-ii
null
Medium
1.8K
3.1K
1,779
3,090
57.6%
[]
['CREATE TABLE if Not exists Cinema (\n seat_id INT PRIMARY KEY AUTO_INCREMENT,\n free BOOLEAN\n)\n', 'Truncate table Cinema', "insert into Cinema (seat_id, free) values ('1', '1')", "insert into Cinema (seat_id, free) values ('2', '0')", "insert into Cinema (seat_id, free) values ('3', '1')", "insert into Cinema...
Database
null
{"headers":{"Cinema":["seat_id","free"]},"rows":{"Cinema":[[1,1],[2,0],[3,1],[4,1],[5,1]]}}
{"mysql": ["CREATE TABLE if Not exists Cinema (\n seat_id INT PRIMARY KEY AUTO_INCREMENT,\n free BOOLEAN\n)\n"], "mssql": ["Create table Cinema (seat_id int primary key, free BIT)\n"], "oraclesql": ["CREATE TABLE Cinema (\n seat_id INT PRIMARY KEY,\n free NUMBER(1,0)\n)\n"], "database": true, "name": "conse...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,141
Maximum Hamming Distances
maximum-hamming-distances
null
Hard
519
1.1K
519
1,110
46.8%
[]
[]
Algorithms
null
[9,12,9,11] 4
{ "name": "maxHammingDistances", "params": [ { "name": "nums", "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', 'Bit Manipulation', 'Breadth-First Search']
3,142
Check if Grid Satisfies Conditions
check-if-grid-satisfies-conditions
<p>You are given a 2D matrix <code>grid</code> of size <code>m x n</code>. You need to check if each cell <code>grid[i][j]</code> is:</p> <ul> <li>Equal to the cell below it, i.e. <code>grid[i][j] == grid[i + 1][j]</code> (if it exists).</li> <li>Different from the cell to its right, i.e. <code>grid[i][j] != grid[i]...
Easy
37.8K
87.3K
37,768
87,255
43.3%
['candy', 'distribute-candies', 'minimum-cost-of-buying-candies-with-discount']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool satisfiesConditions(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean satisfiesConditions(int[][] grid) {\n \n }\n}"}, {"value": "pytho...
[[1,0,2],[1,0,2]]
{ "name": "satisfiesConditions", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Matrix']
3,143
Maximum Points Inside the Square
maximum-points-inside-the-square
<p>You are given a 2D<strong> </strong>array <code>points</code> and a string <code>s</code> where, <code>points[i]</code> represents the coordinates of point <code>i</code>, and <code>s[i]</code> represents the <strong>tag</strong> of point <code>i</code>.</p> <p>A <strong>valid</strong> square is a square centered a...
Medium
19K
50.2K
19,031
50,210
37.9%
['maximize-the-distance-between-points-on-a-square']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxPointsInsideSquare(vector<vector<int>>& points, string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxPointsInsideSquare(int[][] points, String s) {\n \n }...
[[2,2],[-1,-2],[-4,4],[-3,1],[3,-3]] "abdca"
{ "name": "maxPointsInsideSquare", "params": [ { "name": "points", "type": "integer[][]" }, { "type": "string", "name": "s" } ], "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', 'String', 'Binary Search', 'Sorting']
3,144
Minimum Substring Partition of Equal Character Frequency
minimum-substring-partition-of-equal-character-frequency
<p>Given a string <code>s</code>, you need to partition it into one or more <strong>balanced</strong> <span data-keyword="substring">substrings</span>. For example, if <code>s == &quot;ababcc&quot;</code> then <code>(&quot;abab&quot;, &quot;c&quot;, &quot;c&quot;)</code>, <code>(&quot;ab&quot;, &quot;abc&quot;, &quot;c...
Medium
15.5K
40K
15,485
39,953
38.8%
['partition-array-for-maximum-sum', 'partition-string-into-minimum-beautiful-substrings']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumSubstringsInPartition(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumSubstringsInPartition(String s) {\n \n }\n}"}, {"value": "python", "tex...
"fabccddg"
{ "name": "minimumSubstringsInPartition", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Dynamic Programming', 'Counting']
3,145
Find Products of Elements of Big Array
find-products-of-elements-of-big-array
<p>The <strong>powerful array</strong> of a non-negative integer <code>x</code> is defined as the shortest sorted array of powers of two that sum up to <code>x</code>. The table below illustrates examples of how the <strong>powerful array</strong> is determined. It can be proven that the powerful array of <code>x</code...
Hard
2.4K
11.2K
2,403
11,191
21.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findProductsOfElements(vector<vector<long long>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findProductsOfElements(long[][] queries) {\n \n ...
[[1,3,7]]
{ "name": "findProductsOfElements", "params": [ { "name": "queries", "type": "long[][]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Bit Manipulation']
3,146
Permutation Difference between Two Strings
permutation-difference-between-two-strings
<p>You are given two strings <code>s</code> and <code>t</code> such that every character occurs at most once in <code>s</code> and <code>t</code> is a permutation of <code>s</code>.</p> <p>The <strong>permutation difference</strong> between <code>s</code> and <code>t</code> is defined as the <strong>sum</strong> of th...
Easy
88.9K
102.1K
88,926
102,145
87.1%
['find-the-difference']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findPermutationDifference(string s, string t) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findPermutationDifference(String s, String t) {\n \n }\n}"}, {"value": ...
"abc" "bac"
{ "name": "findPermutationDifference", "params": [ { "name": "s", "type": "string" }, { "type": "string", "name": "t" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String']
3,147
Taking Maximum Energy From the Mystic Dungeon
taking-maximum-energy-from-the-mystic-dungeon
<p>In a mystic dungeon, <code>n</code> magicians are standing in a line. Each magician has an attribute that gives you energy. Some magicians can give you negative energy, which means taking energy from you.</p> <p>You have been cursed in such a way that after absorbing energy from magician <code>i</code>, you will be...
Medium
31.7K
77.6K
31,726
77,614
40.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumEnergy(vector<int>& energy, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumEnergy(int[] energy, int k) {\n \n }\n}"}, {"value": "python", "text...
[5,2,-10,-5,1] 3
{ "name": "maximumEnergy", "params": [ { "name": "energy", "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', 'Prefix Sum']
3,148
Maximum Difference Score in a Grid
maximum-difference-score-in-a-grid
<p>You are given an <code>m x n</code> matrix <code>grid</code> consisting of <strong>positive</strong> integers. You can move from a cell in the matrix to <strong>any</strong> other cell that is either to the bottom or to the right (not necessarily adjacent). The score of a move from a cell with the value <code>c1</co...
Medium
20.1K
43.3K
20,119
43,274
46.5%
['maximum-score-from-grid-operations']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxScore(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxScore(List<List<Integer>> grid) {\n \n }\n}"}, {"value": "python", "text": "Py...
[[9,5,7,3],[8,9,6,1],[6,7,14,3],[2,5,3,1]]
{ "name": "maxScore", "params": [ { "name": "grid", "type": "list<list<integer>>" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Matrix']
3,149
Find the Minimum Cost Array Permutation
find-the-minimum-cost-array-permutation
<p>You are given an array <code>nums</code> which is a <span data-keyword="permutation">permutation</span> of <code>[0, 1, 2, ..., n - 1]</code>. The <strong>score</strong> of any permutation of <code>[0, 1, 2, ..., n - 1]</code> named <code>perm</code> is defined as:</p> <p><code>score(perm) = |perm[0] - nums[perm[1]...
Hard
5.4K
23.5K
5,373
23,460
22.9%
['shortest-path-visiting-all-nodes', 'find-the-shortest-superstring']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findPermutation(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findPermutation(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "...
[1,0,2]
{ "name": "findPermutation", "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', 'Bit Manipulation', 'Bitmask']
3,150
Invalid Tweets II
invalid-tweets-ii
null
Easy
2.6K
3K
2,622
3,024
86.7%
[]
['Create table If Not Exists Tweets(tweet_id int, content varchar(500))', 'Truncate table Tweets', "insert into Tweets (tweet_id, content) values ('1', 'What an amazing meal @MaxPower @AlexJones @JohnDoe #Learning #Fitness #Love')", "insert into Tweets (tweet_id, content) values ('2', 'Learning something new every day ...
Database
null
{"headers": {"Tweets": ["tweet_id", "content"]}, "rows": {"Tweets": [[1, "What an amazing meal @MaxPower @AlexJones @JohnDoe #Learning #Fitness #Love"], [2, "Learning something new every day @AnnaWilson #Learning #Foodie"], [3, "Never been happier about today's achievements @SaraJohnson @JohnDoe @AnnaWilson #Fashion"],...
{"mysql": ["Create table If Not Exists Tweets(tweet_id int, content varchar(500))"], "mssql": ["Create table Tweets(tweet_id int, content varchar(500))"], "oraclesql": ["Create table Tweets(tweet_id int, content varchar(500))"], "database": true, "name": "find_invalid_tweets", "pythondata": ["Tweets = pd.DataFrame([], ...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,151
Special Array I
special-array-i
<p>An array is considered <strong>special</strong> if the <em>parity</em> of every pair of adjacent elements is different. In other words, one element in each pair <strong>must</strong> be even, and the other <strong>must</strong> be odd.</p> <p>You are given an array of integers <code>nums</code>. Return <code>true</...
Easy
234.6K
286.6K
234,582
286,648
81.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isArraySpecial(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isArraySpecial(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python"...
[1]
{ "name": "isArraySpecial", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array']
3,152
Special Array II
special-array-ii
<p>An array is considered <strong>special</strong> if every pair of its adjacent elements contains two numbers with different parity.</p> <p>You are given an array of integer <code>nums</code> and a 2D integer matrix <code>queries</code>, where for <code>queries[i] = [from<sub>i</sub>, to<sub>i</sub>]</code> your task...
Medium
132.5K
290.2K
132,521
290,166
45.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> isArraySpecial(vector<int>& nums, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean[] isArraySpecial(int[] nums, int[][] queries) {\n ...
[3,4,1,2,6] [[0,4]]
{ "name": "isArraySpecial", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[][]", "name": "queries" } ], "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', 'Binary Search', 'Prefix Sum']
3,153
Sum of Digit Differences of All Pairs
sum-of-digit-differences-of-all-pairs
<p>You are given an array <code>nums</code> consisting of <strong>positive</strong> integers where all integers have the <strong>same</strong> number of digits.</p> <p>The <strong>digit difference</strong> between two integers is the <em>count</em> of different digits that are in the <strong>same</strong> position in ...
Medium
26K
61.5K
26,027
61,494
42.3%
['total-hamming-distance']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long sumDigitDifferences(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long sumDigitDifferences(int[] nums) {\n \n }\n}"}, {"value": "python", "tex...
[13,23,12]
{ "name": "sumDigitDifferences", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Math', 'Counting']
3,154
Find Number of Ways to Reach the K-th Stair
find-number-of-ways-to-reach-the-k-th-stair
<p>You are given a <strong>non-negative</strong> integer <code>k</code>. There exists a staircase with an infinite number of stairs, with the <strong>lowest</strong> stair numbered 0.</p> <p>Alice has an integer <code>jump</code>, with an initial value of 0. She starts on stair 1 and wants to reach stair <code>k</code...
Hard
13.2K
36.8K
13,185
36,808
35.8%
['climbing-stairs', 'min-cost-climbing-stairs']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int waysToReachStair(int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int waysToReachStair(int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
0
{ "name": "waysToReachStair", "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', 'Dynamic Programming', 'Bit Manipulation', 'Memoization', 'Combinatorics']
3,155
Maximum Number of Upgradable Servers
maximum-number-of-upgradable-servers
null
Medium
2.3K
5.6K
2,274
5,648
40.3%
[]
[]
Algorithms
null
[4,3] [3,5] [4,2] [8,9]
{ "name": "maxUpgrades", "params": [ { "name": "count", "type": "integer[]" }, { "type": "integer[]", "name": "upgrade" }, { "type": "integer[]", "name": "sell" }, { "type": "integer[]", "name": "money" } ], "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', 'Math', 'Binary Search']
3,156
Employee Task Duration and Concurrent Tasks
employee-task-duration-and-concurrent-tasks
null
Hard
1K
2.3K
1,024
2,259
45.3%
[]
['CREATE TABLE if Not exists Tasks (\n task_id INT ,\n employee_id INT,\n start_time DATETIME,\n end_time DATETIME\n);', 'Truncate table Tasks', "insert into Tasks (task_id, employee_id, start_time, end_time) values ('1', '1001', '2023-05-01 08:00:00', '2023-05-01 09:00:00')", "insert into Tasks (task_id, ...
Database
null
{"headers":{"Tasks":["task_id","employee_id","start_time","end_time"]},"rows":{"Tasks":[[1,1001,"2023-05-01 08:00:00","2023-05-01 09:00:00"],[2,1001,"2023-05-01 08:30:00","2023-05-01 10:30:00"],[3,1001,"2023-05-01 11:00:00","2023-05-01 12:00:00"],[7,1001,"2023-05-01 13:00:00","2023-05-01 15:30:00"],[4,1002,"2023-05-01 ...
{"mysql": ["CREATE TABLE if Not exists Tasks (\n task_id INT ,\n employee_id INT,\n start_time DATETIME,\n end_time DATETIME\n);"], "mssql": ["CREATE TABLE Tasks (\n task_id INT PRIMARY KEY,\n employee_id INT,\n start_time DATETIME,\n end_time DATETIME\n);\n"], "oraclesql": ["CREATE TABLE Tasks...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,157
Find the Level of Tree with Minimum Sum
find-the-level-of-tree-with-minimum-sum
null
Medium
2.3K
3.3K
2,286
3,332
68.6%
['kth-largest-sum-in-a-binary-tree']
[]
Algorithms
null
[50,6,2,30,80,7]
{ "name": "minimumLevel", "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']
3,158
Find the XOR of Numbers Which Appear Twice
find-the-xor-of-numbers-which-appear-twice
<p>You are given an array <code>nums</code>, where each number in the array appears <strong>either</strong><em> </em>once<em> </em>or<em> </em>twice.</p> <p>Return the bitwise<em> </em><code>XOR</code> of all the numbers that appear twice in the array, or 0 if no number appears twice.</p> <p>&nbsp;</p> <p><strong cla...
Easy
59.1K
74.3K
59,094
74,309
79.5%
['single-number', 'single-number-ii', 'single-number-iii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int duplicateNumbersXOR(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int duplicateNumbersXOR(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Py...
[1,2,1,3]
{ "name": "duplicateNumbersXOR", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Bit Manipulation']
3,159
Find Occurrences of an Element in an Array
find-occurrences-of-an-element-in-an-array
<p>You are given an integer array <code>nums</code>, an integer array <code>queries</code>, and an integer <code>x</code>.</p> <p>For each <code>queries[i]</code>, you need to find the index of the <code>queries[i]<sup>th</sup></code> occurrence of <code>x</code> in the <code>nums</code> array. If there are fewer than...
Medium
44.4K
61.4K
44,421
61,424
72.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> occurrencesOfElement(vector<int>& nums, vector<int>& queries, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] occurrencesOfElement(int[] nums, int[] queries, ...
[1,3,1,7] [1,3,2,4] 1
{ "name": "occurrencesOfElement", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[]", "name": "queries" }, { "type": "integer", "name": "x" } ], "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']
3,160
Find the Number of Distinct Colors Among the Balls
find-the-number-of-distinct-colors-among-the-balls
<p>You are given an integer <code>limit</code> and a 2D array <code>queries</code> of size <code>n x 2</code>.</p> <p>There are <code>limit + 1</code> balls with <strong>distinct</strong> labels in the range <code>[0, limit]</code>. Initially, all balls are uncolored. For every query in <code>queries</code> that is of...
Medium
163.3K
301.3K
163,312
301,261
54.2%
['maximum-number-of-balls-in-a-box']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> queryResults(int limit, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] queryResults(int limit, int[][] queries) {\n \n }\n}"...
4 [[1,4],[2,5],[1,3],[3,4]]
{ "name": "queryResults", "params": [ { "name": "limit", "type": "integer" }, { "type": "integer[][]", "name": "queries" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Simulation']
3,161
Block Placement Queries
block-placement-queries
<p>There exists an infinite number line, with its origin at 0 and extending towards the <strong>positive</strong> x-axis.</p> <p>You are given a 2D array <code>queries</code>, which contains two types of queries:</p> <ol> <li>For a query of type 1, <code>queries[i] = [1, x]</code>. Build an obstacle at distance <cod...
Hard
8.4K
52.1K
8,379
52,080
16.1%
['building-boxes', 'fruits-into-baskets-iii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> getResults(vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Boolean> getResults(int[][] queries) {\n \n }\n}"}, {"value": "pyt...
[[1,2],[2,3,3],[2,3,1],[2,2,2]]
{ "name": "getResults", "params": [ { "name": "queries", "type": "integer[][]" } ], "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...
['Array', 'Binary Search', 'Binary Indexed Tree', 'Segment Tree']
3,162
Find the Number of Good Pairs I
find-the-number-of-good-pairs-i
<p>You are given 2 integer arrays <code>nums1</code> and <code>nums2</code> of lengths <code>n</code> and <code>m</code> respectively. You are also given a <strong>positive</strong> integer <code>k</code>.</p> <p>A pair <code>(i, j)</code> is called <strong>good</strong> if <code>nums1[i]</code> is divisible by <code>...
Easy
79K
92.4K
78,953
92,369
85.5%
['count-array-pairs-divisible-by-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfPairs(int[] nums1, int[] nums2, int k) {\n \n }\...
[1,3,4] [1,3,4] 1
{ "name": "numberOfPairs", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" }, { "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']
3,163
String Compression III
string-compression-iii
<p>Given a string <code>word</code>, compress it using the following algorithm:</p> <ul> <li>Begin with an empty string <code>comp</code>. While <code>word</code> is <strong>not</strong> empty, use the following operation: <ul> <li>Remove a maximum length prefix of <code>word</code> made of a <em>single character...
Medium
190.1K
279.4K
190,052
279,392
68.0%
['string-compression', 'string-compression-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string compressedString(string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String compressedString(String word) {\n \n }\n}"}, {"value": "python", "text": "Python"...
"abcde"
{ "name": "compressedString", "params": [ { "name": "word", "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']
3,164
Find the Number of Good Pairs II
find-the-number-of-good-pairs-ii
<p>You are given 2 integer arrays <code>nums1</code> and <code>nums2</code> of lengths <code>n</code> and <code>m</code> respectively. You are also given a <strong>positive</strong> integer <code>k</code>.</p> <p>A pair <code>(i, j)</code> is called <strong>good</strong> if <code>nums1[i]</code> is divisible by <code>...
Medium
27.3K
105.3K
27,324
105,291
26.0%
['count-array-pairs-divisible-by-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long numberOfPairs(vector<int>& nums1, vector<int>& nums2, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long numberOfPairs(int[] nums1, int[] nums2, int k) {\n \...
[1,3,4] [1,3,4] 1
{ "name": "numberOfPairs", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" }, { "type": "integer", "name": "k" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table']
3,165
Maximum Sum of Subsequence With Non-adjacent Elements
maximum-sum-of-subsequence-with-non-adjacent-elements
<p>You are given an array <code>nums</code> consisting of integers. You are also given a 2D array <code>queries</code>, where <code>queries[i] = [pos<sub>i</sub>, x<sub>i</sub>]</code>.</p> <p>For query <code>i</code>, we first set <code>nums[pos<sub>i</sub>]</code> equal to <code>x<sub>i</sub></code>, then we calcula...
Hard
6.8K
42.4K
6,759
42,426
15.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumSumSubsequence(vector<int>& nums, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumSumSubsequence(int[] nums, int[][] queries) {\n ...
[3,5,9] [[1,-2],[0,-3]]
{ "name": "maximumSumSubsequence", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[][]", "name": "queries" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Divide and Conquer', 'Dynamic Programming', 'Segment Tree']
3,166
Calculate Parking Fees and Duration
calculate-parking-fees-and-duration
null
Medium
1.7K
3.2K
1,669
3,162
52.8%
[]
['CREATE TABLE If not exists ParkingTransactions (\n lot_id INT,\n car_id INT,\n entry_time DATETIME,\n exit_time DATETIME,\n fee_paid DECIMAL(10, 2)\n)\n', 'Truncate table ParkingTransactions', "insert into ParkingTransactions (lot_id, car_id, entry_time, exit_time, fee_paid) values ('1', '1001', '2023-...
Database
null
{"headers":{"ParkingTransactions":["lot_id","car_id","entry_time","exit_time","fee_paid"]},"rows":{"ParkingTransactions":[[1,1001,"2023-06-01 08:00:00","2023-06-01 10:30:00",5.00],[1,1001,"2023-06-02 11:00:00","2023-06-02 12:45:00",3.00],[2,1001,"2023-06-01 10:45:00","2023-06-01 12:00:00",6.00],[2,1002,"2023-06-01 09:0...
{"mysql": ["CREATE TABLE If not exists ParkingTransactions (\n lot_id INT,\n car_id INT,\n entry_time DATETIME,\n exit_time DATETIME,\n fee_paid DECIMAL(10, 2)\n)\n"], "mssql": ["CREATE TABLE ParkingTransactions (\n lot_id INT,\n car_id INT,\n entry_time DATETIME,\n exit_time DATETIME,\n f...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,167
Better Compression of String
better-compression-of-string
null
Medium
4.6K
6.1K
4,589
6,075
75.5%
['string-compression']
[]
Algorithms
null
"a3c9b2c1"
{ "name": "betterCompression", "params": [ { "name": "compressed", "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', 'Sorting', 'Counting']
3,168
Minimum Number of Chairs in a Waiting Room
minimum-number-of-chairs-in-a-waiting-room
<p>You are given a string <code>s</code>. Simulate events at each second <code>i</code>:</p> <ul> <li>If <code>s[i] == &#39;E&#39;</code>, a person enters the waiting room and takes one of the chairs in it.</li> <li>If <code>s[i] == &#39;L&#39;</code>, a person leaves the waiting room, freeing up a chair.</li> </ul>...
Easy
61.5K
78.2K
61,522
78,183
78.7%
['consecutive-characters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumChairs(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumChairs(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
"EEEEEEE"
{ "name": "minimumChairs", "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', 'Simulation']
3,169
Count Days Without Meetings
count-days-without-meetings
<p>You are given a positive integer <code>days</code> representing the total number of days an employee is available for work (starting from day 1). You are also given a 2D array <code>meetings</code> of size <code>n</code> where, <code>meetings[i] = [start_i, end_i]</code> represents the starting and ending days of me...
Medium
168.5K
352.3K
168,526
352,324
47.8%
['merge-intervals']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countDays(int days, vector<vector<int>>& meetings) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countDays(int days, int[][] meetings) {\n \n }\n}"}, {"value": "py...
10 [[5,7],[1,3],[9,10]]
{ "name": "countDays", "params": [ { "name": "days", "type": "integer" }, { "type": "integer[][]", "name": "meetings" } ], "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']
3,170
Lexicographically Minimum String After Removing Stars
lexicographically-minimum-string-after-removing-stars
<p>You are given a string <code>s</code>. It may contain any number of <code>&#39;*&#39;</code> characters. Your task is to remove all <code>&#39;*&#39;</code> characters.</p> <p>While there is a <code>&#39;*&#39;</code>, do the following operation:</p> <ul> <li>Delete the leftmost <code>&#39;*&#39;</code> and the <...
Medium
28.9K
82K
28,877
82,039
35.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string clearStars(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String clearStars(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
"aaba*"
{ "name": "clearStars", "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...
['Hash Table', 'String', 'Stack', 'Greedy', 'Heap (Priority Queue)']
3,171
Find Subarray With Bitwise OR Closest to K
find-subarray-with-bitwise-or-closest-to-k
<p>You are given an array <code>nums</code> and an integer <code>k</code>. You need to find a <span data-keyword="subarray-nonempty">subarray</span> of <code>nums</code> such that the <strong>absolute difference</strong> between <code>k</code> and the bitwise <code>OR</code> of the subarray elements is as<strong> small...
Hard
13.5K
45.8K
13,483
45,775
29.5%
['minimum-sum-of-values-by-dividing-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumDifference(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumDifference(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "...
[1,2,4,5] 3
{ "name": "minimumDifference", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Bit Manipulation', 'Segment Tree']
3,172
Second Day Verification
second-day-verification
null
Easy
2.4K
3.6K
2,425
3,560
68.1%
[]
['CREATE TABLE If not exists emails (\n email_id INT,\n user_id INT,\n signup_date DATETIME\n);', "CREATE TABLE If not exists texts (\n text_id INT,\n email_id INT,\n signup_action ENUM('Verified', 'Not Verified'),\n action_date DATETIME\n);", 'Truncate table emails', "insert into emails (email_id,...
Database
null
{"headers":{"emails":["email_id","user_id","signup_date"],"texts":["text_id","email_id","signup_action","action_date"]},"rows":{"emails":[[125,7771,"2022-06-14 09:30:00"],[433,1052,"2022-07-09 08:15:00"],[234,7005,"2022-08-20 10:00:00"]],"texts":[[1,125,"Verified","2022-06-15 08:30:00"],[2,433,"Not Verified","2022-07-1...
{"mysql": ["CREATE TABLE If not exists emails (\n email_id INT,\n user_id INT,\n signup_date DATETIME\n);", "CREATE TABLE If not exists texts (\n text_id INT,\n email_id INT,\n signup_action ENUM('Verified', 'Not Verified'),\n action_date DATETIME\n);"], "mssql": ["CREATE TABLE emails (\n email_...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,173
Bitwise OR of Adjacent Elements
bitwise-or-of-adjacent-elements
null
Easy
4.6K
4.8K
4,551
4,777
95.3%
['neighboring-bitwise-xor']
[]
Algorithms
null
[1,3,7,15]
{ "name": "orArray", "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', 'Bit Manipulation']
3,174
Clear Digits
clear-digits
<p>You are given a string <code>s</code>.</p> <p>Your task is to remove <strong>all</strong> digits by doing this operation repeatedly:</p> <ul> <li>Delete the <em>first</em> digit and the <strong>closest</strong> <b>non-digit</b> character to its <em>left</em>.</li> </ul> <p>Return the resulting string after remov...
Easy
239K
289.5K
239,040
289,537
82.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string clearDigits(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String clearDigits(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":...
"abc"
{ "name": "clearDigits", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Stack', 'Simulation']
3,175
Find The First Player to win K Games in a Row
find-the-first-player-to-win-k-games-in-a-row
<p>A competition consists of <code>n</code> players numbered from <code>0</code> to <code>n - 1</code>.</p> <p>You are given an integer array <code>skills</code> of size <code>n</code> and a <strong>positive</strong> integer <code>k</code>, where <code>skills[i]</code> is the skill level of player <code>i</code>. All ...
Medium
33.2K
84.6K
33,243
84,599
39.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findWinningPlayer(vector<int>& skills, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findWinningPlayer(int[] skills, int k) {\n \n }\n}"}, {"value": "python...
[4,2,6,3,9] 2
{ "name": "findWinningPlayer", "params": [ { "name": "skills", "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', 'Simulation']
3,176
Find the Maximum Length of a Good Subsequence I
find-the-maximum-length-of-a-good-subsequence-i
<p>You are given an integer array <code>nums</code> and a <strong>non-negative</strong> integer <code>k</code>. A sequence of integers <code>seq</code> is called <strong>good</strong> if there are <strong>at most</strong> <code>k</code> indices <code>i</code> in the range <code>[0, seq.length - 2]</code> such that <cod...
Medium
20.4K
65.4K
20,413
65,386
31.2%
['longest-increasing-subsequence', 'maximum-length-of-repeated-subarray']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumLength(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumLength(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "...
[1,2,1,1,3] 2
{ "name": "maximumLength", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Dynamic Programming']
3,177
Find the Maximum Length of a Good Subsequence II
find-the-maximum-length-of-a-good-subsequence-ii
<p>You are given an integer array <code>nums</code> and a <strong>non-negative</strong> integer <code>k</code>. A sequence of integers <code>seq</code> is called <strong>good</strong> if there are <strong>at most</strong> <code>k</code> indices <code>i</code> in the range <code>[0, seq.length - 2]</code> such that <cod...
Hard
7.9K
33.5K
7,922
33,483
23.7%
['longest-increasing-subsequence', 'maximum-length-of-repeated-subarray']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumLength(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumLength(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "...
[1,2,1,1,3] 2
{ "name": "maximumLength", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Dynamic Programming']
3,178
Find the Child Who Has the Ball After K Seconds
find-the-child-who-has-the-ball-after-k-seconds
<p>You are given two <strong>positive</strong> integers <code>n</code> and <code>k</code>. There are <code>n</code> children numbered from <code>0</code> to <code>n - 1</code> standing in a queue <em>in order</em> from left to right.</p> <p>Initially, child 0 holds a ball and the direction of passing the ball is towar...
Easy
53.1K
86.4K
53,116
86,413
61.5%
['find-the-losers-of-the-circular-game']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfChild(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfChild(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "default...
3 5
{ "name": "numberOfChild", "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', 'Simulation']
3,179
Find the N-th Value After K Seconds
find-the-n-th-value-after-k-seconds
<p>You are given two integers <code>n</code> and <code>k</code>.</p> <p>Initially, you start with an array <code>a</code> of <code>n</code> integers where <code>a[i] = 1</code> for all <code>0 &lt;= i &lt;= n - 1</code>. After each second, you simultaneously update each element to be the sum of all its preceding eleme...
Medium
41.2K
76.9K
41,181
76,864
53.6%
['left-and-right-sum-differences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int valueAfterKSeconds(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int valueAfterKSeconds(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python"...
4 5
{ "name": "valueAfterKSeconds", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Simulation', 'Combinatorics', 'Prefix Sum']
3,180
Maximum Total Reward Using Operations I
maximum-total-reward-using-operations-i
<p>You are given an integer array <code>rewardValues</code> of length <code>n</code>, representing the values of rewards.</p> <p>Initially, your total reward <code>x</code> is 0, and all indices are <strong>unmarked</strong>. You are allowed to perform the following operation <strong>any</strong> number of times:</p> ...
Medium
27.7K
93K
27,655
93,010
29.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxTotalReward(vector<int>& rewardValues) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxTotalReward(int[] rewardValues) {\n \n }\n}"}, {"value": "python", "text...
[1,1,3,3]
{ "name": "maxTotalReward", "params": [ { "name": "rewardValues", "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']
3,181
Maximum Total Reward Using Operations II
maximum-total-reward-using-operations-ii
<p>You are given an integer array <code>rewardValues</code> of length <code>n</code>, representing the values of rewards.</p> <p>Initially, your total reward <code>x</code> is 0, and all indices are <strong>unmarked</strong>. You are allowed to perform the following operation <strong>any</strong> number of times:</p> ...
Hard
7.5K
36.7K
7,511
36,717
20.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxTotalReward(vector<int>& rewardValues) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxTotalReward(int[] rewardValues) {\n \n }\n}"}, {"value": "python", "text...
[1,1,3,3]
{ "name": "maxTotalReward", "params": [ { "name": "rewardValues", "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', 'Bit Manipulation']
3,182
Find Top Scoring Students
find-top-scoring-students
null
Medium
1.9K
3.8K
1,879
3,759
50.0%
[]
['CREATE TABLE if not exists students (\n student_id INT ,\n name VARCHAR(255),\n major VARCHAR(255)\n)', 'CREATE TABLE if not exists courses (\n course_id INT ,\n name VARCHAR(255),\n credits INT,\n major VARCHAR(255)\n)\n', 'CREATE TABLE if not exists enrollments (\n student_id INT,\n cou...
Database
null
{"headers":{"students":["student_id","name","major"],"courses":["course_id","name","credits","major"],"enrollments":["student_id","course_id","semester","grade"]},"rows":{"students":[[1,"Alice","Computer Science"],[2,"Bob","Computer Science"],[3,"Charlie","Mathematics"],[4,"David","Mathematics"]],"courses":[[101,"Algor...
{"mysql": ["CREATE TABLE if not exists students (\n student_id INT ,\n name VARCHAR(255),\n major VARCHAR(255)\n)", "CREATE TABLE if not exists courses (\n course_id INT ,\n name VARCHAR(255),\n credits INT,\n major VARCHAR(255)\n)\n", "CREATE TABLE if not exists enrollments (\n student_id INT...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,183
The Number of Ways to Make the Sum
the-number-of-ways-to-make-the-sum
null
Medium
1.3K
2.4K
1,266
2,423
52.2%
['combination-sum', 'climbing-stairs', 'coin-change-ii']
[]
Algorithms
null
4
{ "name": "numberOfWays", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
3,184
Count Pairs That Form a Complete Day I
count-pairs-that-form-a-complete-day-i
<p>Given an integer array <code>hours</code> representing times in <strong>hours</strong>, return an integer denoting the number of pairs <code>i</code>, <code>j</code> where <code>i &lt; j</code> and <code>hours[i] + hours[j]</code> forms a <strong>complete day</strong>.</p> <p>A <strong>complete day</strong> is defi...
Easy
66.7K
86.2K
66,709
86,197
77.4%
['check-if-array-pairs-are-divisible-by-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countCompleteDayPairs(vector<int>& hours) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countCompleteDayPairs(int[] hours) {\n \n }\n}"}, {"value": "python", "text...
[12,12,30,24,24]
{ "name": "countCompleteDayPairs", "params": [ { "name": "hours", "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', 'Counting']
3,185
Count Pairs That Form a Complete Day II
count-pairs-that-form-a-complete-day-ii
<p>Given an integer array <code>hours</code> representing times in <strong>hours</strong>, return an integer denoting the number of pairs <code>i</code>, <code>j</code> where <code>i &lt; j</code> and <code>hours[i] + hours[j]</code> forms a <strong>complete day</strong>.</p> <p>A <strong>complete day</strong> is defi...
Medium
44K
102.6K
43,956
102,552
42.9%
['pairs-of-songs-with-total-durations-divisible-by-60', 'check-if-array-pairs-are-divisible-by-k']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countCompleteDayPairs(vector<int>& hours) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countCompleteDayPairs(int[] hours) {\n \n }\n}"}, {"value": "python"...
[12,12,30,24,24]
{ "name": "countCompleteDayPairs", "params": [ { "name": "hours", "type": "integer[]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Counting']
3,186
Maximum Total Damage With Spell Casting
maximum-total-damage-with-spell-casting
<p>A magician has various spells.</p> <p>You are given an array <code>power</code>, where each element represents the damage of a spell. Multiple spells can have the same damage value.</p> <p>It is a known fact that if a magician decides to cast a spell with a damage of <code>power[i]</code>, they <strong>cannot</str...
Medium
28.5K
103.9K
28,507
103,887
27.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumTotalDamage(vector<int>& power) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumTotalDamage(int[] power) {\n \n }\n}"}, {"value": "python", "tex...
[1,1,3,4]
{ "name": "maximumTotalDamage", "params": [ { "name": "power", "type": "integer[]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Two Pointers', 'Binary Search', 'Dynamic Programming', 'Sorting', 'Counting']
3,187
Peaks in Array
peaks-in-array
<p>A <strong>peak</strong> in an array <code>arr</code> is an element that is <strong>greater</strong> than its previous and next element in <code>arr</code>.</p> <p>You are given an integer array <code>nums</code> and a 2D integer array <code>queries</code>.</p> <p>You have to process queries of two types:</p> <ul>...
Hard
10.1K
38.8K
10,066
38,824
25.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> countOfPeaks(vector<int>& nums, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> countOfPeaks(int[] nums, int[][] queries) {\n ...
[3,1,4,2,5] [[2,3,4],[1,0,4]]
{ "name": "countOfPeaks", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[][]", "name": "queries" } ], "return": { "type": "list<integer>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Indexed Tree', 'Segment Tree']
3,188
Find Top Scoring Students II
find-top-scoring-students-ii
null
Hard
1.5K
4K
1,533
4,000
38.3%
[]
['CREATE TABLE if not exists students (\n student_id INT ,\n name VARCHAR(255),\n major VARCHAR(255)\n)', "CREATE TABLE if not exists courses (\n course_id INT ,\n name VARCHAR(255),\n credits INT,\n major VARCHAR(255),\n mandatory ENUM('yes', 'no') DEFAULT 'no'\n)", 'CREATE TABLE if not exists...
Database
null
{"headers":{"students":["student_id","name","major"],"courses":["course_id","name","credits","major","mandatory"],"enrollments":["student_id","course_id","semester","grade","GPA"]},"rows":{"students":[[1,"Alice","Computer Science"],[2,"Bob","Computer Science"],[3,"Charlie","Mathematics"],[4,"David","Mathematics"]],"cou...
{"mysql": ["CREATE TABLE if not exists students (\n student_id INT ,\n name VARCHAR(255),\n major VARCHAR(255)\n)", "CREATE TABLE if not exists courses (\n course_id INT ,\n name VARCHAR(255),\n credits INT,\n major VARCHAR(255),\n mandatory ENUM('yes', 'no') DEFAULT 'no'\n)", "CREATE TABLE if ...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,189
Minimum Moves to Get a Peaceful Board
minimum-moves-to-get-a-peaceful-board
null
Medium
4.5K
5.9K
4,459
5,861
76.1%
['transform-to-chessboard', 'most-stones-removed-with-same-row-or-column']
[]
Algorithms
null
[[0,0],[1,0],[1,1]]
{ "name": "minMoves", "params": [ { "name": "rooks", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting', 'Counting Sort']
3,190
Find Minimum Operations to Make All Elements Divisible by Three
find-minimum-operations-to-make-all-elements-divisible-by-three
<p>You are given an integer array <code>nums</code>. In one operation, you can add or subtract 1 from <strong>any</strong> element of <code>nums</code>.</p> <p>Return the <strong>minimum</strong> number of operations to make all elements of <code>nums</code> divisible by 3.</p> <p>&nbsp;</p> <p><strong class="example...
Easy
119.5K
134.8K
119,482
134,754
88.7%
['minimum-moves-to-equal-array-elements']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumOperations(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumOperations(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python...
[1,2,3,4]
{ "name": "minimumOperations", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math']
3,191
Minimum Operations to Make Binary Array Elements Equal to One I
minimum-operations-to-make-binary-array-elements-equal-to-one-i
<p>You are given a <span data-keyword="binary-array">binary array</span> <code>nums</code>.</p> <p>You can do the following operation on the array <strong>any</strong> number of times (possibly zero):</p> <ul> <li>Choose <strong>any</strong> 3 <strong>consecutive</strong> elements from the array and <strong>flip</st...
Medium
191K
237.2K
191,009
237,223
80.5%
['minimum-number-of-k-consecutive-bit-flips']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[0,1,1,1,0,0]
{ "name": "minOperations", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Bit Manipulation', 'Queue', 'Sliding Window', 'Prefix Sum']
3,192
Minimum Operations to Make Binary Array Elements Equal to One II
minimum-operations-to-make-binary-array-elements-equal-to-one-ii
<p>You are given a <span data-keyword="binary-array">binary array</span> <code>nums</code>.</p> <p>You can do the following operation on the array <strong>any</strong> number of times (possibly zero):</p> <ul> <li>Choose <strong>any</strong> index <code>i</code> from the array and <strong>flip</strong> <strong>all</...
Medium
39.2K
61.5K
39,226
61,513
63.8%
['minimum-suffix-flips']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[0,1,1,0,1]
{ "name": "minOperations", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Greedy']
3,193
Count the Number of Inversions
count-the-number-of-inversions
<p>You are given an integer <code>n</code> and a 2D array <code>requirements</code>, where <code>requirements[i] = [end<sub>i</sub>, cnt<sub>i</sub>]</code> represents the end index and the <strong>inversion</strong> count of each requirement.</p> <p>A pair of indices <code>(i, j)</code> from an integer array <code>nu...
Hard
7.7K
23.6K
7,656
23,586
32.5%
['k-inverse-pairs-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfPermutations(int n, vector<vector<int>>& requirements) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfPermutations(int n, int[][] requirements) {\n \n ...
3 [[2,2],[0,0]]
{ "name": "numberOfPermutations", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "requirements" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
3,194
Minimum Average of Smallest and Largest Elements
minimum-average-of-smallest-and-largest-elements
<p>You have an array of floating point numbers <code>averages</code> which is initially empty. You are given an array <code>nums</code> of <code>n</code> integers where <code>n</code> is even.</p> <p>You repeat the following procedure <code>n / 2</code> times:</p> <ul> <li>Remove the <strong>smallest</strong> elemen...
Easy
85.8K
101.3K
85,763
101,298
84.7%
['number-of-distinct-averages']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double minimumAverage(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double minimumAverage(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python...
[7,8,3,4,15,13,4,1]
{ "name": "minimumAverage", "params": [ { "name": "nums", "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', 'Two Pointers', 'Sorting']
3,195
Find the Minimum Area to Cover All Ones I
find-the-minimum-area-to-cover-all-ones-i
<p>You are given a 2D <strong>binary</strong> array <code>grid</code>. Find a rectangle with horizontal and vertical sides with the<strong> smallest</strong> area, such that all the 1&#39;s in <code>grid</code> lie inside this rectangle.</p> <p>Return the <strong>minimum</strong> possible area of the rectangle.</p> <...
Medium
43.1K
60.6K
43,061
60,570
71.1%
['smallest-rectangle-enclosing-black-pixels']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumArea(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumArea(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python",...
[[0,1,0],[1,0,1]]
{ "name": "minimumArea", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Matrix']
3,196
Maximize Total Cost of Alternating Subarrays
maximize-total-cost-of-alternating-subarrays
<p>You are given an integer array <code>nums</code> with length <code>n</code>.</p> <p>The <strong>cost</strong> of a <span data-keyword="subarray-nonempty">subarray</span> <code>nums[l..r]</code>, where <code>0 &lt;= l &lt;= r &lt; n</code>, is defined as:</p> <p><code>cost(l, r) = nums[l] - nums[l + 1] + ... + nums...
Medium
23.2K
81.4K
23,189
81,421
28.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumTotalCost(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumTotalCost(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "P...
[1,-2,3,4]
{ "name": "maximumTotalCost", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
3,197
Find the Minimum Area to Cover All Ones II
find-the-minimum-area-to-cover-all-ones-ii
<p>You are given a 2D <strong>binary</strong> array <code>grid</code>. You need to find 3 <strong>non-overlapping</strong> rectangles having <strong>non-zero</strong> areas with horizontal and vertical sides such that all the 1&#39;s in <code>grid</code> lie inside these rectangles.</p> <p>Return the <strong>minimum</...
Hard
5.2K
14.5K
5,160
14,456
35.7%
['smallest-rectangle-enclosing-black-pixels']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumSum(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumSum(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[[1,0,1],[1,1,1]]
{ "name": "minimumSum", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Matrix', 'Enumeration']
3,198
Find Cities in Each State
find-cities-in-each-state
null
Easy
2.4K
2.9K
2,397
2,887
83.0%
[]
['Create table if not exists cities( state varchar(100),city varchar(100))', 'Truncate table cities', "insert into cities (state, city) values ('California', 'Los Angeles')", "insert into cities (state, city) values ('California', 'San Francisco')", "insert into cities (state, city) values ('California', 'San Diego')",...
Database
null
{"headers":{"cities":["state","city"]},"rows":{"cities":[["California","Los Angeles"],["California","San Francisco"],["California","San Diego"],["Texas","Houston"],["Texas","Austin"],["Texas","Dallas"],["New York","New York City"],["New York","Buffalo"],["New York","Rochester"]]}}
{"mysql": ["Create table if not exists cities( state varchar(100),city varchar(100))"], "mssql": ["Create table cities( state varchar(100),city varchar(100))"], "oraclesql": ["Create table cities( state varchar2(100),city varchar2(100))"], "database": true, "name": "find_cities", "postgresql": ["CREATE TABLE IF NOT EX...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,199
Count Triplets with Even XOR Set Bits I
count-triplets-with-even-xor-set-bits-i
null
Easy
1.2K
1.5K
1,222
1,472
83.0%
[]
[]
Algorithms
null
[1] [2] [3]
{ "name": "tripletCount", "params": [ { "name": "a", "type": "integer[]" }, { "type": "integer[]", "name": "b" }, { "type": "integer[]", "name": "c" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Bit Manipulation']
3,200
Maximum Height of a Triangle
maximum-height-of-a-triangle
<p>You are given two integers <code>red</code> and <code>blue</code> representing the count of red and blue colored balls. You have to arrange these balls to form a triangle such that the 1<sup>st</sup> row will have 1 ball, the 2<sup>nd</sup> row will have 2 balls, the 3<sup>rd</sup> row will have 3 balls, and so on.<...
Easy
40.3K
93.8K
40,349
93,764
43.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxHeightOfTriangle(int red, int blue) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxHeightOfTriangle(int red, int blue) {\n \n }\n}"}, {"value": "python", "tex...
2 4
{ "name": "maxHeightOfTriangle", "params": [ { "name": "red", "type": "integer" }, { "type": "integer", "name": "blue" } ], "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', 'Enumeration']
3,201
Find the Maximum Length of Valid Subsequence I
find-the-maximum-length-of-valid-subsequence-i
You are given an integer array <code>nums</code>. <p>A <span data-keyword="subsequence-array">subsequence</span> <code>sub</code> of <code>nums</code> with length <code>x</code> is called <strong>valid</strong> if it satisfies:</p> <ul> <li><code>(sub[0] + sub[1]) % 2 == (sub[1] + sub[2]) % 2 == ... == (sub[x - 2] + ...
Medium
28.3K
75.4K
28,283
75,430
37.5%
['longest-increasing-subsequence', 'length-of-the-longest-subsequence-that-sums-to-target']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumLength(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumLength(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[1,2,3,4]
{ "name": "maximumLength", "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']
3,202
Find the Maximum Length of Valid Subsequence II
find-the-maximum-length-of-valid-subsequence-ii
You are given an integer array <code>nums</code> and a <strong>positive</strong> integer <code>k</code>. <p>A <span data-keyword="subsequence-array">subsequence</span> <code>sub</code> of <code>nums</code> with length <code>x</code> is called <strong>valid</strong> if it satisfies:</p> <ul> <li><code>(sub[0] + sub[1]...
Medium
19.2K
48.7K
19,152
48,703
39.3%
['longest-increasing-subsequence', 'length-of-the-longest-subsequence-that-sums-to-target']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumLength(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumLength(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "...
[1,2,3,4,5] 2
{ "name": "maximumLength", "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']
3,203
Find Minimum Diameter After Merging Two Trees
find-minimum-diameter-after-merging-two-trees
<p>There exist two <strong>undirected </strong>trees with <code>n</code> and <code>m</code> nodes, numbered from <code>0</code> to <code>n - 1</code> and from <code>0</code> to <code>m - 1</code>, respectively. You are given two 2D integer arrays <code>edges1</code> and <code>edges2</code> of lengths <code>n - 1</code>...
Hard
73.4K
127.5K
73,368
127,455
57.6%
['minimum-height-trees', 'tree-diameter', 'maximize-the-number-of-target-nodes-after-connecting-trees-i', 'maximize-the-number-of-target-nodes-after-connecting-trees-ii', 'maximize-sum-of-weights-after-edge-removals']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumDiameterAfterMerge(vector<vector<int>>& edges1, vector<vector<int>>& edges2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumDiameterAfterMerge(int[][] edges1, i...
[[0,1],[0,2],[0,3]] [[0,1]]
{ "name": "minimumDiameterAfterMerge", "params": [ { "name": "edges1", "type": "integer[][]" }, { "type": "integer[][]", "name": "edges2" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Breadth-First Search', 'Graph']
3,204
Bitwise User Permissions Analysis
bitwise-user-permissions-analysis
null
Medium
1.3K
1.4K
1,268
1,356
93.5%
[]
['Create table if not exists user_permissions(user_id int, permissions int)', 'Truncate table user_permissions', "insert into user_permissions (user_id, permissions) values ('1', '5')", "insert into user_permissions (user_id, permissions) values ('2', '12')", "insert into user_permissions (user_id, permissions) values ...
Database
null
{"headers":{"user_permissions":["user_id","permissions"]},"rows":{"user_permissions":[[1,5],[2,12],[3,7],[4,3]]}}
{"mysql": ["Create table if not exists user_permissions(user_id int, permissions int)"], "mssql": ["Create table user_permissions(user_id int, permissions int)"], "oraclesql": ["Create table user_permissions(user_id NUMBER, permissions NUMBER)"], "database": true, "name": "analyze_permissions", "postgresql": ["CREATE T...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
3,205
Maximum Array Hopping Score I
maximum-array-hopping-score-i
null
Medium
1.8K
2.4K
1,831
2,375
77.1%
[]
[]
Algorithms
null
[1,5,8]
{ "name": "maxScore", "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', 'Stack', 'Greedy', 'Monotonic Stack']
3,206
Alternating Groups I
alternating-groups-i
<p>There is a circle of red and blue tiles. You are given an array of integers <code>colors</code>. The color of tile <code>i</code> is represented by <code>colors[i]</code>:</p> <ul> <li><code>colors[i] == 0</code> means that tile <code>i</code> is <strong>red</strong>.</li> <li><code>colors[i] == 1</code> means th...
Easy
61.5K
91.3K
61,501
91,292
67.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfAlternatingGroups(vector<int>& colors) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfAlternatingGroups(int[] colors) {\n \n }\n}"}, {"value": "pyth...
[1,1,1]
{ "name": "numberOfAlternatingGroups", "params": [ { "name": "colors", "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', 'Sliding Window']
3,207
Maximum Points After Enemy Battles
maximum-points-after-enemy-battles
<p>You are given an integer array <code>enemyEnergies</code> denoting the energy values of various enemies.</p> <p>You are also given an integer <code>currentEnergy</code> denoting the amount of energy you have initially.</p> <p>You start with 0 points, and all the enemies are unmarked initially.</p> <p>You can perf...
Medium
27.8K
86.1K
27,844
86,056
32.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumPoints(vector<int>& enemyEnergies, int currentEnergy) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumPoints(int[] enemyEnergies, int currentEnergy) {\n ...
[3,2,2] 2
{ "name": "maximumPoints", "params": [ { "name": "enemyEnergies", "type": "integer[]" }, { "type": "integer", "name": "currentEnergy" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy']
3,208
Alternating Groups II
alternating-groups-ii
<p>There is a circle of red and blue tiles. You are given an array of integers <code>colors</code> and an integer <code>k</code>. The color of tile <code>i</code> is represented by <code>colors[i]</code>:</p> <ul> <li><code>colors[i] == 0</code> means that tile <code>i</code> is <strong>red</strong>.</li> <li><code>...
Medium
149.3K
249.5K
149,254
249,480
59.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfAlternatingGroups(vector<int>& colors, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfAlternatingGroups(int[] colors, int k) {\n \n }\n}"}, {...
[0,1,0,1,0] 3
{ "name": "numberOfAlternatingGroups", "params": [ { "name": "colors", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sliding Window']
3,209
Number of Subarrays With AND Value of K
number-of-subarrays-with-and-value-of-k
<p>Given an array of integers <code>nums</code> and an integer <code>k</code>, return the number of <span data-keyword="subarray-nonempty">subarrays</span> of <code>nums</code> where the bitwise <code>AND</code> of the elements of the subarray equals <code>k</code>.</p> <p>&nbsp;</p> <p><strong class="example">Example...
Hard
12.2K
36.3K
12,207
36,342
33.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countSubarrays(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countSubarrays(int[] nums, int k) {\n \n }\n}"}, {"value": "python", ...
[1,1,1] 1
{ "name": "countSubarrays", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Bit Manipulation', 'Segment Tree']