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,910
Minimum Number of Groups to Create a Valid Assignment
minimum-number-of-groups-to-create-a-valid-assignment
<p>You are given a collection of numbered <code>balls</code>&nbsp;and instructed to sort them into boxes for a nearly balanced distribution. There are two rules you must follow:</p> <ul> <li>Balls with the same&nbsp;box must have the same value. But, if you have more than one ball with the same number, you can put th...
Medium
13.8K
57.8K
13,823
57,838
23.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minGroupsForValidAssignment(vector<int>& balls) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minGroupsForValidAssignment(int[] balls) {\n \n }\n}"}, {"value": "py...
[3,2,3,2,3]
{ "name": "minGroupsForValidAssignment", "params": [ { "name": "balls", "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']
2,911
Minimum Changes to Make K Semi-palindromes
minimum-changes-to-make-k-semi-palindromes
<p>Given a string <code>s</code> and an integer <code>k</code>, partition <code>s</code> into <code>k</code> <strong><span data-keyword="substring-nonempty">substrings</span></strong> such that the letter changes needed to make each substring a <strong>semi-palindrome</strong>&nbsp;are minimized.</p> <p>Return the <em...
Hard
4.5K
13K
4,502
13,025
34.6%
['palindrome-partitioning-iii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumChanges(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumChanges(String s, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", ...
"abcac" 2
{ "name": "minimumChanges", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Two Pointers', 'String', 'Dynamic Programming']
2,912
Number of Ways to Reach Destination in the Grid
number-of-ways-to-reach-destination-in-the-grid
null
Hard
1K
1.8K
1,048
1,785
58.7%
[]
[]
Algorithms
null
3 2 2 [1,1] [2,2]
{ "name": "numberOfWays", "params": [ { "type": "integer", "name": "n" }, { "type": "integer", "name": "m" }, { "type": "integer", "name": "k" }, { "type": "integer[]", "name": "source" }, { "type": "integer[]", "name": ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Dynamic Programming', 'Combinatorics']
2,913
Subarrays Distinct Element Sum of Squares I
subarrays-distinct-element-sum-of-squares-i
<p>You are given a <strong>0-indexed </strong>integer array <code>nums</code>.</p> <p>The <strong>distinct count</strong> of a subarray of <code>nums</code> is defined as:</p> <ul> <li>Let <code>nums[i..j]</code> be a subarray of <code>nums</code> consisting of all the indices from <code>i</code> to <code>j</code> s...
Easy
39.4K
49.6K
39,350
49,578
79.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumCounts(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumCounts(List<Integer> nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa...
[1,2,1]
{ "name": "sumCounts", "params": [ { "name": "nums", "type": "list<integer>" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table']
2,914
Minimum Number of Changes to Make Binary String Beautiful
minimum-number-of-changes-to-make-binary-string-beautiful
<p>You are given a <strong>0-indexed</strong> binary string <code>s</code> having an even length.</p> <p>A string is <strong>beautiful</strong> if it&#39;s possible to partition it into one or more substrings such that:</p> <ul> <li>Each substring has an <strong>even length</strong>.</li> <li>Each substring contain...
Medium
159.4K
208.4K
159,381
208,361
76.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minChanges(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minChanges(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class ...
"1001"
{ "name": "minChanges", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
2,915
Length of the Longest Subsequence That Sums to Target
length-of-the-longest-subsequence-that-sums-to-target
<p>You are given a <strong>0-indexed</strong> array of integers <code>nums</code>, and an integer <code>target</code>.</p> <p>Return <em>the <strong>length of the longest subsequence</strong> of</em> <code>nums</code> <em>that sums up to</em> <code>target</code>. <em>If no such subsequence exists, return</em> <code>-1...
Medium
27.6K
75K
27,587
74,970
36.8%
['coin-change', 'coin-change-ii', 'find-the-maximum-length-of-valid-subsequence-i', 'find-the-maximum-length-of-valid-subsequence-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int lengthOfLongestSubsequence(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int lengthOfLongestSubsequence(List<Integer> nums, int target) {\n ...
[1,2,3,4,5] 9
{ "name": "lengthOfLongestSubsequence", "params": [ { "name": "nums", "type": "list<integer>" }, { "type": "integer", "name": "target" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
2,916
Subarrays Distinct Element Sum of Squares II
subarrays-distinct-element-sum-of-squares-ii
<p>You are given a <strong>0-indexed </strong>integer array <code>nums</code>.</p> <p>The <strong>distinct count</strong> of a subarray of <code>nums</code> is defined as:</p> <ul> <li>Let <code>nums[i..j]</code> be a subarray of <code>nums</code> consisting of all the indices from <code>i</code> to <code>j</code> s...
Hard
3.7K
18.3K
3,736
18,274
20.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumCounts(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumCounts(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode"...
[1,2,1]
{ "name": "sumCounts", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Binary Indexed Tree', 'Segment Tree']
2,917
Find the K-or of an Array
find-the-k-or-of-an-array
<p>You are given an integer array <code>nums</code>, and an integer <code>k</code>. Let&#39;s introduce&nbsp;<strong>K-or</strong> operation by extending the standard bitwise OR. In K-or, a bit position in the result is set to <code>1</code>&nbsp;if at least <code>k</code> numbers in <code>nums</code> have a <code>1</c...
Easy
30.5K
42.4K
30,538
42,417
72.0%
['counting-bits', 'sum-of-values-at-indices-with-k-set-bits']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findKOr(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findKOr(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
[7,12,9,8,9,15] 4
{ "name": "findKOr", "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', 'Bit Manipulation']
2,918
Minimum Equal Sum of Two Arrays After Replacing Zeros
minimum-equal-sum-of-two-arrays-after-replacing-zeros
<p>You are given two arrays <code>nums1</code> and <code>nums2</code> consisting of positive integers.</p> <p>You have to replace <strong>all</strong> the <code>0</code>&#39;s in both arrays with <strong>strictly</strong> positive integers such that the sum of elements of both arrays becomes <strong>equal</strong>.</p...
Medium
32.2K
88.1K
32,174
88,124
36.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minSum(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minSum(int[] nums1, int[] nums2) {\n \n }\n}"}, {"value": "pyth...
[3,2,0,1,0] [6,5,0]
{ "name": "minSum", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy']
2,919
Minimum Increment Operations to Make Array Beautiful
minimum-increment-operations-to-make-array-beautiful
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> having length <code>n</code>, and an integer <code>k</code>.</p> <p>You can perform the following <strong>increment</strong> operation <strong>any</strong> number of times (<strong>including zero</strong>):</p> <ul> <li>Choose an index <co...
Medium
15.4K
45.6K
15,354
45,580
33.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minIncrementOperations(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minIncrementOperations(int[] nums, int k) {\n \n }\n}"}, {"va...
[2,3,0,0,2] 4
{ "name": "minIncrementOperations", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming']
2,920
Maximum Points After Collecting Coins From All Nodes
maximum-points-after-collecting-coins-from-all-nodes
<p>There exists an undirected tree rooted at node <code>0</code> with <code>n</code> nodes labeled from <code>0</code> to <code>n - 1</code>. You are given a 2D <strong>integer</strong> array <code>edges</code> of length <code>n - 1</code>, where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates that the...
Hard
8.9K
25.2K
8,943
25,240
35.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumPoints(vector<vector<int>>& edges, vector<int>& coins, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumPoints(int[][] edges, int[] coins, int k) {\n ...
[[0,1],[1,2],[2,3]] [10,10,3,3] 5
{ "name": "maximumPoints", "params": [ { "name": "edges", "type": "integer[][]" }, { "type": "integer[]", "name": "coins" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Bit Manipulation', 'Tree', 'Depth-First Search', 'Memoization']
2,921
Maximum Profitable Triplets With Increasing Prices II
maximum-profitable-triplets-with-increasing-prices-ii
null
Hard
613
1.3K
613
1,333
46.0%
[]
[]
Algorithms
null
[10,2,3,4] [100,2,7,10]
{ "name": "maxProfit", "params": [ { "name": "prices", "type": "integer[]" }, { "type": "integer[]", "name": "profits" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Indexed Tree', 'Segment Tree']
2,922
Market Analysis III
market-analysis-iii
null
Medium
2.9K
7K
2,897
6,979
41.5%
[]
['Create table If Not Exists Users (seller_id int, join_date date, favorite_brand varchar(10))', 'Create table If Not Exists Orders (order_id int, order_date date, item_id int, seller_id int)', 'Create table If Not Exists Items (item_id int, item_brand varchar(10))', 'Truncate table Users', "insert into Users (seller_i...
Database
null
{"headers": {"Users": ["seller_id", "join_date", "favorite_brand"],"Orders":["order_id","order_date","item_id","seller_id"],"Items":["item_id","item_brand"]},"rows":{"Users":[[1,"2019-01-01","Lenovo"],[2,"2019-02-09","Samsung"],[3,"2019-01-19","LG"]],"Orders":[[1,"2019-08-01",4,2],[2,"2019-08-02",2,3],[3,"2019-08-03",3...
{"mysql": ["Create table If Not Exists Users (seller_id int, join_date date, favorite_brand varchar(10))", "Create table If Not Exists Orders (order_id int, order_date date, item_id int, seller_id int)", "Create table If Not Exists Items (item_id int, item_brand varchar(10))"], "mssql": ["Create table Users (seller_id ...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
2,923
Find Champion I
find-champion-i
<p>There are <code>n</code> teams numbered from <code>0</code> to <code>n - 1</code> in a tournament.</p> <p>Given a <strong>0-indexed</strong> 2D boolean matrix <code>grid</code> of size <code>n * n</code>. For all <code>i, j</code> that <code>0 &lt;= i, j &lt;= n - 1</code> and <code>i != j</code> team <code>i</code...
Easy
46.5K
64.4K
46,513
64,433
72.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findChampion(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findChampion(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python...
[[0,1],[0,0]]
{ "name": "findChampion", "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']
2,924
Find Champion II
find-champion-ii
<p>There are <code>n</code> teams numbered from <code>0</code> to <code>n - 1</code> in a tournament; each team is also a node in a <strong>DAG</strong>.</p> <p>You are given the integer <code>n</code> and a <strong>0-indexed</strong> 2D integer array <code>edges</code> of length <code><font face="monospace">m</font><...
Medium
124.4K
177.8K
124,389
177,792
70.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findChampion(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findChampion(int n, int[][] edges) {\n \n }\n}"}, {"value": "python",...
3 [[0,1],[1,2]]
{ "name": "findChampion", "params": [ { "type": "integer", "name": "n" }, { "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...
['Graph']
2,925
Maximum Score After Applying Operations on a Tree
maximum-score-after-applying-operations-on-a-tree
<p>There is an undirected tree with <code>n</code> nodes labeled from <code>0</code> to <code>n - 1</code>, and rooted at node <code>0</code>. You are given&nbsp;a 2D integer array <code>edges</code> of length <code>n - 1</code>, where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates that there is an ed...
Medium
14.6K
31.3K
14,626
31,312
46.7%
['sum-of-distances-in-tree', 'collect-coins-in-a-tree', 'find-the-maximum-sum-of-node-values']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumScoreAfterOperations(vector<vector<int>>& edges, vector<int>& values) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumScoreAfterOperations(int[][] edges, ...
[[0,1],[0,2],[0,3],[2,4],[4,5]] [5,2,5,2,1,1]
{ "name": "maximumScoreAfterOperations", "params": [ { "name": "edges", "type": "integer[][]" }, { "type": "integer[]", "name": "values" } ], "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...
['Dynamic Programming', 'Tree', 'Depth-First Search']
2,926
Maximum Balanced Subsequence Sum
maximum-balanced-subsequence-sum
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>.</p> <p>A <strong>subsequence</strong> of <code>nums</code> having length <code>k</code> and consisting of <strong>indices</strong> <code>i<sub>0</sub>&nbsp;&lt;&nbsp;i<sub>1</sub> &lt;&nbsp;... &lt; i<sub>k-1</sub></code> is <strong>balance...
Hard
7.5K
30.3K
7,475
30,322
24.7%
['number-of-pairs-satisfying-inequality']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxBalancedSubsequenceSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxBalancedSubsequenceSum(int[] nums) {\n \n }\n}"}, {"value": "p...
[3,3,5,6]
{ "name": "maxBalancedSubsequenceSum", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Dynamic Programming', 'Binary Indexed Tree', 'Segment Tree']
2,927
Distribute Candies Among Children III
distribute-candies-among-children-iii
null
Hard
721
1.6K
721
1,647
43.8%
[]
[]
Algorithms
null
5 2
{ "name": "distributeCandies", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "limit" } ], "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', 'Combinatorics']
2,928
Distribute Candies Among Children I
distribute-candies-among-children-i
<p>You are given two positive integers <code>n</code> and <code>limit</code>.</p> <p>Return <em>the <strong>total number</strong> of ways to distribute </em><code>n</code> <em>candies among </em><code>3</code><em> children such that no child gets more than </em><code>limit</code><em> candies.</em></p> <p>&nbsp;</p> <...
Easy
31K
42.5K
31,004
42,475
73.0%
['count-ways-to-distribute-candies']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int distributeCandies(int n, int limit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int distributeCandies(int n, int limit) {\n \n }\n}"}, {"value": "python", "text": "P...
5 2
{ "name": "distributeCandies", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "limit" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Combinatorics', 'Enumeration']
2,929
Distribute Candies Among Children II
distribute-candies-among-children-ii
<p>You are given two positive integers <code>n</code> and <code>limit</code>.</p> <p>Return <em>the <strong>total number</strong> of ways to distribute </em><code>n</code> <em>candies among </em><code>3</code><em> children such that no child gets more than </em><code>limit</code><em> candies.</em></p> <p>&nbsp;</p> <...
Medium
14.1K
40.6K
14,125
40,552
34.8%
['count-ways-to-distribute-candies']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long distributeCandies(int n, int limit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long distributeCandies(int n, int limit) {\n \n }\n}"}, {"value": "python", "te...
5 2
{ "name": "distributeCandies", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "limit" } ], "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', 'Combinatorics', 'Enumeration']
2,930
Number of Strings Which Can Be Rearranged to Contain Substring
number-of-strings-which-can-be-rearranged-to-contain-substring
<p>You are given an integer <code>n</code>.</p> <p>A string <code>s</code> is called <strong>good </strong>if it contains only lowercase English characters <strong>and</strong> it is possible to rearrange the characters of <code>s</code> such that the new string contains <code>&quot;leet&quot;</code> as a <strong>subs...
Medium
7.4K
13.2K
7,378
13,191
55.9%
['count-vowels-permutation']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int stringCount(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int stringCount(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solu...
4
{ "name": "stringCount", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Dynamic Programming', 'Combinatorics']
2,931
Maximum Spending After Buying Items
maximum-spending-after-buying-items
<p>You are given a <strong>0-indexed</strong> <code>m * n</code> integer matrix <code>values</code>, representing the values of <code>m * n</code> different items in <code>m</code> different shops. Each shop has <code>n</code> items where the <code>j<sup>th</sup></code> item in the <code>i<sup>th</sup></code> shop has ...
Hard
13.1K
22.1K
13,148
22,050
59.6%
['maximum-points-you-can-obtain-from-cards', 'maximum-score-from-performing-multiplication-operations']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxSpending(vector<vector<int>>& values) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxSpending(int[][] values) {\n \n }\n}"}, {"value": "python", "text"...
[[8,5,2],[6,4,1],[9,7,3]]
{ "name": "maxSpending", "params": [ { "name": "values", "type": "integer[][]" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting', 'Heap (Priority Queue)', 'Matrix']
2,932
Maximum Strong Pair XOR I
maximum-strong-pair-xor-i
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>. A pair of integers <code>x</code> and <code>y</code> is called a <strong>strong</strong> pair if it satisfies the condition:</p> <ul> <li><code>|x - y| &lt;= min(x, y)</code></li> </ul> <p>You need to select two integers from <code>nums</...
Easy
47K
63.1K
47,037
63,094
74.6%
['maximum-xor-of-two-numbers-in-an-array', 'maximum-xor-with-an-element-from-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumStrongPairXor(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumStrongPairXor(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "...
[1,2,3,4,5]
{ "name": "maximumStrongPairXor", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Bit Manipulation', 'Trie', 'Sliding Window']
2,933
High-Access Employees
high-access-employees
<p>You are given a 2D <strong>0-indexed</strong> array of strings, <code>access_times</code>, with size <code>n</code>. For each <code>i</code> where <code>0 &lt;= i &lt;= n - 1</code>, <code>access_times[i][0]</code> represents the name of an employee, and <code>access_times[i][1]</code> represents the access time of ...
Medium
27.3K
59.9K
27,323
59,851
45.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> findHighAccessEmployees(vector<vector<string>>& access_times) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> findHighAccessEmployees(List<List<String>> ac...
[["a","0549"],["b","0457"],["a","0532"],["a","0621"],["b","0540"]]
{ "name": "findHighAccessEmployees", "params": [ { "name": "access_times", "type": "list<list<string>>" } ], "return": { "type": "list<string>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String', 'Sorting']
2,934
Minimum Operations to Maximize Last Elements in Arrays
minimum-operations-to-maximize-last-elements-in-arrays
<p>You are given two <strong>0-indexed</strong> integer arrays, <code>nums1</code> and <code>nums2</code>, both having length <code>n</code>.</p> <p>You are allowed to perform a series of <strong>operations</strong> (<strong>possibly none</strong>).</p> <p>In an operation, you select an index <code>i</code> in the ra...
Medium
13.5K
31.4K
13,484
31,358
43.0%
['minimum-swaps-to-make-sequences-increasing']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(int[] nums1, int[] nums2) {\n \n }\n}"}, {"value"...
[1,2,7] [4,5,3]
{ "name": "minOperations", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Enumeration']
2,935
Maximum Strong Pair XOR II
maximum-strong-pair-xor-ii
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>. A pair of integers <code>x</code> and <code>y</code> is called a <strong>strong</strong> pair if it satisfies the condition:</p> <ul> <li><code>|x - y| &lt;= min(x, y)</code></li> </ul> <p>You need to select two integers from <code>nums</...
Hard
7.3K
23.9K
7,278
23,947
30.4%
['maximum-xor-of-two-numbers-in-an-array', 'maximum-xor-with-an-element-from-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumStrongPairXor(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumStrongPairXor(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "...
[1,2,3,4,5]
{ "name": "maximumStrongPairXor", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Bit Manipulation', 'Trie', 'Sliding Window']
2,936
Number of Equal Numbers Blocks
number-of-equal-numbers-blocks
null
Medium
2.1K
3.4K
2,099
3,355
62.6%
[]
[]
Algorithms
null
[3,3,3,3,3]
{ "name": "countBlocks", "params": [ { "name": "nums", "type": "long[]" } ], "return": { "type": "integer" }, "manual": true, "languages": [ "cpp", "java", "python", "c", "csharp", "javascript", "ruby", "swift", "python3", "kotlin", "type...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Interactive']
2,937
Make Three Strings Equal
make-three-strings-equal
<p>You are given three strings: <code>s1</code>, <code>s2</code>, and <code>s3</code>. In one operation you can choose one of these strings and delete its <strong>rightmost</strong> character. Note that you <strong>cannot</strong> completely empty a string.</p> <p>Return the <em>minimum number of operations</em> requi...
Easy
34K
79.3K
33,991
79,304
42.9%
['delete-operation-for-two-strings']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMinimumOperations(string s1, string s2, string s3) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMinimumOperations(String s1, String s2, String s3) {\n \n ...
"abc" "abb" "ab"
{ "name": "findMinimumOperations", "params": [ { "name": "s1", "type": "string" }, { "type": "string", "name": "s2" }, { "type": "string", "name": "s3" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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,938
Separate Black and White Balls
separate-black-and-white-balls
<p>There are <code>n</code> balls on a table, each ball has a color black or white.</p> <p>You are given a <strong>0-indexed</strong> binary string <code>s</code> of length <code>n</code>, where <code>1</code> and <code>0</code> represent black and white balls, respectively.</p> <p>In each step, you can choose two ad...
Medium
169.8K
262.6K
169,828
262,604
64.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumSteps(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumSteps(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
"101"
{ "name": "minimumSteps", "params": [ { "type": "string", "name": "s" } ], "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...
['Two Pointers', 'String', 'Greedy']
2,939
Maximum Xor Product
maximum-xor-product
<p>Given three integers <code>a</code>, <code>b</code>, and <code>n</code>, return <em>the <strong>maximum value</strong> of</em> <code>(a XOR x) * (b XOR x)</code> <em>where</em> <code>0 &lt;= x &lt; 2<sup>n</sup></code>.</p> <p>Since the answer may be too large, return it <strong>modulo</strong> <code>10<sup>9 </sup...
Medium
11K
41.4K
11,036
41,355
26.7%
['maximum-xor-after-operations']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumXorProduct(long long a, long long b, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumXorProduct(long a, long b, int n) {\n \n }\n}"}, {"value": ...
12 5 4
{ "name": "maximumXorProduct", "params": [ { "name": "a", "type": "long" }, { "type": "long", "name": "b" }, { "type": "integer", "name": "n" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Greedy', 'Bit Manipulation']
2,940
Find Building Where Alice and Bob Can Meet
find-building-where-alice-and-bob-can-meet
<p>You are given a <strong>0-indexed</strong> array <code>heights</code> of positive integers, where <code>heights[i]</code> represents the height of the <code>i<sup>th</sup></code> building.</p> <p>If a person is in building <code>i</code>, they can move to any other building <code>j</code> if and only if <code>i &lt...
Hard
68.8K
131.2K
68,780
131,219
52.4%
['number-of-visible-people-in-a-queue', 'furthest-building-you-can-reach']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> leftmostBuildingQueries(vector<int>& heights, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] leftmostBuildingQueries(int[] heights, in...
[6,4,8,5,2,7] [[0,1],[0,3],[2,4],[3,4],[2,2]]
{ "name": "leftmostBuildingQueries", "params": [ { "name": "heights", "type": "integer[]" }, { "type": "integer[][]", "name": "queries" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Stack', 'Binary Indexed Tree', 'Segment Tree', 'Heap (Priority Queue)', 'Monotonic Stack']
2,941
Maximum GCD-Sum of a Subarray
maximum-gcd-sum-of-a-subarray
null
Hard
521
1.4K
521
1,434
36.3%
[]
[]
Algorithms
null
[2,1,4,4,4,2] 2
{ "name": "maxGcdSum", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Binary Search', 'Number Theory']
2,942
Find Words Containing Character
find-words-containing-character
<p>You are given a <strong>0-indexed</strong> array of strings <code>words</code> and a character <code>x</code>.</p> <p>Return <em>an <strong>array of indices</strong> representing the words that contain the character </em><code>x</code>.</p> <p><strong>Note</strong> that the returned array may be in <strong>any</st...
Easy
191.8K
217K
191,796
217,026
88.4%
['find-target-indices-after-sorting-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findWordsContaining(vector<string>& words, char x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> findWordsContaining(String[] words, char x) {\n \n ...
["leet","code"] "e"
{ "name": "findWordsContaining", "params": [ { "name": "words", "type": "string[]" }, { "type": "character", "name": "x" } ], "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', 'String']
2,943
Maximize Area of Square Hole in Grid
maximize-area-of-square-hole-in-grid
<p>You are given the two integers, <code>n</code> and <code>m</code> and two integer arrays, <code>hBars</code> and <code>vBars</code>. The grid has <code>n + 2</code> horizontal and <code>m + 2</code> vertical bars, creating 1 x 1 unit cells. The bars are indexed starting from <code>1</code>.</p> <p>You can <strong>r...
Medium
13.1K
35.7K
13,101
35,749
36.6%
['maximal-square', 'maximum-square-area-by-removing-fences-from-a-field']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximizeSquareHoleArea(int n, int m, vector<int>& hBars, vector<int>& vBars) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximizeSquareHoleArea(int n, int m, int[] hBars, ...
2 1 [2,3] [2]
{ "name": "maximizeSquareHoleArea", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "m" }, { "type": "integer[]", "name": "hBars" }, { "type": "integer[]", "name": "vBars" } ], "return": { "type": "i...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting']
2,944
Minimum Number of Coins for Fruits
minimum-number-of-coins-for-fruits
<p>You are given an <strong>0-indexed</strong> integer array <code>prices</code> where <code>prices[i]</code> denotes the number of coins needed to purchase the <code>(i + 1)<sup>th</sup></code> fruit.</p> <p>The fruit market has the following reward for each fruit:</p> <ul> <li>If you purchase the <code>(i + 1)<sup...
Medium
19.2K
41.4K
19,181
41,377
46.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumCoins(vector<int>& prices) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumCoins(int[] prices) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
[3,1,2]
{ "name": "minimumCoins", "params": [ { "name": "prices", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Queue', 'Heap (Priority Queue)', 'Monotonic Queue']
2,945
Find Maximum Non-decreasing Array Length
find-maximum-non-decreasing-array-length
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>.</p> <p>You can perform any number of operations, where each operation involves selecting a <strong>subarray</strong> of the array and replacing it with the <strong>sum</strong> of its elements. For example, if the given array is <code>[1,3,...
Hard
5.1K
30.3K
5,094
30,289
16.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findMaximumLength(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findMaximumLength(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python...
[5,2,2]
{ "name": "findMaximumLength", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Dynamic Programming', 'Stack', 'Queue', 'Monotonic Stack', 'Monotonic Queue']
2,946
Matrix Similarity After Cyclic Shifts
matrix-similarity-after-cyclic-shifts
<p>You are given an <code>m x n</code> integer matrix <code>mat</code> and an integer <code>k</code>. The matrix rows are 0-indexed.</p> <p>The following proccess happens <code>k</code> times:</p> <ul> <li><strong>Even-indexed</strong> rows (0, 2, 4, ...) are cyclically shifted to the left.</li> </ul> <p><img src="...
Easy
26.8K
46.3K
26,830
46,342
57.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool areSimilar(vector<vector<int>>& mat, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean areSimilar(int[][] mat, int k) {\n \n }\n}"}, {"value": "python", "t...
[[1,2,3],[4,5,6],[7,8,9]] 4
{ "name": "areSimilar", "params": [ { "name": "mat", "type": "integer[][]" }, { "type": "integer", "name": "k" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Matrix', 'Simulation']
2,947
Count Beautiful Substrings I
count-beautiful-substrings-i
<p>You are given a string <code>s</code> and a positive integer <code>k</code>.</p> <p>Let <code>vowels</code> and <code>consonants</code> be the number of vowels and consonants in a string.</p> <p>A string is <strong>beautiful</strong> if:</p> <ul> <li><code>vowels == consonants</code>.</li> <li><code>(vowels * c...
Medium
24.1K
40.7K
24,117
40,666
59.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int beautifulSubstrings(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int beautifulSubstrings(String s, int k) {\n \n }\n}"}, {"value": "python", "text": ...
"baeyh" 2
{ "name": "beautifulSubstrings", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Math', 'String', 'Enumeration', 'Number Theory', 'Prefix Sum']
2,948
Make Lexicographically Smallest Array by Swapping Elements
make-lexicographically-smallest-array-by-swapping-elements
<p>You are given a <strong>0-indexed</strong> array of <strong>positive</strong> integers <code>nums</code> and a <strong>positive</strong> integer <code>limit</code>.</p> <p>In one operation, you can choose any two indices <code>i</code> and <code>j</code> and swap <code>nums[i]</code> and <code>nums[j]</code> <stron...
Medium
97.1K
161.2K
97,098
161,165
60.2%
['smallest-string-with-swaps', 'minimize-hamming-distance-after-swap-operations']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> lexicographicallySmallestArray(vector<int>& nums, int limit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] lexicographicallySmallestArray(int[] nums, int limit) {\...
[1,5,3,9,8] 2
{ "name": "lexicographicallySmallestArray", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "limit" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Union Find', 'Sorting']
2,949
Count Beautiful Substrings II
count-beautiful-substrings-ii
<p>You are given a string <code>s</code> and a positive integer <code>k</code>.</p> <p>Let <code>vowels</code> and <code>consonants</code> be the number of vowels and consonants in a string.</p> <p>A string is <strong>beautiful</strong> if:</p> <ul> <li><code>vowels == consonants</code>.</li> <li><code>(vowels * c...
Hard
6.3K
25.6K
6,269
25,569
24.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long beautifulSubstrings(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long beautifulSubstrings(String s, int k) {\n \n }\n}"}, {"value": "python", "...
"baeyh" 2
{ "name": "beautifulSubstrings", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Math', 'String', 'Number Theory', 'Prefix Sum']
2,950
Number of Divisible Substrings
number-of-divisible-substrings
null
Medium
2.8K
3.8K
2,774
3,783
73.3%
['count-substrings-divisible-by-last-digit']
[]
Algorithms
null
"asdf"
{ "name": "countDivisibleSubstrings", "params": [ { "name": "word", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Counting', 'Prefix Sum']
2,951
Find the Peaks
find-the-peaks
<p>You are given a <strong>0-indexed</strong> array <code>mountain</code>. Your task is to find all the <strong>peaks</strong> in the <code>mountain</code> array.</p> <p>Return <em>an array that consists of </em>indices<!-- notionvc: c9879de8-88bd-43b0-8224-40c4bee71cd6 --><em> of <strong>peaks</strong> in the given a...
Easy
62.9K
85K
62,876
85,034
73.9%
['find-peak-element', 'find-a-peak-element-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findPeaks(vector<int>& mountain) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> findPeaks(int[] mountain) {\n \n }\n}"}, {"value": "python", "text...
[2,4,4]
{ "name": "findPeaks", "params": [ { "name": "mountain", "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', 'Enumeration']
2,952
Minimum Number of Coins to be Added
minimum-number-of-coins-to-be-added
<p>You are given a <strong>0-indexed</strong> integer array <code>coins</code>, representing the values of the coins available, and an integer <code>target</code>.</p> <p>An integer <code>x</code> is <strong>obtainable</strong> if there exists a subsequence of <code>coins</code> that sums to <code>x</code>.</p> <p>Re...
Medium
23.2K
41.1K
23,186
41,100
56.4%
['coin-change', 'most-expensive-item-that-can-not-be-bought']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumAddedCoins(vector<int>& coins, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumAddedCoins(int[] coins, int target) {\n \n }\n}"}, {"value":...
[1,4,10] 19
{ "name": "minimumAddedCoins", "params": [ { "name": "coins", "type": "integer[]" }, { "type": "integer", "name": "target" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting']
2,953
Count Complete Substrings
count-complete-substrings
<p>You are given a string <code>word</code> and an integer <code>k</code>.</p> <p>A substring <code>s</code> of <code>word</code> is <strong>complete</strong> if:</p> <ul> <li>Each character in <code>s</code> occurs <strong>exactly</strong> <code>k</code> times.</li> <li>The difference between two adjacent characte...
Hard
9.1K
32.2K
9,066
32,181
28.2%
['number-of-substrings-containing-all-three-characters', 'count-substrings-without-repeating-character']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countCompleteSubstrings(string word, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countCompleteSubstrings(String word, int k) {\n \n }\n}"}, {"value": "pyt...
"igigee" 2
{ "name": "countCompleteSubstrings", "params": [ { "name": "word", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Sliding Window']
2,954
Count the Number of Infection Sequences
count-the-number-of-infection-sequences
<p>You are given an integer <code>n</code> and an array <code>sick</code> sorted in increasing order, representing positions of infected people in a line of <code>n</code> people.</p> <p>At each step, <strong>one </strong>uninfected person <strong>adjacent</strong> to an infected person gets infected. This process con...
Hard
3.9K
11.9K
3,941
11,948
33.0%
['contain-virus', 'amount-of-time-for-binary-tree-to-be-infected']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfSequence(int n, vector<int>& sick) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfSequence(int n, int[] sick) {\n \n }\n}"}, {"value": "python", "te...
5 [0,4]
{ "name": "numberOfSequence", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[]", "name": "sick" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Combinatorics']
2,955
Number of Same-End Substrings
number-of-same-end-substrings
null
Medium
8.6K
14.1K
8,635
14,078
61.3%
[]
[]
Algorithms
null
"abcaab" [[0,0],[1,4],[2,5],[0,5]]
{ "name": "sameEndSubstringCount", "params": [ { "name": "s", "type": "string" }, { "type": "integer[][]", "name": "queries" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'String', 'Counting', 'Prefix Sum']
2,956
Find Common Elements Between Two Arrays
find-common-elements-between-two-arrays
<p>You are given two integer arrays <code>nums1</code> and <code>nums2</code> of sizes <code>n</code> and <code>m</code>, respectively. Calculate the following values:</p> <ul> <li><code>answer1</code> : the number of indices <code>i</code> such that <code>nums1[i]</code> exists in <code>nums2</code>.</li> <li><code...
Easy
80.6K
96.6K
80,555
96,593
83.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findIntersectionValues(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findIntersectionValues(int[] nums1, int[] nums2) {\n ...
[2,3,2] [1,2]
{ "name": "findIntersectionValues", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table']
2,957
Remove Adjacent Almost-Equal Characters
remove-adjacent-almost-equal-characters
<p>You are given a <strong>0-indexed</strong> string <code>word</code>.</p> <p>In one operation, you can pick any index <code>i</code> of <code>word</code> and change <code>word[i]</code> to any lowercase English letter.</p> <p>Return <em>the <strong>minimum</strong> number of operations needed to remove all adjacent...
Medium
25K
48.6K
24,991
48,608
51.4%
['minimum-changes-to-make-alternating-binary-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int removeAlmostEqualCharacters(string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int removeAlmostEqualCharacters(String word) {\n \n }\n}"}, {"value": "python", ...
"aaaaa"
{ "name": "removeAlmostEqualCharacters", "params": [ { "name": "word", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming', 'Greedy']
2,958
Length of Longest Subarray With at Most K Frequency
length-of-longest-subarray-with-at-most-k-frequency
<p>You are given an integer array <code>nums</code> and an integer <code>k</code>.</p> <p>The <strong>frequency</strong> of an element <code>x</code> is the number of times it occurs in an array.</p> <p>An array is called <strong>good</strong> if the frequency of each element in this array is <strong>less than or equ...
Medium
166.7K
299.7K
166,686
299,695
55.6%
['longest-substring-with-at-least-k-repeating-characters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSubarrayLength(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSubarrayLength(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "...
[1,2,3,1,2,3,1,2] 2
{ "name": "maxSubarrayLength", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Sliding Window']
2,959
Number of Possible Sets of Closing Branches
number-of-possible-sets-of-closing-branches
<p>There is a company with <code>n</code> branches across the country, some of which are connected by roads. Initially, all branches are reachable from each other by traveling some roads.</p> <p>The company has realized that they are spending an excessive amount of time traveling between their branches. As a result, t...
Hard
8.5K
17.8K
8,510
17,772
47.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfSets(int n, int maxDistance, vector<vector<int>>& roads) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfSets(int n, int maxDistance, int[][] roads) {\n ...
3 5 [[0,1,2],[1,2,10],[0,2,10]]
{ "name": "numberOfSets", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "maxDistance" }, { "type": "integer[][]", "name": "roads" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Graph', 'Heap (Priority Queue)', 'Enumeration', 'Shortest Path']
2,960
Count Tested Devices After Test Operations
count-tested-devices-after-test-operations
<p>You are given a <strong>0-indexed</strong> integer array <code>batteryPercentages</code> having length <code>n</code>, denoting the battery percentages of <code>n</code> <strong>0-indexed</strong> devices.</p> <p>Your task is to test each device <code>i</code> <strong>in order</strong> from <code>0</code> to <code>...
Easy
47.8K
61K
47,793
61,009
78.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countTestedDevices(vector<int>& batteryPercentages) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countTestedDevices(int[] batteryPercentages) {\n \n }\n}"}, {"val...
[1,1,2,1,3]
{ "name": "countTestedDevices", "params": [ { "name": "batteryPercentages", "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', 'Counting']
2,961
Double Modular Exponentiation
double-modular-exponentiation
<p>You are given a <strong>0-indexed</strong> 2D array <code>variables</code> where <code>variables[i] = [a<sub>i</sub>, b<sub>i</sub>, c<sub>i,</sub> m<sub>i</sub>]</code>, and an integer <code>target</code>.</p> <p>An index <code>i</code> is <strong>good</strong> if the following formula holds:</p> <ul> <li><code>...
Medium
23.1K
49.4K
23,139
49,386
46.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getGoodIndices(vector<vector<int>>& variables, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> getGoodIndices(int[][] variables, int target) {\n ...
[[2,3,3,10],[3,3,3,1],[6,1,1,4]] 2
{ "name": "getGoodIndices", "params": [ { "name": "variables", "type": "integer[][]" }, { "type": "integer", "name": "target" } ], "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', 'Math', 'Simulation']
2,962
Count Subarrays Where Max Element Appears at Least K Times
count-subarrays-where-max-element-appears-at-least-k-times
<p>You are given an integer array <code>nums</code> and a <strong>positive</strong> integer <code>k</code>.</p> <p>Return <em>the number of subarrays where the <strong>maximum</strong> element of </em><code>nums</code><em> appears <strong>at least</strong> </em><code>k</code><em> times in that subarray.</em></p> <p>A...
Medium
141.8K
242.6K
141,756
242,554
58.4%
['find-the-number-of-subarrays-where-boundary-elements-are-maximum']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countSubarrays(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countSubarrays(int[] nums, int k) {\n \n }\n}"}, {"value": "python", ...
[1,3,2,3,3] 2
{ "name": "countSubarrays", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sliding Window']
2,963
Count the Number of Good Partitions
count-the-number-of-good-partitions
<p>You are given a <strong>0-indexed</strong> array <code>nums</code> consisting of <strong>positive</strong> integers.</p> <p>A partition of an array into one or more <strong>contiguous</strong> subarrays is called <strong>good</strong> if no two subarrays contain the same number.</p> <p>Return <em>the <strong>total...
Hard
12.4K
26.7K
12,367
26,746
46.2%
['check-if-there-is-a-valid-partition-for-the-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfGoodPartitions(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfGoodPartitions(int[] nums) {\n \n }\n}"}, {"value": "python", "text...
[1,2,3,4]
{ "name": "numberOfGoodPartitions", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Math', 'Combinatorics']
2,964
Number of Divisible Triplet Sums
number-of-divisible-triplet-sums
null
Medium
6.3K
9.3K
6,281
9,337
67.3%
[]
[]
Algorithms
null
[3,3,4,7,8] 5
{ "name": "divisibleTripletCount", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "d" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table']
2,965
Find Missing and Repeated Values
find-missing-and-repeated-values
<p>You are given a <strong>0-indexed</strong> 2D integer matrix <code><font face="monospace">grid</font></code> of size <code>n * n</code> with values in the range <code>[1, n<sup>2</sup>]</code>. Each integer appears <strong>exactly once</strong> except <code>a</code> which appears <strong>twice</strong> and <code>b</...
Easy
240K
286.8K
240,003
286,769
83.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findMissingAndRepeatedValues(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findMissingAndRepeatedValues(int[][] grid) {\n \n }...
[[1,3],[2,2]]
{ "name": "findMissingAndRepeatedValues", "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', 'Hash Table', 'Math', 'Matrix']
2,966
Divide Array Into Arrays With Max Difference
divide-array-into-arrays-with-max-difference
<p>You are given an integer array <code>nums</code> of size <code>n</code> where <code>n</code> is a multiple of 3 and a positive integer <code>k</code>.</p> <p>Divide the array <code>nums</code> into <code>n / 3</code> arrays of size <strong>3</strong> satisfying the following condition:</p> <ul> <li>The difference...
Medium
158.2K
220.8K
158,236
220,831
71.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> divideArray(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] divideArray(int[] nums, int k) {\n \n }\n}"}, {"value": "py...
[1,3,4,8,7,9,3,5,1] 2
{ "name": "divideArray", "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,967
Minimum Cost to Make Array Equalindromic
minimum-cost-to-make-array-equalindromic
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> having length <code>n</code>.</p> <p>You are allowed to perform a special move <strong>any</strong> number of times (<strong>including zero</strong>) on <code>nums</code>. In one <strong>special</strong> <strong>move</strong> you perform the...
Medium
14.4K
64.6K
14,403
64,556
22.3%
['minimum-moves-to-equal-array-elements-ii', 'minimum-cost-to-make-array-equal']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumCost(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumCost(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
[1,2,3,4,5]
{ "name": "minimumCost", "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', 'Math', 'Binary Search', 'Greedy', 'Sorting']
2,968
Apply Operations to Maximize Frequency Score
apply-operations-to-maximize-frequency-score
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and an integer <code>k</code>.</p> <p>You can perform the following operation on the array <strong>at most</strong> <code>k</code> times:</p> <ul> <li>Choose any index <code>i</code> from the array and <strong>increase</strong> or <strong>...
Hard
7.8K
21.6K
7,774
21,587
36.0%
['frequency-of-the-most-frequent-element']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxFrequencyScore(vector<int>& nums, long long k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxFrequencyScore(int[] nums, long k) {\n \n }\n}"}, {"value": "pyt...
[1,2,6,4] 3
{ "name": "maxFrequencyScore", "params": [ { "name": "nums", "type": "integer[]" }, { "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', 'Sliding Window', 'Sorting', 'Prefix Sum']
2,969
Minimum Number of Coins for Fruits II
minimum-number-of-coins-for-fruits-ii
null
Hard
781
1.7K
781
1,733
45.1%
[]
[]
Algorithms
null
[3,1,2]
{ "name": "minimumCoins", "params": [ { "name": "prices", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Queue', 'Heap (Priority Queue)', 'Monotonic Queue']
2,970
Count the Number of Incremovable Subarrays I
count-the-number-of-incremovable-subarrays-i
<p>You are given a <strong>0-indexed</strong> array of <strong>positive</strong> integers <code>nums</code>.</p> <p>A subarray of <code>nums</code> is called <strong>incremovable</strong> if <code>nums</code> becomes <strong>strictly increasing</strong> on removing the subarray. For example, the subarray <code>[3, 4]<...
Easy
25.8K
47.5K
25,808
47,539
54.3%
['shortest-subarray-to-be-removed-to-make-array-sorted', 'number-of-subarrays-that-match-a-pattern-i']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int incremovableSubarrayCount(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int incremovableSubarrayCount(int[] nums) {\n \n }\n}"}, {"value": "python",...
[1,2,3,4]
{ "name": "incremovableSubarrayCount", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Two Pointers', 'Binary Search', 'Enumeration']
2,971
Find Polygon With the Largest Perimeter
find-polygon-with-the-largest-perimeter
<p>You are given an array of <strong>positive</strong> integers <code>nums</code> of length <code>n</code>.</p> <p>A <strong>polygon</strong> is a closed plane figure that has at least <code>3</code> sides. The <strong>longest side</strong> of a polygon is <strong>smaller</strong> than the sum of its other sides.</p> ...
Medium
139.4K
213.5K
139,427
213,453
65.3%
['3sum-smaller', 'valid-triangle-number']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long largestPerimeter(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long largestPerimeter(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "P...
[5,5,5]
{ "name": "largestPerimeter", "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', 'Greedy', 'Sorting', 'Prefix Sum']
2,972
Count the Number of Incremovable Subarrays II
count-the-number-of-incremovable-subarrays-ii
<p>You are given a <strong>0-indexed</strong> array of <strong>positive</strong> integers <code>nums</code>.</p> <p>A subarray of <code>nums</code> is called <strong>incremovable</strong> if <code>nums</code> becomes <strong>strictly increasing</strong> on removing the subarray. For example, the subarray <code>[3, 4]<...
Hard
9.6K
24.8K
9,577
24,778
38.7%
['shortest-subarray-to-be-removed-to-make-array-sorted']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long incremovableSubarrayCount(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long incremovableSubarrayCount(int[] nums) {\n \n }\n}"}, {"value": "p...
[1,2,3,4]
{ "name": "incremovableSubarrayCount", "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', 'Two Pointers', 'Binary Search']
2,973
Find Number of Coins to Place in Tree Nodes
find-number-of-coins-to-place-in-tree-nodes
<p>You are given an <strong>undirected</strong> tree with <code>n</code> nodes labeled from <code>0</code> to <code>n - 1</code>, and rooted at node <code>0</code>. You are given a 2D integer array <code>edges</code> of length <code>n - 1</code>, where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates th...
Hard
9.5K
26.6K
9,519
26,562
35.8%
['collect-coins-in-a-tree', 'find-the-maximum-sum-of-node-values']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<long long> placedCoins(vector<vector<int>>& edges, vector<int>& cost) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long[] placedCoins(int[][] edges, int[] cost) {\n \...
[[0,1],[0,2],[0,3],[0,4],[0,5]] [1,2,3,4,5,6]
{ "name": "placedCoins", "params": [ { "name": "edges", "type": "integer[][]" }, { "type": "integer[]", "name": "cost" } ], "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...
['Dynamic Programming', 'Tree', 'Depth-First Search', 'Sorting', 'Heap (Priority Queue)']
2,974
Minimum Number Game
minimum-number-game
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> of <strong>even</strong> length and there is also an empty array <code>arr</code>. Alice and Bob decided to play a game where in every round Alice and Bob will do one move. The rules of the game are as follows:</p> <ul> <li>Every round, fir...
Easy
110K
129.9K
110,033
129,879
84.7%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> numberGame(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] numberGame(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "...
[5,4,2,3]
{ "name": "numberGame", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting', 'Heap (Priority Queue)', 'Simulation']
2,975
Maximum Square Area by Removing Fences From a Field
maximum-square-area-by-removing-fences-from-a-field
<p>There is a large <code>(m - 1) x (n - 1)</code> rectangular field with corners at <code>(1, 1)</code> and <code>(m, n)</code> containing some horizontal and vertical fences given in arrays <code>hFences</code> and <code>vFences</code> respectively.</p> <p>Horizontal fences are from the coordinates <code>(hFences[i]...
Medium
16.2K
68.1K
16,222
68,052
23.8%
['maximize-area-of-square-hole-in-grid']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximizeSquareArea(int m, int n, vector<int>& hFences, vector<int>& vFences) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximizeSquareArea(int m, int n, int[] hFences, in...
4 3 [2,3] [2]
{ "name": "maximizeSquareArea", "params": [ { "name": "m", "type": "integer" }, { "type": "integer", "name": "n" }, { "type": "integer[]", "name": "hFences" }, { "type": "integer[]", "name": "vFences" } ], "return": { "type": "i...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Enumeration']
2,976
Minimum Cost to Convert String I
minimum-cost-to-convert-string-i
<p>You are given two <strong>0-indexed</strong> strings <code>source</code> and <code>target</code>, both of length <code>n</code> and consisting of <strong>lowercase</strong> English letters. You are also given two <strong>0-indexed</strong> character arrays <code>original</code> and <code>changed</code>, and an integ...
Medium
106.2K
183.9K
106,156
183,945
57.7%
['can-convert-string-in-k-moves', 'minimum-moves-to-convert-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumCost(string source, string target, vector<char>& original, vector<char>& changed, vector<int>& cost) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumCost(...
"abcd" "acbe" ["a","b","c","c","e","d"] ["b","c","b","e","b","e"] [2,5,5,1,2,20]
{ "name": "minimumCost", "params": [ { "name": "source", "type": "string" }, { "type": "string", "name": "target" }, { "type": "character[]", "name": "original" }, { "type": "character[]", "name": "changed" }, { "type": "integ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Graph', 'Shortest Path']
2,977
Minimum Cost to Convert String II
minimum-cost-to-convert-string-ii
<p>You are given two <strong>0-indexed</strong> strings <code>source</code> and <code>target</code>, both of length <code>n</code> and consisting of <strong>lowercase</strong> English characters. You are also given two <strong>0-indexed</strong> string arrays <code>original</code> and <code>changed</code>, and an integ...
Hard
5.8K
22.8K
5,779
22,848
25.3%
['can-convert-string-in-k-moves', 'minimum-moves-to-convert-string', 'minimum-number-of-valid-strings-to-form-target-ii', 'minimum-number-of-valid-strings-to-form-target-i']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long minimumCost(string source, string target, vector<string>& original, vector<string>& changed, vector<int>& cost) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long minimumC...
"abcd" "acbe" ["a","b","c","c","e","d"] ["b","c","b","e","b","e"] [2,5,5,1,2,20]
{ "name": "minimumCost", "params": [ { "name": "source", "type": "string" }, { "type": "string", "name": "target" }, { "type": "string[]", "name": "original" }, { "type": "string[]", "name": "changed" }, { "type": "integer[]",...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'Dynamic Programming', 'Graph', 'Trie', 'Shortest Path']
2,978
Symmetric Coordinates
symmetric-coordinates
null
Medium
2.2K
5.4K
2,200
5,408
40.7%
[]
['Create table If Not Exists Coordinates (X int, Y int)', 'Truncate table Coordinates', "insert into Coordinates (X, Y) values ('20', '20')", "insert into Coordinates (X, Y) values ('20', '20')", "insert into Coordinates (X, Y) values ('20', '21')", "insert into Coordinates (X, Y) values ('23', '22')", "insert into Coo...
Database
null
{"headers":{"Coordinates":["X","Y"]},"rows":{"Coordinates":[[20,20],[20,20],[20,21],[23,22],[22,23],[21,20]]}}
{"mysql": ["Create table If Not Exists Coordinates (X int, Y int)"], "mssql": ["Create table Coordinates (X int,Y int)"], "oraclesql": ["Create table Coordinates (X int,Y int)"], "database": true, "name": "symmetric_pairs", "pythondata": ["Coordinates = pd.DataFrame([], columns=['X', 'Y']).astype({'X':'Int64', 'Y':'Int...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
2,979
Most Expensive Item That Can Not Be Bought
most-expensive-item-that-can-not-be-bought
null
Medium
5.8K
7.2K
5,763
7,182
80.2%
['coin-change', 'minimum-cost-for-tickets', 'minimum-number-of-coins-to-be-added']
[]
Algorithms
null
2 5
{ "name": "mostExpensiveItem", "params": [ { "name": "primeOne", "type": "integer" }, { "type": "integer", "name": "primeTwo" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Dynamic Programming', 'Number Theory']
2,980
Check if Bitwise OR Has Trailing Zeros
check-if-bitwise-or-has-trailing-zeros
<p>You are given an array of <strong>positive</strong> integers <code>nums</code>.</p> <p>You have to check if it is possible to select <strong>two or more</strong> elements in the array such that the bitwise <code>OR</code> of the selected elements has <strong>at least </strong>one trailing zero in its binary represe...
Easy
39.5K
56.8K
39,482
56,846
69.5%
['count-odd-numbers-in-an-interval-range', 'remove-trailing-zeros-from-a-string']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool hasTrailingZeros(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean hasTrailingZeros(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Pyt...
[1,2,3,4,5]
{ "name": "hasTrailingZeros", "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', 'Bit Manipulation']
2,981
Find Longest Special Substring That Occurs Thrice I
find-longest-special-substring-that-occurs-thrice-i
<p>You are given a string <code>s</code> that consists of lowercase English letters.</p> <p>A string is called <strong>special</strong> if it is made up of only a single character. For example, the string <code>&quot;abc&quot;</code> is not special, whereas the strings <code>&quot;ddd&quot;</code>, <code>&quot;zz&quot...
Medium
125.5K
202.9K
125,538
202,917
61.9%
['longest-substring-without-repeating-characters', 'longest-substring-with-at-least-k-repeating-characters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumLength(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumLength(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
"aaaa"
{ "name": "maximumLength", "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', 'Binary Search', 'Sliding Window', 'Counting']
2,982
Find Longest Special Substring That Occurs Thrice II
find-longest-special-substring-that-occurs-thrice-ii
<p>You are given a string <code>s</code> that consists of lowercase English letters.</p> <p>A string is called <strong>special</strong> if it is made up of only a single character. For example, the string <code>&quot;abc&quot;</code> is not special, whereas the strings <code>&quot;ddd&quot;</code>, <code>&quot;zz&quot...
Medium
27.8K
72.7K
27,754
72,695
38.2%
['longest-substring-without-repeating-characters', 'longest-substring-with-at-least-k-repeating-characters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumLength(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumLength(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
"aaaa"
{ "name": "maximumLength", "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', 'Binary Search', 'Sliding Window', 'Counting']
2,983
Palindrome Rearrangement Queries
palindrome-rearrangement-queries
<p>You are given a <strong>0-indexed</strong> string <code>s</code> having an <strong>even</strong> length <code>n</code>.</p> <p>You are also given a <strong>0-indexed</strong> 2D integer array, <code>queries</code>, where <code>queries[i] = [a<sub>i</sub>, b<sub>i</sub>, c<sub>i</sub>, d<sub>i</sub>]</code>.</p> <p...
Hard
3.6K
16K
3,649
15,959
22.9%
['longest-chunked-palindrome-decomposition']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> canMakePalindromeQueries(string s, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean[] canMakePalindromeQueries(String s, int[][] quer...
"abcabc" [[1,1,3,5],[0,2,5,5]]
{ "name": "canMakePalindromeQueries", "params": [ { "name": "s", "type": "string" }, { "type": "integer[][]", "name": "queries" } ], "return": { "type": "boolean[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Prefix Sum']
2,984
Find Peak Calling Hours for Each City
find-peak-calling-hours-for-each-city
null
Medium
2.8K
4.5K
2,769
4,475
61.9%
[]
['Create table If Not Exists Calls (caller_id int, recipient_id int, call_time datetime, city varchar(40))', 'Truncate table Calls', "insert into Calls (caller_id, recipient_id, call_time, city) values ('8', '4', '2021-08-24 22:46:07', 'Houston')", "insert into Calls (caller_id, recipient_id, call_time, city) values ('...
Database
null
{"headers":{"Calls":["caller_id","recipient_id","call_time","city"]},"rows":{"Calls":[[8,4,"2021-08-24 22:46:07","Houston"],[4,8,"2021-08-24 22:57:13","Houston"],[5,1,"2021-08-11 21:28:44","Houston"],[8,3,"2021-08-17 22:04:15","Houston"],[11,3,"2021-08-17 13:07:00","New York"],[8,11,"2021-08-17 14:22:22","New York"]]}}
{"mysql": ["Create table If Not Exists Calls (caller_id int, recipient_id int, call_time datetime, city varchar(40))"], "mssql": ["Create table Calls (caller_id int, recipient_id int, call_time datetime, city varchar(40))"], "oraclesql": ["Create table Calls (caller_id int, recipient_id int, call_time date, city varcha...
{"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,985
Calculate Compressed Mean
calculate-compressed-mean
null
Easy
4.1K
4.6K
4,079
4,625
88.2%
[]
['Create Table if Not Exists Orders ( order_id int, item_count int, order_occurrences int)', 'Truncate table Orders', "insert into Orders (order_id, item_count, order_occurrences) values ('10', '1', '500')", "insert into Orders (order_id, item_count, order_occurrences) values ('11', '2', '1000')", "insert into Orders (...
Database
null
{"headers":{"Orders":["order_id","item_count","order_occurrences"]},"rows":{"Orders":[[10,1,500],[11,2,1000],[12,3,800],[13,4,1000]]}}
{"mysql": ["Create Table if Not Exists Orders ( order_id int, item_count int, order_occurrences int)"], "mssql": ["Create Table Orders ( order_id int, item_count int, order_occurrences int)"], "oraclesql": ["Create Table Orders ( order_id int, item_count int, order_occurrences int)"], "database": true, "name": "compres...
{"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,986
Find Third Transaction
find-third-transaction
null
Medium
3K
5.7K
3,040
5,665
53.7%
[]
['Create Table if Not Exists Transactions (user_id int, spend decimal(5,2), transaction_date datetime) ', 'Truncate table Transactions', "insert into Transactions (user_id, spend, transaction_date) values ('1', '65.56', '2023-11-18 13:49:42')", "insert into Transactions (user_id, spend, transaction_date) values ('1', '...
Database
null
{"headers":{"Transactions":["user_id","spend","transaction_date"]},"rows":{"Transactions":[[1,65.56,"2023-11-18 13:49:42"],[1,96.0,"2023-11-30 02:47:26"],[1,7.44,"2023-11-02 12:15:23"],[1,49.78,"2023-11-12 00:13:46"],[2,40.89,"2023-11-21 04:39:15"],[2,100.44,"2023-11-20 07:39:34"],[3,37.33,"2023-11-03 06:22:02"],[3,13....
{"mysql": ["Create Table if Not Exists Transactions (user_id int, spend decimal(5,2), transaction_date datetime) "], "mssql": ["Create Table Transactions (user_id int, spend decimal(5,2), transaction_date datetime) "], "oraclesql": ["Create Table Transactions (user_id int, spend decimal(5,2), transaction_date date) ", ...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
2,987
Find Expensive Cities
find-expensive-cities
null
Easy
4.2K
5.2K
4,190
5,236
80.0%
[]
['Create Table if Not Exists Listings (listing_id int, city varchar(50), price int)', 'Truncate table Listings', "insert into Listings (listing_id, city, price) values ('113', 'LosAngeles', '7560386')", "insert into Listings (listing_id, city, price) values ('136', 'SanFrancisco', '2380268')", "insert into Listings (li...
Database
null
{"headers":{"Listings":["listing_id","city","price"]},"rows":{"Listings":[[113,"LosAngeles",7560386],[136,"SanFrancisco",2380268],[92,"Chicago",9833209],[60,"Chicago",5147582],[8,"Chicago",5274441],[79,"SanFrancisco",8372065],[37,"Chicago",7939595],[53,"LosAngeles",4965123],[178,"SanFrancisco",999207],[51,"NewYork",595...
{"mysql": ["Create Table if Not Exists Listings (listing_id int, city varchar(50), price int)"], "mssql": ["Create Table Listings (listing_id int, city varchar(50), price int)"], "oraclesql": ["Create Table Listings (listing_id int, city varchar(50), price int)"], "database": true, "name": "find_expensive_cities", "po...
{"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,988
Manager of the Largest Department
manager-of-the-largest-department
null
Medium
3.3K
4.1K
3,285
4,067
80.8%
[]
['Create table if not exists Employees ( emp_id int, emp_name varchar(50), dep_id int, position varchar(30))', 'Truncate table Employees', "insert into Employees (emp_id, emp_name, dep_id, position) values ('156', 'Michael', '107', 'Manager')", "insert into Employees (emp_id, emp_name, dep_id, position) values ('112', ...
Database
null
{"headers":{"Employees":["emp_id","emp_name","dep_id","position"]},"rows":{"Employees":[[156,"Michael",107,"Manager"],[112,"Lucas",107,"Consultant"],[8,"Isabella",101,"Manager"],[160,"Joseph",100,"Manager"],[80,"Aiden",100,"Engineer"],[190,"Skylar",100,"Freelancer"],[196,"Stella",101,"Coordinator"],[167,"Audrey",100,"C...
{"mysql": ["Create table if not exists Employees ( emp_id int, emp_name varchar(50), dep_id int, position varchar(30))"], "mssql": ["Create table Employees ( emp_id int, emp_name varchar(50), dep_id int, position varchar(30))"], "oraclesql": ["Create table Employees ( emp_id int, emp_name varchar(50), dep_id int, pos...
{"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,989
Class Performance
class-performance
null
Medium
4.3K
4.8K
4,299
4,806
89.5%
[]
['Create Table if Not Exists Scores (student_id int, student_name varchar(40), assignment1 int,assignment2 int, assignment3 int)', 'Truncate table Scores', "insert into Scores (student_id, student_name, assignment1, assignment2, assignment3) values ('309', 'Owen', '88', '47', '87')", "insert into Scores (student_id, st...
Database
null
{"headers":{"Scores":["student_id","student_name","assignment1","assignment2","assignment3"]},"rows":{"Scores":[[309,"Owen",88,47,87],[321,"Claire",98,95,37],[338,"Julian",100,64,43],[423,"Peyton",60,44,47],[896,"David",32,37,50],[235,"Camila",31,53,69]]}}
{"mysql": ["Create Table if Not Exists Scores (student_id int, student_name varchar(40), assignment1 int,assignment2 int, assignment3 int)"], "mssql": ["Create Table Scores (student_id int, student_name varchar(40), assignment1 int,assignment2 int, assignment3 int)"], "oraclesql": ["Create Table Scores (student_id int,...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
2,990
Loan Types
loan-types
null
Easy
4.4K
6.9K
4,379
6,879
63.7%
[]
['Create Table if not Exists Loans ( loan_id int, user_id int, loan_type varchar(40))', 'Truncate table Loans', "insert into Loans (loan_id, user_id, loan_type) values ('683', '101', 'Mortgage')", "insert into Loans (loan_id, user_id, loan_type) values ('218', '101', 'AutoLoan')", "insert into Loans (loan_id, user_id, ...
Database
null
{"headers":{"Loans":["loan_id","user_id","loan_type"]},"rows":{"Loans":[[683,101,"Mortgage"],[218,101,"AutoLoan"],[802,101,"Inschool"],[593,102,"Mortgage"],[138,102,"Refinance"],[294,102,"Inschool"],[308,103,"Refinance"],[389,104,"Mortgage"]]}}
{"mysql": ["Create Table if not Exists Loans ( loan_id int, user_id int, loan_type varchar(40))"], "mssql": ["Create Table Loans (loan_id int, user_id int, loan_type varchar(40))"], "oraclesql": ["Create Table Loans ( loan_id int, user_id int, loan_type varchar(40))"], "database": true, "name": "loan_types", "pythond...
{"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,991
Top Three Wineries
top-three-wineries
null
Hard
2.3K
4K
2,301
4,027
57.1%
[]
['Create table if Not Exists Wineries ( id int, country varchar(60), points int, winery varchar(60))', 'Truncate table Wineries', "insert into Wineries (id, country, points, winery) values ('103', 'Australia', '84', 'WhisperingPines')", "insert into Wineries (id, country, points, winery) values ('737', 'Australia', '85...
Database
null
{"headers":{"Wineries":["id","country","points","winery"]},"rows":{"Wineries":[[103,"Australia",84,"WhisperingPines"],[737,"Australia",85,"GrapesGalore"],[848,"Australia",100,"HarmonyHill"],[222,"Hungary",60,"MoonlitCellars"],[116,"USA",47,"RoyalVines"],[124,"USA",45,"Eagle'sNest"],[648,"India",69,"SunsetVines"],[894,"...
{"mysql": ["Create table if Not Exists Wineries ( id int, country varchar(60), points int, winery varchar(60))"], "mssql": ["Create table Wineries ( id int, country varchar(60), points int, winery varchar(60))"], "oraclesql": ["Create table Wineries ( id int, country varchar(60), points int, winery varchar(60))"], "da...
{"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,992
Number of Self-Divisible Permutations
number-of-self-divisible-permutations
null
Medium
1.8K
2.5K
1,777
2,471
71.9%
[]
[]
Algorithms
null
1
{ "name": "selfDivisiblePermutationCount", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Bitmask']
2,993
Friday Purchases I
friday-purchases-i
null
Medium
2.9K
3.6K
2,918
3,603
81.0%
[]
['Create Table if Not Exists Purchases( user_id int, purchase_date date, amount_spend int)', 'Truncate table Purchases', "insert into Purchases (user_id, purchase_date, amount_spend) values ('11', '2023-11-07', '1126')", "insert into Purchases (user_id, purchase_date, amount_spend) values ('15', '2023-11-30', '7473')",...
Database
null
{"headers":{"Purchases":["user_id","purchase_date","amount_spend"]},"rows":{"Purchases":[[11,"2023-11-07",1126],[15,"2023-11-30",7473],[17,"2023-11-14",2414],[12,"2023-11-24",9692],[8,"2023-11-03",5117],[1,"2023-11-16",5241],[10,"2023-11-12",8266],[13,"2023-11-24",12000]]}}
{"mysql": ["Create Table if Not Exists Purchases( user_id int, purchase_date date, amount_spend int)"], "mssql": ["Create Table Purchases( user_id int, purchase_date date, amount_spend int)"], "oraclesql": ["Create Table Purchases( user_id int, purchase_date date, amount_spend int)", "ALTER SESSION SET nls_date_format...
{"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,994
Friday Purchases II
friday-purchases-ii
null
Hard
1.9K
2.5K
1,883
2,461
76.5%
[]
['Create Table if Not Exists Purchases( user_id int, purchase_date date, amount_spend int)', 'Truncate table Purchases', "insert into Purchases (user_id, purchase_date, amount_spend) values ('11', '2023-11-07', '1126')", "insert into Purchases (user_id, purchase_date, amount_spend) values ('15', '2023-11-30', '7473')",...
Database
null
{"headers":{"Purchases":["user_id","purchase_date","amount_spend"]},"rows":{"Purchases":[[11,"2023-11-07",1126],[15,"2023-11-30",7473],[17,"2023-11-14",2414],[12,"2023-11-24",9692],[8,"2023-11-03",5117],[1,"2023-11-16",5241],[10,"2023-11-12",8266],[13,"2023-11-24",12000]]}}
{"mysql": ["Create Table if Not Exists Purchases( user_id int, purchase_date date, amount_spend int)"], "mssql": ["Create Table Purchases( user_id int, purchase_date date, amount_spend int)"], "oraclesql": ["Create Table Purchases( user_id int, purchase_date date, amount_spend int)", "ALTER SESSION SET nls_date_format...
{"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,995
Viewers Turned Streamers
viewers-turned-streamers
null
Hard
3.3K
7.7K
3,321
7,700
43.1%
[]
["Create table If Not Exists Sessions (user_id int, session_start datetime, session_end datetime, session_id int, session_type ENUM('Viewer','Streamer'))", 'Truncate table Sessions', "insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('101', '2023-11-06 13:53:42', '2023-11-06 1...
Database
null
{"headers":{"Sessions":["user_id","session_start","session_end","session_id","session_type"]},"rows":{"Sessions":[[101,"2023-11-06 13:53:42","2023-11-06 14:05:42",375,"Viewer"],[101,"2023-11-22 16:45:21","2023-11-22 20:39:21",594,"Streamer"],[102,"2023-11-16 13:23:09","2023-11-16 16:10:09",777,"Streamer"],[102,"2023-11...
{"mysql": ["Create table If Not Exists Sessions (user_id int, session_start datetime, session_end datetime, session_id int, session_type ENUM('Viewer','Streamer'))"], "mssql": ["Create table Sessions (user_id int, session_start datetime, session_end datetime, session_id int, session_type varchar(20) NOT NULL CHECK (ses...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
2,996
Smallest Missing Integer Greater Than Sequential Prefix Sum
smallest-missing-integer-greater-than-sequential-prefix-sum
<p>You are given a <strong>0-indexed</strong> array of integers <code>nums</code>.</p> <p>A prefix <code>nums[0..i]</code> is <strong>sequential</strong> if, for all <code>1 &lt;= j &lt;= i</code>, <code>nums[j] = nums[j - 1] + 1</code>. In particular, the prefix consisting only of <code>nums[0]</code> is <strong>sequ...
Easy
39.5K
118.4K
39,494
118,351
33.4%
['longest-common-prefix', 'first-missing-positive', 'next-greater-element-i']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int missingInteger(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int missingInteger(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
[1,2,3,2,5]
{ "name": "missingInteger", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Sorting']
2,997
Minimum Number of Operations to Make Array XOR Equal to K
minimum-number-of-operations-to-make-array-xor-equal-to-k
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and a positive integer <code>k</code>.</p> <p>You can apply the following operation on the array <strong>any</strong> number of times:</p> <ul> <li>Choose <strong>any</strong> element of the array and <strong>flip</strong> a bit in its <st...
Medium
116.2K
135.6K
116,223
135,559
85.7%
['minimum-bit-flips-to-convert-number']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "...
[2,1,3,4] 1
{ "name": "minOperations", "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', 'Bit Manipulation']
2,998
Minimum Number of Operations to Make X and Y Equal
minimum-number-of-operations-to-make-x-and-y-equal
<p>You are given two positive integers <code>x</code> and <code>y</code>.</p> <p>In one operation, you can do one of the four following operations:</p> <ol> <li>Divide <code>x</code> by <code>11</code> if <code>x</code> is a multiple of <code>11</code>.</li> <li>Divide <code>x</code> by <code>5</code> if <code>x</c...
Medium
24K
51.1K
24,016
51,074
47.0%
['shortest-bridge', 'minimum-moves-to-spread-stones-over-grid']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumOperationsToMakeEqual(int x, int y) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumOperationsToMakeEqual(int x, int y) {\n \n }\n}"}, {"value": "pytho...
26 1
{ "name": "minimumOperationsToMakeEqual", "params": [ { "name": "x", "type": "integer" }, { "type": "integer", "name": "y" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Breadth-First Search', 'Memoization']
2,999
Count the Number of Powerful Integers
count-the-number-of-powerful-integers
<p>You are given three integers <code>start</code>, <code>finish</code>, and <code>limit</code>. You are also given a <strong>0-indexed</strong> string <code>s</code> representing a <strong>positive</strong> integer.</p> <p>A <strong>positive</strong> integer <code>x</code> is called <strong>powerful</strong> if it en...
Hard
71.9K
153.1K
71,887
153,070
47.0%
['powerful-integers', 'numbers-with-repeated-digits']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long numberOfPowerfulInt(long long start, long long finish, int limit, string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long numberOfPowerfulInt(long start, long finish,...
1 6000 4 "124"
{ "name": "numberOfPowerfulInt", "params": [ { "name": "start", "type": "long" }, { "type": "long", "name": "finish" }, { "type": "integer", "name": "limit" }, { "type": "string", "name": "s" } ], "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', 'String', 'Dynamic Programming']
3,000
Maximum Area of Longest Diagonal Rectangle
maximum-area-of-longest-diagonal-rectangle
<p>You are given a 2D <strong>0-indexed </strong>integer array <code>dimensions</code>.</p> <p>For all indices <code>i</code>, <code>0 &lt;= i &lt; dimensions.length</code>, <code>dimensions[i][0]</code> represents the length and <code>dimensions[i][1]</code> represents the width of the rectangle<span style="font-size...
Easy
41.4K
114.1K
41,440
114,121
36.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int areaOfMaxDiagonal(vector<vector<int>>& dimensions) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int areaOfMaxDiagonal(int[][] dimensions) {\n \n }\n}"}, {"value": "py...
[[9,3],[8,6]]
{ "name": "areaOfMaxDiagonal", "params": [ { "name": "dimensions", "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']
3,001
Minimum Moves to Capture The Queen
minimum-moves-to-capture-the-queen
<p>There is a <strong>1-indexed</strong> <code>8 x 8</code> chessboard containing <code>3</code> pieces.</p> <p>You are given <code>6</code> integers <code>a</code>, <code>b</code>, <code>c</code>, <code>d</code>, <code>e</code>, and <code>f</code> where:</p> <ul> <li><code>(a, b)</code> denotes the position of the ...
Medium
19.9K
93.5K
19,881
93,521
21.3%
['available-captures-for-rook', 'queens-that-can-attack-the-king']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minMovesToCaptureTheQueen(int a, int b, int c, int d, int e, int f) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minMovesToCaptureTheQueen(int a, int b, int c, int d, int e...
1 1 8 8 2 3
{ "name": "minMovesToCaptureTheQueen", "params": [ { "name": "a", "type": "integer" }, { "type": "integer", "name": "b" }, { "type": "integer", "name": "c" }, { "type": "integer", "name": "d" }, { "type": "integer", "nam...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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']
3,002
Maximum Size of a Set After Removals
maximum-size-of-a-set-after-removals
<p>You are given two <strong>0-indexed</strong> integer arrays <code>nums1</code> and <code>nums2</code> of even length <code>n</code>.</p> <p>You must remove <code>n / 2</code> elements from <code>nums1</code> and <code>n / 2</code> elements from <code>nums2</code>. After the removals, you insert the remaining elemen...
Medium
17.7K
39.8K
17,709
39,760
44.5%
['intersection-of-two-arrays']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumSetSize(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumSetSize(int[] nums1, int[] nums2) {\n \n }\n}"}, {"valu...
[1,2,1,2] [1,1,1,1]
{ "name": "maximumSetSize", "params": [ { "name": "nums1", "type": "integer[]" }, { "type": "integer[]", "name": "nums2" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Greedy']
3,003
Maximize the Number of Partitions After Operations
maximize-the-number-of-partitions-after-operations
<p>You are given a string <code>s</code> and an integer <code>k</code>.</p> <p>First, you are allowed to change <strong>at most</strong> <strong>one</strong> index in <code>s</code> to another lowercase English letter.</p> <p>After that, do the following partitioning operation until <code>s</code> is <strong>empty</s...
Hard
4K
14.6K
3,968
14,624
27.1%
['can-make-palindrome-from-substring']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxPartitionsAfterOperations(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxPartitionsAfterOperations(String s, int k) {\n \n }\n}"}, {"value": ...
"accca" 2
{ "name": "maxPartitionsAfterOperations", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming', 'Bit Manipulation', 'Bitmask']
3,004
Maximum Subtree of the Same Color
maximum-subtree-of-the-same-color
null
Medium
1.8K
3.2K
1,832
3,233
56.7%
[]
[]
Algorithms
null
[[0,1],[0,2],[0,3]] [1,1,2,3]
{ "name": "maximumSubtreeSize", "params": [ { "name": "edges", "type": "integer[][]" }, { "type": "integer[]", "name": "colors" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Tree', 'Depth-First Search']
3,005
Count Elements With Maximum Frequency
count-elements-with-maximum-frequency
<p>You are given an array <code>nums</code> consisting of <strong>positive</strong> integers.</p> <p>Return <em>the <strong>total frequencies</strong> of elements in</em><em> </em><code>nums</code>&nbsp;<em>such that those elements all have the <strong>maximum</strong> frequency</em>.</p> <p>The <strong>frequency</st...
Easy
234.6K
301.2K
234,561
301,152
77.9%
['maximum-frequency-of-an-element-after-performing-operations-i', 'maximum-frequency-of-an-element-after-performing-operations-ii', 'maximum-difference-between-even-and-odd-frequency-ii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxFrequencyElements(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxFrequencyElements(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "...
[1,2,2,3,1,4]
{ "name": "maxFrequencyElements", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Counting']
3,006
Find Beautiful Indices in the Given Array I
find-beautiful-indices-in-the-given-array-i
<p>You are given a <strong>0-indexed</strong> string <code>s</code>, a string <code>a</code>, a string <code>b</code>, and an integer <code>k</code>.</p> <p>An index <code>i</code> is <strong>beautiful</strong> if:</p> <ul> <li><code>0 &lt;= i &lt;= s.length - a.length</code></li> <li><code>s[i..(i + a.length - 1)]...
Medium
33.2K
87.7K
33,232
87,665
37.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> beautifulIndices(string s, string a, string b, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> beautifulIndices(String s, String a, String b, int k) {...
"isawsquirrelnearmysquirrelhouseohmy" "my" "squirrel" 15
{ "name": "beautifulIndices", "params": [ { "name": "s", "type": "string" }, { "type": "string", "name": "a" }, { "type": "string", "name": "b" }, { "type": "integer", "name": "k" } ], "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...
['Two Pointers', 'String', 'Binary Search', 'Rolling Hash', 'String Matching', 'Hash Function']
3,007
Maximum Number That Sum of the Prices Is Less Than or Equal to K
maximum-number-that-sum-of-the-prices-is-less-than-or-equal-to-k
<p>You are given an integer <code>k</code> and an integer <code>x</code>. The price of a number&nbsp;<code>num</code> is calculated by the count of <span data-keyword="set-bit">set bits</span> at positions <code>x</code>, <code>2x</code>, <code>3x</code>, etc., in its binary representation, starting from the least sign...
Medium
10.7K
29K
10,707
28,957
37.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long findMaximumNumber(long long k, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long findMaximumNumber(long k, int x) {\n \n }\n}"}, {"value": "python", "tex...
9 1
{ "name": "findMaximumNumber", "params": [ { "name": "k", "type": "long" }, { "type": "integer", "name": "x" } ], "return": { "type": "long" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Binary Search', 'Dynamic Programming', 'Bit Manipulation']
3,008
Find Beautiful Indices in the Given Array II
find-beautiful-indices-in-the-given-array-ii
<p>You are given a <strong>0-indexed</strong> string <code>s</code>, a string <code>a</code>, a string <code>b</code>, and an integer <code>k</code>.</p> <p>An index <code>i</code> is <strong>beautiful</strong> if:</p> <ul> <li><code>0 &lt;= i &lt;= s.length - a.length</code></li> <li><code>s[i..(i + a.length - 1)]...
Hard
13.9K
53.6K
13,950
53,562
26.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> beautifulIndices(string s, string a, string b, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> beautifulIndices(String s, String a, String b, int k) {...
"isawsquirrelnearmysquirrelhouseohmy" "my" "squirrel" 15
{ "name": "beautifulIndices", "params": [ { "name": "s", "type": "string" }, { "type": "string", "name": "a" }, { "type": "string", "name": "b" }, { "type": "integer", "name": "k" } ], "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...
['Two Pointers', 'String', 'Binary Search', 'Rolling Hash', 'String Matching', 'Hash Function']
3,009
Maximum Number of Intersections on the Chart
maximum-number-of-intersections-on-the-chart
null
Hard
4.1K
9.1K
4,094
9,091
45.0%
[]
[]
Algorithms
null
[1,2,1,2,1,3,2]
{ "name": "maxIntersectionCount", "params": [ { "name": "y", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Binary Indexed Tree', 'Geometry']