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
2,203
Minimum Weighted Subgraph With the Required Paths
minimum-weighted-subgraph-with-the-required-paths
<p>You are given an integer <code>n</code> denoting the number of nodes of a <strong>weighted directed</strong> graph. The nodes are numbered from <code>0</code> to <code>n - 1</code>.</p> <p>You are also given a 2D integer array <code>edges</code> where <code>edges[i] = [from<sub>i</sub>, to<sub>i</sub>, weight<sub>i...
Hard
14.8K
39.1K
14,831
39,115
37.9%
['minimum-cost-to-make-at-least-one-valid-path-in-a-grid', 'escape-the-spreading-fire', 'disconnect-path-in-a-binary-matrix-by-at-most-one-flip']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumWeight(int n, vector<vector<int>>& edges, int src1, int src2, int dest) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumWeight(int n, int[][] edges, int s...
6 [[0,2,2],[0,5,6],[1,0,3],[1,4,5],[2,1,1],[2,3,3],[2,3,4],[3,4,2],[4,5,1]] 0 1 5
{ "name": "minimumWeight", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "edges" }, { "type": "integer", "name": "src1" }, { "type": "integer", "name": "src2" }, { "type": "integer", "n...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Graph', 'Shortest Path']
2,204
Distance to a Cycle in Undirected Graph
distance-to-a-cycle-in-undirected-graph
null
Hard
6K
8.3K
6,048
8,314
72.7%
['paths-in-maze-that-lead-to-same-room']
[]
Algorithms
null
7 [[1,2],[2,4],[4,3],[3,1],[0,1],[5,2],[6,5]]
{ "name": "distanceToCycle", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "edges" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Depth-First Search', 'Breadth-First Search', 'Union Find', 'Graph']
2,205
The Number of Users That Are Eligible for Discount
the-number-of-users-that-are-eligible-for-discount
null
Easy
7.3K
14.4K
7,326
14,436
50.7%
['nth-highest-salary', 'the-users-that-are-eligible-for-discount']
['Create table If Not Exists Purchases (user_id int, time_stamp datetime, amount int)', 'Truncate table Purchases', "insert into Purchases (user_id, time_stamp, amount) values ('1', '2022-04-20 09:03:00', '4416')", "insert into Purchases (user_id, time_stamp, amount) values ('2', '2022-03-19 19:24:02', '678')", "insert...
Database
null
{"headers": {"Purchases": ["user_id", "time_stamp", "amount"]}, "startDate": "2022-03-08", "endDate": "2022-03-20", "minAmount": 1000, "rows": {"Purchases": [[1, "2022-04-20 09:03:00", 4416], [2, "2022-03-19 19:24:02", 678], [3, "2022-03-18 12:03:09", 4523], [3, "2022-03-30 09:43:42", 626]]}}
{"mysql": ["Create table If Not Exists Purchases (user_id int, time_stamp datetime, amount int)"], "mssql": ["Create table Purchases (user_id int, time_stamp datetime, amount int)"], "oraclesql": ["Create table Purchases (user_id int, time_stamp date, amount int)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI...
{"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']
2,206
Divide Array Into Equal Pairs
divide-array-into-equal-pairs
<p>You are given an integer array <code>nums</code> consisting of <code>2 * n</code> integers.</p> <p>You need to divide <code>nums</code> into <code>n</code> pairs such that:</p> <ul> <li>Each element belongs to <strong>exactly one</strong> pair.</li> <li>The elements present in a pair are <strong>equal</strong>.<...
Easy
271.5K
342.6K
271,493
342,601
79.2%
['sort-array-by-increasing-frequency', 'distribute-elements-into-two-arrays-i', 'distribute-elements-into-two-arrays-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool divideArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean divideArray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "def...
[3,2,3,2,2,2]
{ "name": "divideArray", "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', 'Hash Table', 'Bit Manipulation', 'Counting']
2,207
Maximize Number of Subsequences in a String
maximize-number-of-subsequences-in-a-string
<p>You are given a <strong>0-indexed</strong> string <code>text</code> and another <strong>0-indexed</strong> string <code>pattern</code> of length <code>2</code>, both of which consist of only lowercase English letters.</p> <p>You can add <strong>either</strong> <code>pattern[0]</code> <strong>or</strong> <code>patte...
Medium
21.8K
62.4K
21,841
62,395
35.0%
['longest-common-subsequence']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumSubsequenceCount(string text, string pattern) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumSubsequenceCount(String text, String pattern) {\n \n ...
"abdcdbc" "ac"
{ "name": "maximumSubsequenceCount", "params": [ { "name": "text", "type": "string" }, { "type": "string", "name": "pattern" } ], "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', 'Prefix Sum']
2,208
Minimum Operations to Halve Array Sum
minimum-operations-to-halve-array-sum
<p>You are given an array <code>nums</code> of positive integers. In one operation, you can choose <strong>any</strong> number from <code>nums</code> and reduce it to <strong>exactly</strong> half the number. (Note that you may choose this reduced number in future operations.)</p> <p>Return<em> the <strong>minimum</st...
Medium
43.8K
89.9K
43,753
89,883
48.7%
['remove-stones-to-minimize-the-total', 'minimum-operations-to-exceed-threshold-value-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int halveArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int halveArray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[5,19,8,1]
{ "name": "halveArray", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Heap (Priority Queue)']
2,209
Minimum White Tiles After Covering With Carpets
minimum-white-tiles-after-covering-with-carpets
<p>You are given a <strong>0-indexed binary</strong> string <code>floor</code>, which represents the colors of tiles on a floor:</p> <ul> <li><code>floor[i] = &#39;0&#39;</code> denotes that the <code>i<sup>th</sup></code> tile of the floor is colored <strong>black</strong>.</li> <li>On the other hand, <code>floor[i...
Hard
14.2K
38.7K
14,215
38,675
36.8%
['edit-distance']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumWhiteTiles(string floor, int numCarpets, int carpetLen) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumWhiteTiles(String floor, int numCarpets, int carpetLen) {...
"10110101" 2 2
{ "name": "minimumWhiteTiles", "params": [ { "name": "floor", "type": "string" }, { "type": "integer", "name": "numCarpets" }, { "type": "integer", "name": "carpetLen" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming', 'Prefix Sum']
2,210
Count Hills and Valleys in an Array
count-hills-and-valleys-in-an-array
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>. An index <code>i</code> is part of a <strong>hill</strong> in <code>nums</code> if the closest non-equal neighbors of <code>i</code> are smaller than <code>nums[i]</code>. Similarly, an index <code>i</code> is part of a <strong>valley</stron...
Easy
58.9K
95.8K
58,910
95,849
61.5%
['find-peak-element', 'monotonic-array', 'minimum-subsequence-in-non-increasing-order']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countHillValley(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countHillValley(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[2,4,1,1,6,5]
{ "name": "countHillValley", "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']
2,211
Count Collisions on a Road
count-collisions-on-a-road
<p>There are <code>n</code> cars on an infinitely long road. The cars are numbered from <code>0</code> to <code>n - 1</code> from left to right and each car is present at a <strong>unique</strong> point.</p> <p>You are given a <strong>0-indexed</strong> string <code>directions</code> of length <code>n</code>. <code>di...
Medium
33.1K
74.9K
33,066
74,888
44.2%
['asteroid-collision', 'car-fleet', 'last-moment-before-all-ants-fall-out-of-a-plank', 'car-fleet-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countCollisions(string directions) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countCollisions(String directions) {\n \n }\n}"}, {"value": "python", "text": "Pyt...
"RLRSLL"
{ "name": "countCollisions", "params": [ { "name": "directions", "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', 'Stack', 'Simulation']
2,212
Maximum Points in an Archery Competition
maximum-points-in-an-archery-competition
<p>Alice and Bob are opponents in an archery competition. The competition has set the following rules:</p> <ol> <li>Alice first shoots <code>numArrows</code> arrows and then Bob shoots <code>numArrows</code> arrows.</li> <li>The points are then calculated as follows: <ol> <li>The target has integer scoring sectio...
Medium
17.3K
34.6K
17,328
34,596
50.1%
['maximum-product-of-the-length-of-two-palindromic-subsequences']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> maximumBobPoints(int numArrows, vector<int>& aliceArrows) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] maximumBobPoints(int numArrows, int[] aliceArrows) {\n ...
9 [1,1,0,1,0,0,2,1,0,1,2,0]
{ "name": "maximumBobPoints", "params": [ { "name": "numArrows", "type": "integer" }, { "type": "integer[]", "name": "aliceArrows" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Backtracking', 'Bit Manipulation', 'Enumeration']
2,213
Longest Substring of One Repeating Character
longest-substring-of-one-repeating-character
<p>You are given a <strong>0-indexed</strong> string <code>s</code>. You are also given a <strong>0-indexed</strong> string <code>queryCharacters</code> of length <code>k</code> and a <strong>0-indexed</strong> array of integer <strong>indices</strong> <code>queryIndices</code> of length <code>k</code>, both of which a...
Hard
5.5K
16.9K
5,538
16,904
32.8%
['merge-intervals', 'longest-repeating-character-replacement', 'consecutive-characters', 'create-sorted-array-through-instructions', 'longest-increasing-subsequence-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> longestRepeating(string s, string queryCharacters, vector<int>& queryIndices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] longestRepeating(String s, String query...
"babacc" "bcb" [1,3,3]
{ "name": "longestRepeating", "params": [ { "name": "s", "type": "string" }, { "type": "string", "name": "queryCharacters" }, { "type": "integer[]", "name": "queryIndices" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'Segment Tree', 'Ordered Set']
2,214
Minimum Health to Beat Game
minimum-health-to-beat-game
null
Medium
38.1K
65.1K
38,117
65,080
58.6%
['dungeon-game', 'eliminate-maximum-number-of-monsters']
[]
Algorithms
null
[2,7,4,3] 4
{ "name": "minimumHealth", "params": [ { "name": "damage", "type": "integer[]" }, { "type": "integer", "name": "armor" } ], "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']
2,215
Find the Difference of Two Arrays
find-the-difference-of-two-arrays
<p>Given two <strong>0-indexed</strong> integer arrays <code>nums1</code> and <code>nums2</code>, return <em>a list</em> <code>answer</code> <em>of size</em> <code>2</code> <em>where:</em></p> <ul> <li><code>answer[0]</code> <em>is a list of all <strong>distinct</strong> integers in</em> <code>nums1</code> <em>which ...
Easy
511.9K
635.2K
511,932
635,169
80.6%
['intersection-of-two-arrays', 'intersection-of-two-arrays-ii', 'intersection-of-multiple-arrays']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> findDifference(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> findDifference(int[] nums1, int[] nums2)...
[1,2,3] [2,4,6]
{ "name": "findDifference", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" } ], "return": { "type": "list<list<integer>>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table']
2,216
Minimum Deletions to Make Array Beautiful
minimum-deletions-to-make-array-beautiful
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>. The array <code>nums</code> is <strong>beautiful</strong> if:</p> <ul> <li><code>nums.length</code> is even.</li> <li><code>nums[i] != nums[i + 1]</code> for all <code>i % 2 == 0</code>.</li> </ul> <p>Note that an empty array is consider...
Medium
35.9K
73.8K
35,931
73,841
48.7%
['minimum-deletions-to-make-character-frequencies-unique', 'minimum-operations-to-make-the-array-alternating']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minDeletion(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minDeletion(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC...
[1,1,2,3,5]
{ "name": "minDeletion", "params": [ { "type": "integer[]", "name": "nums" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Stack', 'Greedy']
2,217
Find Palindrome With Fixed Length
find-palindrome-with-fixed-length
<p>Given an integer array <code>queries</code> and a <strong>positive</strong> integer <code>intLength</code>, return <em>an array</em> <code>answer</code> <em>where</em> <code>answer[i]</code> <em>is either the </em><code>queries[i]<sup>th</sup></code> <em>smallest <strong>positive palindrome</strong> of length</em> <...
Medium
25K
66.9K
24,959
66,892
37.3%
['palindrome-number', 'find-the-closest-palindrome', 'lexicographically-smallest-beautiful-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<long long> kthPalindrome(vector<int>& queries, int intLength) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long[] kthPalindrome(int[] queries, int intLength) {\n \n ...
[1,2,3,4,5,90] 3
{ "name": "kthPalindrome", "params": [ { "name": "queries", "type": "integer[]" }, { "type": "integer", "name": "intLength" } ], "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']
2,218
Maximum Value of K Coins From Piles
maximum-value-of-k-coins-from-piles
<p>There are <code>n</code> <strong>piles</strong> of coins on a table. Each pile consists of a <strong>positive number</strong> of coins of assorted denominations.</p> <p>In one move, you can choose any coin on <strong>top</strong> of any pile, remove it, and add it to your wallet.</p> <p>Given a list <code>piles</c...
Hard
73.8K
122.3K
73,820
122,256
60.4%
['coin-change', 'coin-change-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxValueOfCoins(vector<vector<int>>& piles, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxValueOfCoins(List<List<Integer>> piles, int k) {\n \n }\n}"}, {...
[[1,100,3],[7,8,9]] 2
{ "name": "maxValueOfCoins", "params": [ { "name": "piles", "type": "list<list<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', 'Prefix Sum']
2,219
Maximum Sum Score of Array
maximum-sum-score-of-array
null
Medium
5.1K
8.2K
5,102
8,235
62.0%
['subarray-sum-equals-k', 'find-pivot-index', 'find-the-middle-index-in-array']
[]
Algorithms
null
[4,3,-2,5]
{ "name": "maximumSumScore", "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', 'Prefix Sum']
2,220
Minimum Bit Flips to Convert Number
minimum-bit-flips-to-convert-number
<p>A <strong>bit flip</strong> of a number <code>x</code> is choosing a bit in the binary representation of <code>x</code> and <strong>flipping</strong> it from either <code>0</code> to <code>1</code> or <code>1</code> to <code>0</code>.</p> <ul> <li>For example, for <code>x = 7</code>, the binary representation is <...
Easy
286.2K
327.1K
286,169
327,119
87.5%
['minimum-flips-to-make-a-or-b-equal-to-c', 'minimum-number-of-operations-to-make-array-xor-equal-to-k', 'smallest-number-with-all-set-bits']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minBitFlips(int start, int goal) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minBitFlips(int start, int goal) {\n \n }\n}"}, {"value": "python", "text": "Python"...
10 7
{ "name": "minBitFlips", "params": [ { "name": "start", "type": "integer" }, { "type": "integer", "name": "goal" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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']
2,221
Find Triangular Sum of an Array
find-triangular-sum-of-an-array
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>, where <code>nums[i]</code> is a digit between <code>0</code> and <code>9</code> (<strong>inclusive</strong>).</p> <p>The <strong>triangular sum</strong> of <code>nums</code> is the value of the only element present in <code>nums</code> afte...
Medium
96.9K
123K
96,867
122,980
78.8%
['pascals-triangle-ii', 'calculate-digit-sum-of-a-string', 'min-max-game']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int triangularSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int triangularSum(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[1,2,3,4,5]
{ "name": "triangularSum", "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', 'Simulation', 'Combinatorics']
2,222
Number of Ways to Select Buildings
number-of-ways-to-select-buildings
<p>You are given a <strong>0-indexed</strong> binary string <code>s</code> which represents the types of buildings along a street where:</p> <ul> <li><code>s[i] = &#39;0&#39;</code> denotes that the <code>i<sup>th</sup></code> building is an office and</li> <li><code>s[i] = &#39;1&#39;</code> denotes that the <code>...
Medium
45K
89.2K
44,958
89,168
50.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long numberOfWays(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long numberOfWays(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
"001101"
{ "name": "numberOfWays", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming', 'Prefix Sum']
2,223
Sum of Scores of Built Strings
sum-of-scores-of-built-strings
<p>You are <strong>building</strong> a string <code>s</code> of length <code>n</code> <strong>one</strong> character at a time, <strong>prepending</strong> each new character to the <strong>front</strong> of the string. The strings are labeled from <code>1</code> to <code>n</code>, where the string with length <code>i<...
Hard
10.2K
24.4K
10,178
24,406
41.7%
['longest-happy-prefix']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long sumScores(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long sumScores(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "c...
"babab"
{ "name": "sumScores", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Binary Search', 'Rolling Hash', 'Suffix Array', 'String Matching', 'Hash Function']
2,224
Minimum Number of Operations to Convert Time
minimum-number-of-operations-to-convert-time
<p>You are given two strings <code>current</code> and <code>correct</code> representing two <strong>24-hour times</strong>.</p> <p>24-hour times are formatted as <code>&quot;HH:MM&quot;</code>, where <code>HH</code> is between <code>00</code> and <code>23</code>, and <code>MM</code> is between <code>00</code> and <cod...
Easy
48.5K
74.2K
48,530
74,234
65.4%
['coin-change', 'design-an-atm-machine', 'count-days-spent-together']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int convertTime(string current, string correct) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int convertTime(String current, String correct) {\n \n }\n}"}, {"value": "pyt...
"02:30" "04:35"
{ "name": "convertTime", "params": [ { "name": "current", "type": "string" }, { "type": "string", "name": "correct" } ], "return": { "type": "integer" }, "manual": false }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Greedy']
2,225
Find Players With Zero or One Losses
find-players-with-zero-or-one-losses
<p>You are given an integer array <code>matches</code> where <code>matches[i] = [winner<sub>i</sub>, loser<sub>i</sub>]</code> indicates that the player <code>winner<sub>i</sub></code> defeated player <code>loser<sub>i</sub></code> in a match.</p> <p>Return <em>a list </em><code>answer</code><em> of size </em><code>2<...
Medium
278.4K
383.2K
278,422
383,167
72.7%
['lowest-common-ancestor-of-a-binary-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> findWinners(vector<vector<int>>& matches) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> findWinners(int[][] matches) {\n \n }\n}"},...
[[1,3],[2,3],[3,6],[5,6],[5,7],[4,5],[4,8],[4,9],[10,4],[10,9]]
{ "name": "findWinners", "params": [ { "type": "integer[][]", "name": "matches" } ], "return": { "type": "list<list<integer>>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Sorting', 'Counting']
2,226
Maximum Candies Allocated to K Children
maximum-candies-allocated-to-k-children
<p>You are given a <strong>0-indexed</strong> integer array <code>candies</code>. Each element in the array denotes a pile of candies of size <code>candies[i]</code>. You can divide each pile into any number of <strong>sub piles</strong>, but you <strong>cannot</strong> merge two piles together.</p> <p>You are also gi...
Medium
176.4K
351.5K
176,421
351,451
50.2%
['koko-eating-bananas', 'minimum-limit-of-balls-in-a-bag', 'minimum-speed-to-arrive-on-time', 'maximum-number-of-removable-characters', 'minimized-maximum-of-products-distributed-to-any-store', 'minimum-time-to-complete-trips', 'minimize-maximum-of-array', 'maximize-happiness-of-selected-children']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumCandies(vector<int>& candies, long long k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumCandies(int[] candies, long k) {\n \n }\n}"}, {"value": "pyt...
[5,8,6] 3
{ "name": "maximumCandies", "params": [ { "type": "integer[]", "name": "candies" }, { "type": "long", "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']
2,227
Encrypt and Decrypt Strings
encrypt-and-decrypt-strings
<p>You are given a character array <code>keys</code> containing <strong>unique</strong> characters and a string array <code>values</code> containing strings of length 2. You are also given another string array <code>dictionary</code> that contains all permitted original strings after decryption. You should implement a ...
Hard
14.9K
36.1K
14,904
36,065
41.3%
['implement-trie-prefix-tree', 'word-search-ii', 'implement-trie-ii-prefix-tree', 'find-the-sum-of-encrypted-integers']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Encrypter {\npublic:\n Encrypter(vector<char>& keys, vector<string>& values, vector<string>& dictionary) {\n \n }\n \n string encrypt(string word1) {\n \n }\n \n int decrypt(string word2) {\n \n }\n};\n\n/**\n * Your Enc...
["Encrypter","encrypt","decrypt"] [[["a","b","c","d"],["ei","zf","ei","am"],["abcd","acbd","adbc","badc","dacb","cadb","cbda","abad"]],["abcd"],["eizfeiam"]]
{ "classname": "Encrypter", "constructor": { "params": [ { "name": "keys", "type": "character[]" }, { "type": "string[]", "name": "values" }, { "name": "dictionary", "type": "string[]" } ] }, "methods": [ { "pa...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Design', 'Trie']
2,228
Users With Two Purchases Within Seven Days
users-with-two-purchases-within-seven-days
null
Medium
10.1K
22.1K
10,120
22,057
45.9%
['biggest-window-between-visits']
['Create table If Not Exists Purchases (purchase_id int, user_id int, purchase_date date)', 'Truncate table Purchases', "insert into Purchases (purchase_id, user_id, purchase_date) values ('4', '2', '2022-03-13')", "insert into Purchases (purchase_id, user_id, purchase_date) values ('1', '5', '2022-02-11')", "insert in...
Database
null
{"headers":{"Purchases":["purchase_id","user_id","purchase_date"]},"rows":{"Purchases":[[4,2,"2022-03-13"],[1,5,"2022-02-11"],[3,7,"2022-06-19"],[6,2,"2022-03-20"],[5,7,"2022-06-19"],[2,2,"2022-06-08"]]}}
{"mysql": ["Create table If Not Exists Purchases (purchase_id int, user_id int, purchase_date date)"], "mssql": ["Create table Purchases (purchase_id int, user_id int, purchase_date date)"], "oraclesql": ["Create table Purchases (purchase_id int, user_id int, purchase_date date)", "ALTER SESSION SET nls_date_format='YY...
{"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']
2,229
Check if an Array Is Consecutive
check-if-an-array-is-consecutive
null
Easy
7K
11.4K
7,021
11,381
61.7%
['binary-tree-longest-consecutive-sequence', 'binary-tree-longest-consecutive-sequence-ii', 'consecutive-characters']
[]
Algorithms
null
[1,3,4,2]
{ "name": "isConsecutive", "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', 'Hash Table', 'Sorting']
2,230
The Users That Are Eligible for Discount
the-users-that-are-eligible-for-discount
null
Easy
6.4K
12.7K
6,445
12,712
50.7%
['the-number-of-users-that-are-eligible-for-discount']
['Create table If Not Exists Purchases (user_id int, time_stamp datetime, amount int)', 'Truncate table Purchases', "insert into Purchases (user_id, time_stamp, amount) values ('1', '2022-04-20 09:03:00', '4416')", "insert into Purchases (user_id, time_stamp, amount) values ('2', '2022-03-19 19:24:02', '678')", "insert...
Database
null
{"headers": {"Purchases": ["user_id", "time_stamp", "amount"]}, "startDate": "2022-03-08", "endDate": "2022-03-20", "minAmount": 1000, "rows": {"Purchases": [[1, "2022-04-20 09:03:00", 4416], [2, "2022-03-19 19:24:02", 678], [3, "2022-03-18 12:03:09", 4523], [3, "2022-03-30 09:43:42", 626]]}}
{"mysql": ["Create table If Not Exists Purchases (user_id int, time_stamp datetime, amount int)"], "mssql": ["Create table Purchases (user_id int, time_stamp datetime, amount int)"], "oraclesql": ["Create table Purchases (user_id int, time_stamp date, amount int)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI...
{"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']
2,231
Largest Number After Digit Swaps by Parity
largest-number-after-digit-swaps-by-parity
<p>You are given a positive integer <code>num</code>. You may swap any two digits of <code>num</code> that have the same <strong>parity</strong> (i.e. both odd digits or both even digits).</p> <p>Return<em> the <strong>largest</strong> possible value of </em><code>num</code><em> after <strong>any</strong> number of sw...
Easy
55.5K
87.6K
55,537
87,644
63.4%
['largest-number-at-least-twice-of-others', 'sort-array-by-parity', 'sort-array-by-parity-ii', 'smallest-string-with-swaps', 'rearrange-array-elements-by-sign']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largestInteger(int num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largestInteger(int num) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
1234
{ "name": "largestInteger", "params": [ { "name": "num", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Sorting', 'Heap (Priority Queue)']
2,232
Minimize Result by Adding Parentheses to Expression
minimize-result-by-adding-parentheses-to-expression
<p>You are given a <strong>0-indexed</strong> string <code>expression</code> of the form <code>&quot;&lt;num1&gt;+&lt;num2&gt;&quot;</code> where <code>&lt;num1&gt;</code> and <code>&lt;num2&gt;</code> represent positive integers.</p> <p>Add a pair of parentheses to <code>expression</code> such that after the addition...
Medium
24.1K
35.8K
24,122
35,815
67.4%
['basic-calculator', 'different-ways-to-add-parentheses', 'solve-the-equation']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string minimizeResult(string expression) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String minimizeResult(String expression) {\n \n }\n}"}, {"value": "python", "text": ...
"247+38"
{ "name": "minimizeResult", "params": [ { "name": "expression", "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']
2,233
Maximum Product After K Increments
maximum-product-after-k-increments
<p>You are given an array of non-negative integers <code>nums</code> and an integer <code>k</code>. In one operation, you may choose <strong>any</strong> element from <code>nums</code> and <strong>increment</strong> it by <code>1</code>.</p> <p>Return<em> the <strong>maximum</strong> <strong>product</strong> of </em><...
Medium
38.2K
90.7K
38,201
90,693
42.1%
['minimum-size-subarray-sum', 'minimum-increment-to-make-array-unique', 'minimum-operations-to-make-the-array-increasing']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumProduct(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumProduct(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text":...
[0,4] 5
{ "name": "maximumProduct", "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', 'Greedy', 'Heap (Priority Queue)']
2,234
Maximum Total Beauty of the Gardens
maximum-total-beauty-of-the-gardens
<p>Alice is a caretaker of <code>n</code> gardens and she wants to plant flowers to maximize the total beauty of all her gardens.</p> <p>You are given a <strong>0-indexed</strong> integer array <code>flowers</code> of size <code>n</code>, where <code>flowers[i]</code> is the number of flowers already planted in the <c...
Hard
8.3K
27.8K
8,323
27,843
29.9%
['split-array-largest-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumBeauty(vector<int>& flowers, long long newFlowers, int target, int full, int partial) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumBeauty(int[] flowers...
[1,3,1,1] 7 6 12 1
{ "name": "maximumBeauty", "params": [ { "name": "flowers", "type": "integer[]" }, { "type": "long", "name": "newFlowers" }, { "type": "integer", "name": "target" }, { "type": "integer", "name": "full" }, { "type": "integer", ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Two Pointers', 'Binary Search', 'Greedy', 'Sorting', 'Enumeration', 'Prefix Sum']
2,235
Add Two Integers
add-two-integers
Given two integers <code>num1</code> and <code>num2</code>, return <em>the <strong>sum</strong> of the two integers</em>. <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> num1 = 12, num2 = 5 <strong>Output:</strong> 17 <strong>Explanation:</strong> num1 is 12, num2 is 5, a...
Easy
676.1K
767.2K
676,094
767,226
88.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sum(int num1, int num2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sum(int num1, int num2) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
12 5
{ "name": "sum", "params": [ { "name": "num1", "type": "integer" }, { "type": "integer", "name": "num2" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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']
2,236
Root Equals Sum of Children
root-equals-sum-of-children
<p>You are given the <code>root</code> of a <strong>binary tree</strong> that consists of exactly <code>3</code> nodes: the root, its left child, and its right child.</p> <p>Return <code>true</code> <em>if the value of the root is equal to the <strong>sum</strong> of the values of its two children, or </em><code>false...
Easy
288K
339.3K
287,985
339,313
84.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[10,4,6]
{ "name": "checkTree", "params": [ { "name": "root", "type": "TreeNode" } ], "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...
['Tree', 'Binary Tree']
2,237
Count Positions on Street With Required Brightness
count-positions-on-street-with-required-brightness
null
Medium
4.2K
6.8K
4,189
6,764
61.9%
['range-addition', 'brightest-position-on-street', 'increment-submatrices-by-one']
[]
Algorithms
null
5 [[0,1],[2,1],[3,2]] [0,2,1,4,1]
{ "name": "meetRequirement", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "lights" }, { "type": "integer[]", "name": "requirement" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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']
2,238
Number of Times a Driver Was a Passenger
number-of-times-a-driver-was-a-passenger
null
Medium
9.6K
13.4K
9,623
13,364
72.0%
['hopper-company-queries-i', 'hopper-company-queries-ii', 'hopper-company-queries-iii']
['Create table If Not Exists Rides (ride_id int, driver_id int, passenger_id int)', 'Truncate table Rides', "insert into Rides (ride_id, driver_id, passenger_id) values ('1', '7', '1')", "insert into Rides (ride_id, driver_id, passenger_id) values ('2', '7', '2')", "insert into Rides (ride_id, driver_id, passenger_id) ...
Database
null
{"headers":{"Rides":["ride_id","driver_id","passenger_id"]},"rows":{"Rides":[[1,7,1],[2,7,2],[3,11,1],[4,11,7],[5,11,7],[6,11,3]]}}
{"mysql": ["Create table If Not Exists Rides (ride_id int, driver_id int, passenger_id int)"], "mssql": ["Create table Rides (ride_id int, driver_id int, passenger_id int)"], "oraclesql": ["Create table Rides (ride_id int, driver_id int, passenger_id int)"], "database": true, "name": "driver_passenger", "pythondata": [...
{"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']
2,239
Find Closest Number to Zero
find-closest-number-to-zero
<p>Given an integer array <code>nums</code> of size <code>n</code>, return <em>the number with the value <strong>closest</strong> to </em><code>0</code><em> in </em><code>nums</code>. If there are multiple answers, return <em>the number with the <strong>largest</strong> value</em>.</p> <p>&nbsp;</p> <p><strong class="e...
Easy
160.1K
340.8K
160,136
340,793
47.0%
['find-k-closest-elements']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findClosestNumber(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findClosestNumber(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python...
[-4,-2,1,4,8]
{ "name": "findClosestNumber", "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']
2,240
Number of Ways to Buy Pens and Pencils
number-of-ways-to-buy-pens-and-pencils
<p>You are given an integer <code>total</code> indicating the amount of money you have. You are also given two integers <code>cost1</code> and <code>cost2</code> indicating the price of a pen and pencil respectively. You can spend <strong>part or all</strong> of your money to buy multiple quantities (or none) of each k...
Medium
33.4K
59.9K
33,385
59,876
55.8%
['find-three-consecutive-integers-that-sum-to-a-given-number', 'count-integers-with-even-digit-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long waysToBuyPensPencils(int total, int cost1, int cost2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long waysToBuyPensPencils(int total, int cost1, int cost2) {\n \...
20 10 5
{ "name": "waysToBuyPensPencils", "params": [ { "name": "total", "type": "integer" }, { "type": "integer", "name": "cost1" }, { "type": "integer", "name": "cost2" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Enumeration']
2,241
Design an ATM Machine
design-an-atm-machine
<p>There is an ATM machine that stores banknotes of <code>5</code> denominations: <code>20</code>, <code>50</code>, <code>100</code>, <code>200</code>, and <code>500</code> dollars. Initially the ATM is empty. The user can use the machine to deposit or withdraw any amount of money.</p> <p>When withdrawing, the machine...
Medium
26.8K
60.8K
26,803
60,846
44.1%
['simple-bank-system', 'minimum-number-of-operations-to-convert-time']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class ATM {\npublic:\n ATM() {\n \n }\n \n void deposit(vector<int> banknotesCount) {\n \n }\n \n vector<int> withdraw(int amount) {\n \n }\n};\n\n/**\n * Your ATM object will be instantiated and called as such:\n * ATM* obj =...
["ATM","deposit","withdraw","deposit","withdraw","withdraw"] [[],[[0,0,1,2,1]],[600],[[0,1,0,1,1]],[600],[550]]
{ "classname": "ATM", "constructor": { "params": [] }, "methods": [ { "params": [ { "type": "integer[]", "name": "banknotesCount" } ], "name": "deposit", "return": { "type": "void" } }, { "params": [ { ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Design']
2,242
Maximum Score of a Node Sequence
maximum-score-of-a-node-sequence
<p>There is an <strong>undirected</strong> graph with <code>n</code> nodes, numbered from <code>0</code> to <code>n - 1</code>.</p> <p>You are given a <strong>0-indexed</strong> integer array <code>scores</code> of length <code>n</code> where <code>scores[i]</code> denotes the score of node <code>i</code>. You are als...
Hard
14.2K
36.6K
14,212
36,639
38.8%
['get-the-maximum-score']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumScore(vector<int>& scores, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumScore(int[] scores, int[][] edges) {\n \n }\n}"}...
[5,2,9,8,4] [[0,1],[1,2],[2,3],[0,2],[1,3],[2,4]]
{ "name": "maximumScore", "params": [ { "type": "integer[]", "name": "scores" }, { "type": "integer[][]", "name": "edges" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Graph', 'Sorting', 'Enumeration']
2,243
Calculate Digit Sum of a String
calculate-digit-sum-of-a-string
<p>You are given a string <code>s</code> consisting of digits and an integer <code>k</code>.</p> <p>A <strong>round</strong> can be completed if the length of <code>s</code> is greater than <code>k</code>. In one round, do the following:</p> <ol> <li><strong>Divide</strong> <code>s</code> into <strong>consecutive gr...
Easy
46.3K
69.7K
46,256
69,681
66.4%
['add-digits', 'find-triangular-sum-of-an-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string digitSum(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String digitSum(String s, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau...
"11111222223" 3
{ "name": "digitSum", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Simulation']
2,244
Minimum Rounds to Complete All Tasks
minimum-rounds-to-complete-all-tasks
<p>You are given a <strong>0-indexed</strong> integer array <code>tasks</code>, where <code>tasks[i]</code> represents the difficulty level of a task. In each round, you can complete either 2 or 3 tasks of the <strong>same difficulty level</strong>.</p> <p>Return <em>the <strong>minimum</strong> rounds required to com...
Medium
160.3K
254.8K
160,252
254,766
62.9%
['climbing-stairs', 'odd-string-difference', 'minimum-levels-to-gain-more-points']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumRounds(vector<int>& tasks) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumRounds(int[] tasks) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
[2,2,3,3,2,4,4,4,4,4]
{ "name": "minimumRounds", "params": [ { "name": "tasks", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Greedy', 'Counting']
2,245
Maximum Trailing Zeros in a Cornered Path
maximum-trailing-zeros-in-a-cornered-path
<p>You are given a 2D integer array <code>grid</code> of size <code>m x n</code>, where each cell contains a positive integer.</p> <p>A <strong>cornered path</strong> is defined as a set of adjacent cells with <strong>at most</strong> one turn. More specifically, the path should exclusively move either <strong>horizon...
Medium
8.8K
24.1K
8,793
24,113
36.5%
['factorial-trailing-zeroes', 'bomb-enemy', 'abbreviating-the-product-of-a-range']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxTrailingZeros(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxTrailingZeros(int[][] grid) {\n \n }\n}"}, {"value": "python", "text":...
[[23,17,15,3,20],[8,1,20,27,11],[9,4,6,2,21],[40,9,1,10,6],[22,7,4,5,3]]
{ "name": "maxTrailingZeros", "params": [ { "name": "grid", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Matrix', 'Prefix Sum']
2,246
Longest Path With Different Adjacent Characters
longest-path-with-different-adjacent-characters
<p>You are given a <strong>tree</strong> (i.e. a connected, undirected graph that has no cycles) <strong>rooted</strong> at node <code>0</code> consisting of <code>n</code> nodes numbered from <code>0</code> to <code>n - 1</code>. The tree is represented by a <strong>0-indexed</strong> array <code>parent</code> of size...
Hard
82.1K
152.3K
82,142
152,334
53.9%
['diameter-of-binary-tree', 'longest-univalue-path', 'choose-edges-to-maximize-score-in-a-tree']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestPath(vector<int>& parent, string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestPath(int[] parent, String s) {\n \n }\n}"}, {"value": "python", "te...
[-1,0,0,1,1,2] "abacbe"
{ "name": "longestPath", "params": [ { "type": "integer[]", "name": "parent" }, { "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', 'String', 'Tree', 'Depth-First Search', 'Graph', 'Topological Sort']
2,247
Maximum Cost of Trip With K Highways
maximum-cost-of-trip-with-k-highways
null
Hard
2K
4.1K
2,050
4,101
50.0%
['minimum-cost-to-reach-destination-in-time', 'minimum-cost-to-reach-city-with-discounts']
[]
Algorithms
null
5 [[0,1,4],[2,1,3],[1,4,11],[3,2,3],[3,4,2]] 3
{ "name": "maximumCost", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "highways" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Dynamic Programming', 'Bit Manipulation', 'Graph', 'Bitmask']
2,248
Intersection of Multiple Arrays
intersection-of-multiple-arrays
Given a 2D integer array <code>nums</code> where <code>nums[i]</code> is a non-empty array of <strong>distinct</strong> positive integers, return <em>the list of integers that are present in <strong>each array</strong> of</em> <code>nums</code><em> sorted in <strong>ascending order</strong></em>. <p>&nbsp;</p> <p><stro...
Easy
104.8K
153.3K
104,758
153,320
68.3%
['intersection-of-two-arrays', 'intersection-of-two-arrays-ii', 'find-smallest-common-element-in-all-rows', 'intersection-of-three-sorted-arrays', 'find-the-difference-of-two-arrays']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> intersection(vector<vector<int>>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> intersection(int[][] nums) {\n \n }\n}"}, {"value": "python...
[[3,1,2,4,5],[1,2,3,4],[3,4,5,6]]
{ "name": "intersection", "params": [ { "name": "nums", "type": "integer[][]" } ], "return": { "type": "list<integer>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Sorting', 'Counting']
2,249
Count Lattice Points Inside a Circle
count-lattice-points-inside-a-circle
<p>Given a 2D integer array <code>circles</code> where <code>circles[i] = [x<sub>i</sub>, y<sub>i</sub>, r<sub>i</sub>]</code> represents the center <code>(x<sub>i</sub>, y<sub>i</sub>)</code> and radius <code>r<sub>i</sub></code> of the <code>i<sup>th</sup></code> circle drawn on a grid, return <em>the <strong>number ...
Medium
28.5K
52K
28,464
51,983
54.8%
['queries-on-number-of-points-inside-a-circle']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countLatticePoints(vector<vector<int>>& circles) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countLatticePoints(int[][] circles) {\n \n }\n}"}, {"value": "python...
[[2,2,1]]
{ "name": "countLatticePoints", "params": [ { "name": "circles", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Math', 'Geometry', 'Enumeration']
2,250
Count Number of Rectangles Containing Each Point
count-number-of-rectangles-containing-each-point
<p>You are given a 2D integer array <code>rectangles</code> where <code>rectangles[i] = [l<sub>i</sub>, h<sub>i</sub>]</code> indicates that <code>i<sup>th</sup></code> rectangle has a length of <code>l<sub>i</sub></code> and a height of <code>h<sub>i</sub></code>. You are also given a 2D integer array <code>points</co...
Medium
19.5K
54.5K
19,517
54,535
35.8%
['queries-on-number-of-points-inside-a-circle']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> countRectangles(vector<vector<int>>& rectangles, vector<vector<int>>& points) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] countRectangles(int[][] rectangles, int...
[[1,2],[2,3],[2,5]] [[2,1],[1,4]]
{ "name": "countRectangles", "params": [ { "name": "rectangles", "type": "integer[][]" }, { "type": "integer[][]", "name": "points" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Binary Indexed Tree', 'Sorting']
2,251
Number of Flowers in Full Bloom
number-of-flowers-in-full-bloom
<p>You are given a <strong>0-indexed</strong> 2D integer array <code>flowers</code>, where <code>flowers[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> means the <code>i<sup>th</sup></code> flower will be in <strong>full bloom</strong> from <code>start<sub>i</sub></code> to <code>end<sub>i</sub></code> (<strong>inclu...
Hard
93.1K
163.2K
93,072
163,161
57.0%
['meeting-rooms-ii', 'minimum-interval-to-include-each-query']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> fullBloomFlowers(vector<vector<int>>& flowers, vector<int>& people) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] fullBloomFlowers(int[][] flowers, int[] people) {...
[[1,6],[3,7],[9,12],[4,13]] [2,3,7,11]
{ "name": "fullBloomFlowers", "params": [ { "name": "flowers", "type": "integer[][]" }, { "type": "integer[]", "name": "people" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Sorting', 'Prefix Sum', 'Ordered Set']
2,252
Dynamic Pivoting of a Table
dynamic-pivoting-of-a-table
null
Hard
1.9K
3.3K
1,882
3,302
57.0%
['products-price-for-each-store']
['Create table If Not Exists Products (product_id int, store varchar(7), price int)', 'Truncate table Products', "insert into Products (product_id, store, price) values ('1', 'Shop', '110')", "insert into Products (product_id, store, price) values ('1', 'LC_Store', '100')", "insert into Products (product_id, store, pri...
Database
null
{"headers":{"Products":["product_id","store","price"]},"rows":{"Products":[[1,"Shop",110],[1,"LC_Store",100],[2,"Nozama",200],[2,"Souq",190],[3,"Shop",1000],[3,"Souq",1900]]}}
{"mysql": ["Create table If Not Exists Products (product_id int, store varchar(7), price int)"], "mssql": ["Create table Products (product_id int, store varchar(7), price int)"], "oraclesql": ["Create table Products (product_id int, store varchar(7), price int)"], "database": true, "manual": true, "name": "dynamic_pivo...
{"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']
2,253
Dynamic Unpivoting of a Table
dynamic-unpivoting-of-a-table
null
Hard
1.2K
1.8K
1,208
1,777
68.0%
['rearrange-products-table']
['Truncate table Products', "insert into Products (product_id, LC_Store, Nozama, Shop, Souq) values ('1', '100', NULL, '110', NULL)", "insert into Products (product_id, LC_Store, Nozama, Shop, Souq) values ('2', NULL, '200', NULL, '190')", "insert into Products (product_id, LC_Store, Nozama, Shop, Souq) values ('3', NU...
Database
null
{"headers": {"Products": ["product_id", "LC_Store", "Nozama", "Shop", "Souq"]}, "rows": {"Products": [[1, 100, null, 110, null], [2, null, 200, null, 190], [3, null, null, 1000, 1900]]}}
{"mysql": [], "mssql": [], "oraclesql": [], "database": true, "manual": true, "name": "dynamic_unpivoting_of_a_table"}
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]}
['Database']
2,254
Design Video Sharing Platform
design-video-sharing-platform
null
Hard
4.5K
7.1K
4,545
7,145
63.6%
['tweet-counts-per-frequency', 'design-browser-history', 'most-popular-video-creator']
[]
Algorithms
null
["VideoSharingPlatform","upload","upload","remove","remove","upload","watch","watch","like","dislike","dislike","getLikesAndDislikes","getViews"] [[],["123"],["456"],[4],[0],["789"],[1,0,5],[1,0,1],[1],[1],[1],[1],[1]]
{ "classname": "VideoSharingPlatform", "constructor": { "params": [] }, "methods": [ { "params": [ { "type": "string", "name": "video" } ], "name": "upload", "return": { "type": "integer" } }, { "params": [ {...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Stack', 'Design', 'Ordered Set']
2,255
Count Prefixes of a Given String
count-prefixes-of-a-given-string
<p>You are given a string array <code>words</code> and a string <code>s</code>, where <code>words[i]</code> and <code>s</code> comprise only of <strong>lowercase English letters</strong>.</p> <p>Return <em>the <strong>number of strings</strong> in</em> <code>words</code> <em>that are a <strong>prefix</strong> of</em> ...
Easy
78.7K
106.7K
78,653
106,664
73.7%
['check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence', 'check-if-string-is-a-prefix-of-array', 'counting-words-with-a-given-prefix']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countPrefixes(vector<string>& words, string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countPrefixes(String[] words, String s) {\n \n }\n}"}, {"value": "pyth...
["a","b","c","ab","bc","abc"] "abc"
{ "name": "countPrefixes", "params": [ { "name": "words", "type": "string[]" }, { "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', 'String']
2,256
Minimum Average Difference
minimum-average-difference
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> of length <code>n</code>.</p> <p>The <strong>average difference</strong> of the index <code>i</code> is the <strong>absolute</strong> <strong>difference</strong> between the average of the <strong>first</strong> <code>i + 1</code> elements o...
Medium
91.3K
210.3K
91,311
210,286
43.4%
['split-array-with-same-average', 'number-of-ways-to-split-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumAverageDifference(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumAverageDifference(int[] nums) {\n \n }\n}"}, {"value": "python", "...
[2,5,3,9,5,3]
{ "name": "minimumAverageDifference", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Prefix Sum']
2,257
Count Unguarded Cells in the Grid
count-unguarded-cells-in-the-grid
<p>You are given two integers <code>m</code> and <code>n</code> representing a <strong>0-indexed</strong> <code>m x n</code> grid. You are also given two 2D integer arrays <code>guards</code> and <code>walls</code> where <code>guards[i] = [row<sub>i</sub>, col<sub>i</sub>]</code> and <code>walls[j] = [row<sub>j</sub>, ...
Medium
107.6K
163.4K
107,558
163,435
65.8%
['bomb-enemy', 'available-captures-for-rook']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countUnguarded(int m, int n, vector<vector<int>>& guards, vector<vector<int>>& walls) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countUnguarded(int m, int n, int[][] guar...
4 6 [[0,0],[1,1],[2,3]] [[0,1],[2,2],[1,4]]
{ "name": "countUnguarded", "params": [ { "name": "m", "type": "integer" }, { "type": "integer", "name": "n" }, { "type": "integer[][]", "name": "guards" }, { "type": "integer[][]", "name": "walls" } ], "return": { "type": "inte...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Matrix', 'Simulation']
2,258
Escape the Spreading Fire
escape-the-spreading-fire
<p>You are given a <strong>0-indexed</strong> 2D integer array <code>grid</code> of size <code>m x n</code> which represents a field. Each cell has one of three values:</p> <ul> <li><code>0</code> represents grass,</li> <li><code>1</code> represents fire,</li> <li><code>2</code> represents a wall that you and fire ...
Hard
14.4K
40.1K
14,416
40,096
36.0%
['rotting-oranges', 'last-day-where-you-can-still-cross', 'minimum-weighted-subgraph-with-the-required-paths', 'maximum-number-of-points-from-grid-queries']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumMinutes(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumMinutes(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Py...
[[0,2,0,0,0,0,0],[0,0,0,2,2,1,0],[0,2,0,0,1,2,0],[0,0,2,2,2,0,2],[0,0,0,0,0,0,0]]
{ "name": "maximumMinutes", "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', 'Binary Search', 'Breadth-First Search', 'Matrix']
2,259
Remove Digit From Number to Maximize Result
remove-digit-from-number-to-maximize-result
<p>You are given a string <code>number</code> representing a <strong>positive integer</strong> and a character <code>digit</code>.</p> <p>Return <em>the resulting string after removing <strong>exactly one occurrence</strong> of </em><code>digit</code><em> from </em><code>number</code><em> such that the value of the re...
Easy
107.4K
228.6K
107,359
228,600
47.0%
['remove-k-digits', 'remove-vowels-from-a-string', 'second-largest-digit-in-a-string', 'minimum-operations-to-make-a-special-number']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string removeDigit(string number, char digit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String removeDigit(String number, char digit) {\n \n }\n}"}, {"value": "python"...
"123" "3"
{ "name": "removeDigit", "params": [ { "name": "number", "type": "string" }, { "type": "character", "name": "digit" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Greedy', 'Enumeration']
2,260
Minimum Consecutive Cards to Pick Up
minimum-consecutive-cards-to-pick-up
<p>You are given an integer array <code>cards</code> where <code>cards[i]</code> represents the <strong>value</strong> of the <code>i<sup>th</sup></code> card. A pair of cards are <strong>matching</strong> if the cards have the <strong>same</strong> value.</p> <p>Return<em> the <strong>minimum</strong> number of <stro...
Medium
96.8K
184.7K
96,787
184,711
52.4%
['longest-substring-without-repeating-characters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumCardPickup(vector<int>& cards) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumCardPickup(int[] cards) {\n \n }\n}"}, {"value": "python", "text": "Pyth...
[3,4,2,3,4,7]
{ "name": "minimumCardPickup", "params": [ { "name": "cards", "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', 'Sliding Window']
2,261
K Divisible Elements Subarrays
k-divisible-elements-subarrays
<p>Given an integer array <code>nums</code> and two integers <code>k</code> and <code>p</code>, return <em>the number of <strong>distinct subarrays,</strong> which have <strong>at most</strong></em> <code>k</code> <em>elements </em>that are <em>divisible by</em> <code>p</code>.</p> <p>Two arrays <code>nums1</code> and...
Medium
41.4K
77.6K
41,404
77,592
53.4%
['subarrays-with-k-different-integers', 'count-number-of-nice-subarrays', 'subarray-with-elements-greater-than-varying-threshold']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countDistinct(vector<int>& nums, int k, int p) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countDistinct(int[] nums, int k, int p) {\n \n }\n}"}, {"value": "pyth...
[2,3,3,2,2] 2 2
{ "name": "countDistinct", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" }, { "type": "integer", "name": "p" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Trie', 'Rolling Hash', 'Hash Function', 'Enumeration']
2,262
Total Appeal of A String
total-appeal-of-a-string
<p>The <b>appeal</b> of a string is the number of <strong>distinct</strong> characters found in the string.</p> <ul> <li>For example, the appeal of <code>&quot;abbca&quot;</code> is <code>3</code> because it has <code>3</code> distinct characters: <code>&#39;a&#39;</code>, <code>&#39;b&#39;</code>, and <code>&#39;c&#...
Hard
39.9K
71.6K
39,949
71,590
55.8%
['count-unique-characters-of-all-substrings-of-a-given-string', 'count-vowel-substrings-of-a-string', 'vowels-of-all-substrings', 'find-the-median-of-the-uniqueness-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long appealSum(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long appealSum(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "c...
"abbca"
{ "name": "appealSum", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Dynamic Programming']
2,263
Make Array Non-decreasing or Non-increasing
make-array-non-decreasing-or-non-increasing
null
Hard
4.4K
6.8K
4,436
6,792
65.3%
['non-decreasing-array', 'make-array-strictly-increasing', 'minimum-operations-to-make-the-array-increasing']
[]
Algorithms
null
[3,2,4,5,0]
{ "name": "convertArray", "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...
['Dynamic Programming', 'Greedy']
2,264
Largest 3-Same-Digit Number in String
largest-3-same-digit-number-in-string
<p>You are given a string <code>num</code> representing a large integer. An integer is <strong>good</strong> if it meets the following conditions:</p> <ul> <li>It is a <strong>substring</strong> of <code>num</code> with length <code>3</code>.</li> <li>It consists of only one unique digit.</li> </ul> <p>Return <em>t...
Easy
163.3K
236.5K
163,280
236,498
69.0%
['largest-odd-number-in-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string largestGoodInteger(string num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String largestGoodInteger(String num) {\n \n }\n}"}, {"value": "python", "text": "Pytho...
"6777133339"
{ "name": "largestGoodInteger", "params": [ { "name": "num", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
2,265
Count Nodes Equal to Average of Subtree
count-nodes-equal-to-average-of-subtree
<p>Given the <code>root</code> of a binary tree, return <em>the number of nodes where the value of the node is equal to the <strong>average</strong> of the values in its <strong>subtree</strong></em>.</p> <p><strong>Note:</strong></p> <ul> <li>The <strong>average</strong> of <code>n</code> elements is the <strong>su...
Medium
165.6K
191.9K
165,557
191,881
86.3%
['maximum-average-subtree', 'insufficient-nodes-in-root-to-leaf-paths', 'count-nodes-equal-to-sum-of-descendants']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[4,8,5,0,1,null,6]
{ "name": "averageOfSubtree", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "integer" }, "manual": true }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Binary Tree']
2,266
Count Number of Texts
count-number-of-texts
<p>Alice is texting Bob using her phone. The <strong>mapping</strong> of digits to letters is shown in the figure below.</p> <img alt="" src="https://assets.leetcode.com/uploads/2022/03/15/1200px-telephone-keypad2svg.png" style="width: 200px; height: 162px;" /> <p>In order to <strong>add</strong> a letter, Alice has to...
Medium
24.5K
50.4K
24,481
50,411
48.6%
['letter-combinations-of-a-phone-number', 'decode-ways']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countTexts(string pressedKeys) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countTexts(String pressedKeys) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
"22233"
{ "name": "countTexts", "params": [ { "name": "pressedKeys", "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', 'Math', 'String', 'Dynamic Programming']
2,267
Check if There Is a Valid Parentheses String Path
check-if-there-is-a-valid-parentheses-string-path
<p>A parentheses string is a <strong>non-empty</strong> string consisting only of <code>&#39;(&#39;</code> and <code>&#39;)&#39;</code>. It is <strong>valid</strong> if <strong>any</strong> of the following conditions is <strong>true</strong>:</p> <ul> <li>It is <code>()</code>.</li> <li>It can be written as <code>A...
Hard
17.9K
45.6K
17,886
45,602
39.2%
['check-if-there-is-a-valid-path-in-a-grid', 'check-if-a-parentheses-string-can-be-valid']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool hasValidPath(vector<vector<char>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean hasValidPath(char[][] grid) {\n \n }\n}"}, {"value": "python", "text": ...
[["(","(","("],[")","(",")"],["(","(",")"],["(","(",")"]]
{ "name": "hasValidPath", "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', 'Dynamic Programming', 'Matrix']
2,268
Minimum Number of Keypresses
minimum-number-of-keypresses
null
Medium
35.2K
49.5K
35,228
49,470
71.2%
[]
[]
Algorithms
null
"apple"
{ "name": "minimumKeypresses", "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', 'Greedy', 'Sorting', 'Counting']
2,271
Maximum White Tiles Covered by a Carpet
maximum-white-tiles-covered-by-a-carpet
<p>You are given a 2D integer array <code>tiles</code> where <code>tiles[i] = [l<sub>i</sub>, r<sub>i</sub>]</code> represents that every tile <code>j</code> in the range <code>l<sub>i</sub> &lt;= j &lt;= r<sub>i</sub></code> is colored white.</p> <p>You are also given an integer <code>carpetLen</code>, the length of ...
Medium
19.2K
55.2K
19,161
55,240
34.7%
['maximum-number-of-vowels-in-a-substring-of-given-length']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumWhiteTiles(vector<vector<int>>& tiles, int carpetLen) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumWhiteTiles(int[][] tiles, int carpetLen) {\n \n }...
[[1,5],[10,11],[12,18],[20,25],[30,32]] 10
{ "name": "maximumWhiteTiles", "params": [ { "name": "tiles", "type": "integer[][]" }, { "type": "integer", "name": "carpetLen" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Greedy', 'Sliding Window', 'Sorting', 'Prefix Sum']
2,272
Substring With Largest Variance
substring-with-largest-variance
<p>The <strong>variance</strong> of a string is defined as the largest difference between the number of occurrences of <strong>any</strong> <code>2</code> characters present in the string. Note the two characters may or may not be the same.</p> <p>Given a string <code>s</code> consisting of lowercase English letters o...
Hard
72.4K
157.7K
72,395
157,744
45.9%
['maximum-subarray']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largestVariance(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largestVariance(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode...
"aababbb"
{ "name": "largestVariance", "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...
['Array', 'Dynamic Programming']
2,274
Maximum Consecutive Floors Without Special Floors
maximum-consecutive-floors-without-special-floors
<p>Alice manages a company and has rented some floors of a building as office space. Alice has decided some of these floors should be <strong>special floors</strong>, used for relaxation only.</p> <p>You are given two integers <code>bottom</code> and <code>top</code>, which denote that Alice has rented all the floors ...
Medium
36.6K
70.4K
36,561
70,442
51.9%
['longest-consecutive-sequence', 'maximum-gap', 'widest-vertical-area-between-two-points-containing-no-points']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxConsecutive(int bottom, int top, vector<int>& special) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxConsecutive(int bottom, int top, int[] special) {\n \n }...
2 9 [4,6]
{ "name": "maxConsecutive", "params": [ { "name": "bottom", "type": "integer" }, { "type": "integer", "name": "top" }, { "type": "integer[]", "name": "special" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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']
2,277
Closest Node to Path in Tree
closest-node-to-path-in-tree
null
Hard
5.9K
9.4K
5,852
9,363
62.5%
['count-number-of-possible-root-nodes', 'design-graph-with-shortest-path-calculator']
[]
Algorithms
null
7 [[0,1],[0,2],[0,3],[1,4],[2,5],[2,6]] [[5,3,4],[5,3,6]]
{ "name": "closestNode", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "edges" }, { "type": "integer[][]", "name": "query" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Tree', 'Depth-First Search', 'Breadth-First Search']
2,278
Percentage of Letter in String
percentage-of-letter-in-string
<p>Given a string <code>s</code> and a character <code>letter</code>, return<em> the <strong>percentage</strong> of characters in </em><code>s</code><em> that equal </em><code>letter</code><em> <strong>rounded down</strong> to the nearest whole percent.</em></p> <p>&nbsp;</p> <p><strong class="example">Example 1:</str...
Easy
87.7K
117.8K
87,659
117,815
74.4%
['sort-characters-by-frequency']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int percentageLetter(string s, char letter) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int percentageLetter(String s, char letter) {\n \n }\n}"}, {"value": "python", "t...
"foobar" "o"
{ "name": "percentageLetter", "params": [ { "name": "s", "type": "string" }, { "type": "character", "name": "letter" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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']
2,279
Maximum Bags With Full Capacity of Rocks
maximum-bags-with-full-capacity-of-rocks
<p>You have <code>n</code> bags numbered from <code>0</code> to <code>n - 1</code>. You are given two <strong>0-indexed</strong> integer arrays <code>capacity</code> and <code>rocks</code>. The <code>i<sup>th</sup></code> bag can hold a maximum of <code>capacity[i]</code> rocks and currently contains <code>rocks[i]</co...
Medium
102.2K
151.3K
102,181
151,329
67.5%
['capacity-to-ship-packages-within-d-days', 'maximum-units-on-a-truck']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumBags(vector<int>& capacity, vector<int>& rocks, int additionalRocks) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumBags(int[] capacity, int[] rocks, int additi...
[2,3,4,5] [1,2,4,4] 2
{ "name": "maximumBags", "params": [ { "name": "capacity", "type": "integer[]" }, { "type": "integer[]", "name": "rocks" }, { "type": "integer", "name": "additionalRocks" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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']
2,280
Minimum Lines to Represent a Line Chart
minimum-lines-to-represent-a-line-chart
<p>You are given a 2D integer array <code>stockPrices</code> where <code>stockPrices[i] = [day<sub>i</sub>, price<sub>i</sub>]</code> indicates the price of the stock on day <code>day<sub>i</sub></code> is <code>price<sub>i</sub></code>. A <strong>line chart</strong> is created from the array by plotting the points on ...
Medium
29K
111.8K
28,967
111,788
25.9%
['max-points-on-a-line', 'minimum-number-of-lines-to-cover-points']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumLines(vector<vector<int>>& stockPrices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumLines(int[][] stockPrices) {\n \n }\n}"}, {"value": "python", "...
[[1,7],[2,6],[3,5],[4,4],[5,4],[6,3],[7,2],[8,1]]
{ "name": "minimumLines", "params": [ { "name": "stockPrices", "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', 'Geometry', 'Sorting', 'Number Theory']
2,281
Sum of Total Strength of Wizards
sum-of-total-strength-of-wizards
<p>As the ruler of a kingdom, you have an army of wizards at your command.</p> <p>You are given a <strong>0-indexed</strong> integer array <code>strength</code>, where <code>strength[i]</code> denotes the strength of the <code>i<sup>th</sup></code> wizard. For a <strong>contiguous</strong> group of wizards (i.e. the w...
Hard
22.6K
80.4K
22,644
80,430
28.2%
['next-greater-element-i', 'sum-of-subarray-minimums', 'number-of-visible-people-in-a-queue', 'sum-of-subarray-ranges']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int totalStrength(vector<int>& strength) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int totalStrength(int[] strength) {\n \n }\n}"}, {"value": "python", "text": "Python...
[1,3,1,2]
{ "name": "totalStrength", "params": [ { "name": "strength", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Stack', 'Monotonic Stack', 'Prefix Sum']
2,282
Number of People That Can Be Seen in a Grid
number-of-people-that-can-be-seen-in-a-grid
null
Medium
2.3K
4.8K
2,257
4,796
47.1%
['number-of-visible-people-in-a-queue']
[]
Algorithms
null
[[3,1,4,2,5]]
{ "name": "seePeople", "params": [ { "name": "heights", "type": "integer[][]" } ], "return": { "type": "integer[][]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Stack', 'Matrix', 'Monotonic Stack']
2,283
Check if Number Has Equal Digit Count and Digit Value
check-if-number-has-equal-digit-count-and-digit-value
<p>You are given a <strong>0-indexed</strong> string <code>num</code> of length <code>n</code> consisting of digits.</p> <p>Return <code>true</code> <em>if for <strong>every</strong> index </em><code>i</code><em> in the range </em><code>0 &lt;= i &lt; n</code><em>, the digit </em><code>i</code><em> occurs </em><code>n...
Easy
71.4K
98.8K
71,387
98,797
72.3%
['self-dividing-numbers']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool digitCount(string num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean digitCount(String num) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode"...
"1210"
{ "name": "digitCount", "params": [ { "name": "num", "type": "string" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Counting']
2,284
Sender With Largest Word Count
sender-with-largest-word-count
<p>You have a chat log of <code>n</code> messages. You are given two string arrays <code>messages</code> and <code>senders</code> where <code>messages[i]</code> is a <strong>message</strong> sent by <code>senders[i]</code>.</p> <p>A <strong>message</strong> is list of <strong>words</strong> that are separated by a sin...
Medium
39.4K
67.8K
39,362
67,790
58.1%
['top-k-frequent-elements', 'top-k-frequent-words']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string largestWordCount(vector<string>& messages, vector<string>& senders) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String largestWordCount(String[] messages, String[] senders)...
["Hello userTwooo","Hi userThree","Wonderful day Alice","Nice day userThree"] ["Alice","userTwo","userThree","Alice"]
{ "name": "largestWordCount", "params": [ { "name": "messages", "type": "string[]" }, { "type": "string[]", "name": "senders" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String', 'Counting']
2,285
Maximum Total Importance of Roads
maximum-total-importance-of-roads
<p>You are given an integer <code>n</code> denoting the number of cities in a country. The cities are numbered from <code>0</code> to <code>n - 1</code>.</p> <p>You are also given a 2D integer array <code>roads</code> where <code>roads[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> denotes that there exists a <strong>bidi...
Medium
150.9K
218.2K
150,889
218,174
69.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumImportance(int n, vector<vector<int>>& roads) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumImportance(int n, int[][] roads) {\n \n }\n}"}, {"...
5 [[0,1],[1,2],[2,3],[0,2],[1,3],[2,4]]
{ "name": "maximumImportance", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "roads" } ], "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...
['Greedy', 'Graph', 'Sorting', 'Heap (Priority Queue)']
2,286
Booking Concert Tickets in Groups
booking-concert-tickets-in-groups
<p>A concert hall has <code>n</code> rows numbered from <code>0</code> to <code>n - 1</code>, each with <code>m</code> seats, numbered from <code>0</code> to <code>m - 1</code>. You need to design a ticketing system that can allocate seats in the following cases:</p> <ul> <li>If a group of <code>k</code> spectators c...
Hard
7.9K
42.6K
7,897
42,637
18.5%
['cinema-seat-allocation', 'longest-increasing-subsequence-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class BookMyShow {\npublic:\n BookMyShow(int n, int m) {\n \n }\n \n vector<int> gather(int k, int maxRow) {\n \n }\n \n bool scatter(int k, int maxRow) {\n \n }\n};\n\n/**\n * Your BookMyShow object will be instantiated and c...
["BookMyShow","gather","gather","scatter","scatter"] [[2,5],[4,0],[2,0],[5,1],[5,1]]
{ "classname": "BookMyShow", "constructor": { "params": [ { "type": "integer", "name": "n" }, { "type": "integer", "name": "m" } ] }, "methods": [ { "params": [ { "type": "integer", "name": "k" }, ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Binary Search', 'Design', 'Binary Indexed Tree', 'Segment Tree']
2,287
Rearrange Characters to Make Target String
rearrange-characters-to-make-target-string
<p>You are given two <strong>0-indexed</strong> strings <code>s</code> and <code>target</code>. You can take some letters from <code>s</code> and rearrange them to form new strings.</p> <p>Return<em> the <strong>maximum</strong> number of copies of </em><code>target</code><em> that can be formed by taking letters from...
Easy
48.2K
80.5K
48,222
80,472
59.9%
['find-words-that-can-be-formed-by-characters', 'maximum-number-of-occurrences-of-a-substring']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int rearrangeCharacters(string s, string target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int rearrangeCharacters(String s, String target) {\n \n }\n}"}, {"value": "p...
"ilovecodingonleetcode" "code"
{ "name": "rearrangeCharacters", "params": [ { "name": "s", "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...
['Hash Table', 'String', 'Counting']
2,288
Apply Discount to Prices
apply-discount-to-prices
<p>A <strong>sentence</strong> is a string of single-space separated words where each word can contain digits, lowercase letters, and the dollar sign <code>&#39;$&#39;</code>. A word represents a <strong>price</strong> if it is a sequence of digits preceded by a dollar sign.</p> <ul> <li>For example, <code>&quot;$100...
Medium
28K
86.3K
28,026
86,259
32.5%
['multiply-strings', 'apply-discount-every-n-orders']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string discountPrices(string sentence, int discount) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String discountPrices(String sentence, int discount) {\n \n }\n}"}, {"va...
"there are $1 $2 and 5$ candies in the shop" 50
{ "name": "discountPrices", "params": [ { "name": "sentence", "type": "string" }, { "type": "integer", "name": "discount" } ], "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']
2,289
Steps to Make Array Non-decreasing
steps-to-make-array-non-decreasing
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>. In one step, <strong>remove</strong> all elements <code>nums[i]</code> where <code>nums[i - 1] &gt; nums[i]</code> for all <code>0 &lt; i &lt; nums.length</code>.</p> <p>Return <em>the number of steps performed until </em><code>nums</code><...
Medium
25.9K
113.2K
25,929
113,172
22.9%
['remove-one-element-to-make-the-array-strictly-increasing']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int totalSteps(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int totalSteps(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[5,3,4,4,7,3,6,11,8,5,11]
{ "name": "totalSteps", "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', 'Linked List', 'Stack', 'Monotonic Stack']
2,290
Minimum Obstacle Removal to Reach Corner
minimum-obstacle-removal-to-reach-corner
<p>You are given a <strong>0-indexed</strong> 2D integer array <code>grid</code> of size <code>m x n</code>. Each cell has one of two values:</p> <ul> <li><code>0</code> represents an <strong>empty</strong> cell,</li> <li><code>1</code> represents an <strong>obstacle</strong> that may be removed.</li> </ul> <p>You ...
Hard
108.9K
155.7K
108,914
155,696
70.0%
['shortest-path-in-a-grid-with-obstacles-elimination']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumObstacles(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumObstacles(int[][] grid) {\n \n }\n}"}, {"value": "python", "text":...
[[0,1,1],[1,1,0],[1,1,0]]
{ "name": "minimumObstacles", "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', 'Breadth-First Search', 'Graph', 'Heap (Priority Queue)', 'Matrix', 'Shortest Path']
2,291
Maximum Profit From Trading Stocks
maximum-profit-from-trading-stocks
null
Medium
12.6K
27.1K
12,562
27,095
46.4%
['best-time-to-buy-and-sell-stock', 'best-time-to-buy-and-sell-stock-ii', 'best-time-to-buy-and-sell-stock-iii', 'best-time-to-buy-and-sell-stock-iv']
[]
Algorithms
null
[5,4,6,2,3] [8,5,4,3,5] 10
{ "name": "maximumProfit", "params": [ { "name": "present", "type": "integer[]" }, { "type": "integer[]", "name": "future" }, { "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...
['Array', 'Dynamic Programming']
2,292
Products With Three or More Orders in Two Consecutive Years
products-with-three-or-more-orders-in-two-consecutive-years
null
Medium
8.8K
22K
8,824
22,027
40.1%
[]
['Create table If Not Exists Orders (order_id int, product_id int, quantity int, purchase_date date)', 'Truncate table Orders', "insert into Orders (order_id, product_id, quantity, purchase_date) values ('1', '1', '7', '2020-03-16')", "insert into Orders (order_id, product_id, quantity, purchase_date) values ('2', '1',...
Database
null
{"headers": {"Orders": ["order_id", "product_id", "quantity", "purchase_date"]}, "rows": {"Orders": [[1, 1, 7, "2020-03-16"], [2, 1, 4, "2020-12-02"], [3, 1, 7, "2020-05-10"], [4, 1, 6, "2021-12-23"], [5, 1, 5, "2021-05-21"], [6, 1, 6, "2021-10-11"], [7, 2, 6, "2022-10-11"]]}}
{"mysql": ["Create table If Not Exists Orders (order_id int, product_id int, quantity int, purchase_date date)"], "mssql": ["Create table Orders (order_id int, product_id int, quantity int, purchase_date date)"], "oraclesql": ["Create table Orders (order_id int, product_id int, quantity int, purchase_date date)", "ALTE...
{"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']
2,293
Min Max Game
min-max-game
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> whose length is a power of <code>2</code>.</p> <p>Apply the following algorithm on <code>nums</code>:</p> <ol> <li>Let <code>n</code> be the length of <code>nums</code>. If <code>n == 1</code>, <strong>end</strong> the process. Otherwise, ...
Easy
56.3K
88.4K
56,263
88,438
63.6%
['elimination-game', 'find-triangular-sum-of-an-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minMaxGame(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minMaxGame(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[1,3,5,2,4,8,2,2]
{ "name": "minMaxGame", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Simulation']
2,294
Partition Array Such That Maximum Difference Is K
partition-array-such-that-maximum-difference-is-k
<p>You are given an integer array <code>nums</code> and an integer <code>k</code>. You may partition <code>nums</code> into one or more <strong>subsequences</strong> such that each element in <code>nums</code> appears in <strong>exactly</strong> one of the subsequences.</p> <p>Return <em>the <strong>minimum </strong>n...
Medium
50.3K
67.6K
50,254
67,616
74.3%
['longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit', 'maximum-beauty-of-an-array-after-applying-operation']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int partitionArray(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int partitionArray(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text":...
[3,6,1,2,5] 2
{ "name": "partitionArray", "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', 'Greedy', 'Sorting']
2,295
Replace Elements in an Array
replace-elements-in-an-array
<p>You are given a <strong>0-indexed</strong> array <code>nums</code> that consists of <code>n</code> <strong>distinct</strong> positive integers. Apply <code>m</code> operations to this array, where in the <code>i<sup>th</sup></code> operation you replace the number <code>operations[i][0]</code> with <code>operations[...
Medium
41.4K
70.6K
41,357
70,586
58.6%
['find-all-numbers-disappeared-in-an-array', 'maximum-number-of-integers-to-choose-from-a-range-i', 'maximum-number-of-integers-to-choose-from-a-range-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> arrayChange(vector<int>& nums, vector<vector<int>>& operations) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] arrayChange(int[] nums, int[][] operations) {\n ...
[1,2,4,6] [[1,3],[4,7],[6,1]]
{ "name": "arrayChange", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[][]", "name": "operations" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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']
2,296
Design a Text Editor
design-a-text-editor
<p>Design a text editor with a cursor that can do the following:</p> <ul> <li><strong>Add</strong> text to where the cursor is.</li> <li><strong>Delete</strong> text from where the cursor is (simulating the backspace key).</li> <li><strong>Move</strong> the cursor either left or right.</li> </ul> <p>When deleting ...
Hard
31.3K
65.6K
31,342
65,644
47.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class TextEditor {\npublic:\n TextEditor() {\n \n }\n \n void addText(string text) {\n \n }\n \n int deleteText(int k) {\n \n }\n \n string cursorLeft(int k) {\n \n }\n \n string cursorRight(int k) {\n ...
["TextEditor","addText","deleteText","addText","cursorRight","cursorLeft","deleteText","cursorLeft","cursorRight"] [[],["leetcode"],[4],["practice"],[3],[8],[10],[2],[6]]
{ "classname": "TextEditor", "constructor": { "params": [] }, "methods": [ { "params": [ { "type": "string", "name": "text" } ], "name": "addText", "return": { "type": "void" } }, { "params": [ { "t...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List', 'String', 'Stack', 'Design', 'Simulation', 'Doubly-Linked List']
2,297
Jump Game VIII
jump-game-viii
null
Medium
7K
15.5K
6,969
15,458
45.1%
['jump-game-ii', 'jump-game', 'jump-game-iii', 'jump-game-iv', 'jump-game-v', 'jump-game-vi', 'jump-game-vii', 'jump-game-viii']
[]
Algorithms
null
[3,2,4,4,1] [3,7,6,4,2]
{ "name": "minCost", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[]", "name": "costs" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Stack', 'Graph', 'Monotonic Stack', 'Shortest Path']
2,298
Tasks Count in the Weekend
tasks-count-in-the-weekend
null
Medium
7.7K
9.4K
7,733
9,400
82.3%
[]
['Create table If Not Exists Tasks (task_id int, assignee_id int, submit_date date)', 'Truncate table Tasks', "insert into Tasks (task_id, assignee_id, submit_date) values ('1', '1', '2022-06-13')", "insert into Tasks (task_id, assignee_id, submit_date) values ('2', '6', '2022-06-14')", "insert into Tasks (task_id, ass...
Database
null
{"headers": {"Tasks": ["task_id", "assignee_id", "submit_date"]}, "rows": {"Tasks": [[1, 1, "2022-06-13"], [2, 6, "2022-06-14"], [3, 6, "2022-06-15"], [4, 3, "2022-06-18"], [5, 5, "2022-06-19"], [6, 7, "2022-06-19"]]}}
{"mysql": ["Create table If Not Exists Tasks (task_id int, assignee_id int, submit_date date)"], "mssql": ["Create table Tasks (task_id int, assignee_id int, submit_date date)"], "oraclesql": ["Create table Tasks (task_id int, assignee_id int, submit_date date)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD'"], "data...
{"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']
2,299
Strong Password Checker II
strong-password-checker-ii
<p>A password is said to be <strong>strong</strong> if it satisfies all the following criteria:</p> <ul> <li>It has at least <code>8</code> characters.</li> <li>It contains at least <strong>one lowercase</strong> letter.</li> <li>It contains at least <strong>one uppercase</strong> letter.</li> <li>It contains at l...
Easy
49.6K
90.6K
49,638
90,601
54.8%
['strong-password-checker', 'validate-ip-address']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool strongPasswordCheckerII(string password) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean strongPasswordCheckerII(String password) {\n \n }\n}"}, {"value": "pyth...
"IloveLe3tcode!"
{ "name": "strongPasswordCheckerII", "params": [ { "name": "password", "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']
2,300
Successful Pairs of Spells and Potions
successful-pairs-of-spells-and-potions
<p>You are given two positive integer arrays <code>spells</code> and <code>potions</code>, of length <code>n</code> and <code>m</code> respectively, where <code>spells[i]</code> represents the strength of the <code>i<sup>th</sup></code> spell and <code>potions[j]</code> represents the strength of the <code>j<sup>th</su...
Medium
217.9K
483.2K
217,919
483,201
45.1%
['most-profit-assigning-work', 'longest-subsequence-with-limited-sum', 'maximum-matching-of-players-with-trainers']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] successfulPairs(int[] spells, int[] pot...
[5,1,3] [1,2,3,4,5] 7
{ "name": "successfulPairs", "params": [ { "name": "spells", "type": "integer[]" }, { "type": "integer[]", "name": "potions" }, { "type": "long", "name": "success" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Two Pointers', 'Binary Search', 'Sorting']
2,301
Match Substring After Replacement
match-substring-after-replacement
<p>You are given two strings <code>s</code> and <code>sub</code>. You are also given a 2D character array <code>mappings</code> where <code>mappings[i] = [old<sub>i</sub>, new<sub>i</sub>]</code> indicates that you may perform the following operation <strong>any</strong> number of times:</p> <ul> <li><strong>Replace<...
Hard
16.1K
38.5K
16,114
38,495
41.9%
['design-add-and-search-words-data-structure', 'number-of-subarrays-that-match-a-pattern-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool matchReplacement(string s, string sub, vector<vector<char>>& mappings) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean matchReplacement(String s, String sub, char[][] map...
"fool3e7bar" "leet" [["e","3"],["t","7"],["t","8"]]
{ "name": "matchReplacement", "params": [ { "name": "s", "type": "string" }, { "type": "string", "name": "sub" }, { "type": "character[][]", "name": "mappings" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String', 'String Matching']
2,302
Count Subarrays With Score Less Than K
count-subarrays-with-score-less-than-k
<p>The <strong>score</strong> of an array is defined as the <strong>product</strong> of its sum and its length.</p> <ul> <li>For example, the score of <code>[1, 2, 3, 4, 5]</code> is <code>(1 + 2 + 3 + 4 + 5) * 5 = 75</code>.</li> </ul> <p>Given a positive integer array <code>nums</code> and an integer <code>k</code...
Hard
40.1K
71.9K
40,077
71,904
55.7%
['maximum-subarray', 'subarray-product-less-than-k', 'binary-subarrays-with-sum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countSubarrays(vector<int>& nums, long long k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countSubarrays(int[] nums, long k) {\n \n }\n}"}, {"value": "py...
[2,1,4,3,5] 10
{ "name": "countSubarrays", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "long", "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', 'Sliding Window', 'Prefix Sum']
2,303
Calculate Amount Paid in Taxes
calculate-amount-paid-in-taxes
<p>You are given a <strong>0-indexed</strong> 2D integer array <code>brackets</code> where <code>brackets[i] = [upper<sub>i</sub>, percent<sub>i</sub>]</code> means that the <code>i<sup>th</sup></code> tax bracket has an upper bound of <code>upper<sub>i</sub></code> and is taxed at a rate of <code>percent<sub>i</sub></...
Easy
45.7K
68.2K
45,673
68,170
67.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double calculateTax(vector<vector<int>>& brackets, int income) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double calculateTax(int[][] brackets, int income) {\n \n }\n}"...
[[3,50],[7,10],[12,25]] 10
{ "name": "calculateTax", "params": [ { "name": "brackets", "type": "integer[][]" }, { "type": "integer", "name": "income" } ], "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', 'Simulation']
2,304
Minimum Path Cost in a Grid
minimum-path-cost-in-a-grid
<p>You are given a <strong>0-indexed</strong> <code>m x n</code> integer matrix <code>grid</code> consisting of <strong>distinct</strong> integers from <code>0</code> to <code>m * n - 1</code>. You can move in this matrix from a cell to any other cell in the <strong>next</strong> row. That is, if you are in cell <code>...
Medium
35.2K
52.5K
35,216
52,536
67.0%
['unique-paths', 'unique-paths-ii', 'minimum-path-sum', 'dungeon-game', 'paint-house']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minPathCost(vector<vector<int>>& grid, vector<vector<int>>& moveCost) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minPathCost(int[][] grid, int[][] moveCost) {\n \n...
[[5,3],[4,0],[2,1]] [[9,8],[1,5],[10,12],[18,6],[2,4],[14,3]]
{ "name": "minPathCost", "params": [ { "name": "grid", "type": "integer[][]" }, { "type": "integer[][]", "name": "moveCost" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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']
2,305
Fair Distribution of Cookies
fair-distribution-of-cookies
<p>You are given an integer array <code>cookies</code>, where <code>cookies[i]</code> denotes the number of cookies in the <code>i<sup>th</sup></code> bag. You are also given an integer <code>k</code> that denotes the number of children to distribute <strong>all</strong> the bags of cookies to. All the cookies in the s...
Medium
107.1K
154.5K
107,077
154,501
69.3%
['split-array-largest-sum', 'split-array-with-equal-sum', 'partition-to-k-equal-sum-subsets', 'minimum-xor-sum-of-two-arrays', 'the-number-of-good-subsets', 'minimum-number-of-work-sessions-to-finish-the-tasks', 'partition-array-into-two-arrays-to-minimize-sum-difference', 'maximum-rows-covered-by-columns', 'distribute...
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int distributeCookies(vector<int>& cookies, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int distributeCookies(int[] cookies, int k) {\n \n }\n}"}, {"value": "pyth...
[8,15,10,20,8] 2
{ "name": "distributeCookies", "params": [ { "name": "cookies", "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', 'Backtracking', 'Bit Manipulation', 'Bitmask']
2,306
Naming a Company
naming-a-company
<p>You are given an array of strings <code>ideas</code> that represents a list of names to be used in the process of naming a company. The process of naming a company is as follows:</p> <ol> <li>Choose 2 <strong>distinct</strong> names from <code>ideas</code>, call them <code>idea<sub>A</sub></code> and <code>idea<su...
Hard
63.3K
136.6K
63,258
136,561
46.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long distinctNames(vector<string>& ideas) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long distinctNames(String[] ideas) {\n \n }\n}"}, {"value": "python", "text": ...
["coffee","donuts","time","toffee"]
{ "name": "distinctNames", "params": [ { "name": "ideas", "type": "string[]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String', 'Bit Manipulation', 'Enumeration']
2,307
Check for Contradictions in Equations
check-for-contradictions-in-equations
null
Hard
4.7K
10.9K
4,711
10,928
43.1%
['evaluate-division']
[]
Algorithms
null
[["a","b"],["b","c"],["a","c"]] [3,0.5,1.5]
{ "name": "checkContradictions", "params": [ { "name": "equations", "type": "list<list<string>>" }, { "type": "double[]", "name": "values" } ], "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', 'Depth-First Search', 'Union Find', 'Graph']