questionFrontendId
int64
1
3.51k
questionTitle
stringlengths
3
79
TitleSlug
stringlengths
3
79
content
stringlengths
431
25.4k
difficulty
stringclasses
3 values
totalAccepted
stringlengths
2
6
totalSubmission
stringlengths
2
6
totalAcceptedRaw
int64
124
16.8M
totalSubmissionRaw
int64
285
30.3M
acRate
stringlengths
4
5
similarQuestions
stringlengths
2
714
mysqlSchemas
stringclasses
295 values
category
stringclasses
6 values
codeDefinition
stringlengths
122
24.9k
sampleTestCase
stringlengths
1
4.33k
metaData
stringlengths
37
3.13k
envInfo
stringclasses
26 values
topicTags
stringlengths
2
153
1,601
Maximum Number of Achievable Transfer Requests
maximum-number-of-achievable-transfer-requests
<p>We have <code>n</code> buildings numbered from <code>0</code> to <code>n - 1</code>. Each building has a number of employees. It&#39;s transfer season, and some employees want to change the building they reside in.</p> <p>You are given an array <code>requests</code> where <code>requests[i] = [from<sub>i</sub>, to<s...
Hard
59.8K
92.8K
59,792
92,822
64.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumRequests(int n, vector<vector<int>>& requests) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumRequests(int n, int[][] requests) {\n \n }\n}"}, {"value...
5 [[0,1],[1,0],[0,1],[1,2],[2,0],[3,4]]
{ "name": "maximumRequests", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "requests" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Backtracking', 'Bit Manipulation', 'Enumeration']
1,602
Find Nearest Right Node in Binary Tree
find-nearest-right-node-in-binary-tree
null
Medium
24.2K
32.2K
24,184
32,236
75.0%
[]
[]
Algorithms
null
[1,2,3,null,4,5,6] 4
{ "name": "findNeartestRightNode", "params": [ { "name": "root", "type": "TreeNode" }, { "type": "TreeNode", "name": "u" } ], "return": { "type": "TreeNode" }, "languages": [ "cpp", "java", "python", "c", "csharp", "javascript", "ruby",...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Breadth-First Search', 'Binary Tree']
1,603
Design Parking System
design-parking-system
<p>Design a parking system for a parking lot. The parking lot has three kinds of parking spaces: big, medium, and small, with a fixed number of slots for each size.</p> <p>Implement the <code>ParkingSystem</code> class:</p> <ul> <li><code>ParkingSystem(int big, int medium, int small)</code> Initializes object of the...
Easy
315.1K
357.9K
315,077
357,871
88.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class ParkingSystem {\npublic:\n ParkingSystem(int big, int medium, int small) {\n \n }\n \n bool addCar(int carType) {\n \n }\n};\n\n/**\n * Your ParkingSystem object will be instantiated and called as such:\n * ParkingSystem* obj = new Park...
["ParkingSystem","addCar","addCar","addCar","addCar"] [[1,1,0],[1],[2],[3],[1]]
{ "classname": "ParkingSystem", "constructor": { "params": [ { "name": "big", "type": "integer" }, { "name": "medium", "type": "integer" }, { "name": "small", "type": "integer" } ] }, "methods": [ { "params": [...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Design', 'Simulation', 'Counting']
1,604
Alert Using Same Key-Card Three or More Times in a One Hour Period
alert-using-same-key-card-three-or-more-times-in-a-one-hour-period
<p>LeetCode company workers use key-cards to unlock office doors. Each time a worker uses their key-card, the security system saves the worker&#39;s name and the time when it was used. The system emits an <strong>alert</strong> if any worker uses the key-card <strong>three or more times</strong> in a one-hour period.</...
Medium
42K
91.4K
41,971
91,351
45.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> alertNames(vector<string>& keyName, vector<string>& keyTime) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> alertNames(String[] keyName, String[] keyTime)...
["daniel","daniel","daniel","luis","luis","luis","luis"] ["10:00","10:40","11:00","09:00","11:00","13:00","15:00"]
{ "name": "alertNames", "params": [ { "name": "keyName", "type": "string[]" }, { "type": "string[]", "name": "keyTime" } ], "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']
1,605
Find Valid Matrix Given Row and Column Sums
find-valid-matrix-given-row-and-column-sums
<p>You are given two arrays <code>rowSum</code> and <code>colSum</code> of non-negative integers where <code>rowSum[i]</code> is the sum of the elements in the <code>i<sup>th</sup></code> row and <code>colSum[j]</code> is the sum of the elements of the <code>j<sup>th</sup></code> column of a 2D matrix. In other words, ...
Medium
154.6K
186.5K
154,553
186,531
82.9%
['reconstruct-a-2-row-binary-matrix']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> restoreMatrix(vector<int>& rowSum, vector<int>& colSum) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] restoreMatrix(int[] rowSum, int[] colSum) {\n ...
[3,8] [4,7]
{ "name": "restoreMatrix", "params": [ { "name": "rowSum", "type": "integer[]" }, { "type": "integer[]", "name": "colSum" } ], "return": { "type": "integer[][]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Matrix']
1,606
Find Servers That Handled Most Number of Requests
find-servers-that-handled-most-number-of-requests
<p>You have <code>k</code> servers numbered from <code>0</code> to <code>k-1</code> that are being used to handle multiple requests simultaneously. Each server has infinite computational capacity but <strong>cannot handle more than one request at a time</strong>. The requests are assigned to servers according to a spec...
Hard
20K
45.8K
20,033
45,764
43.8%
['meeting-rooms-iii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> busiestServers(int k, vector<int>& arrival, vector<int>& load) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> busiestServers(int k, int[] arrival, int[] loa...
3 [1,2,3,4,5] [5,2,3,3,3]
{ "name": "busiestServers", "params": [ { "name": "k", "type": "integer" }, { "type": "integer[]", "name": "arrival" }, { "type": "integer[]", "name": "load" } ], "return": { "type": "list<integer>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Heap (Priority Queue)', 'Ordered Set']
1,607
Sellers With No Sales
sellers-with-no-sales
null
Easy
40.3K
74K
40,287
73,979
54.5%
['customer-who-visited-but-did-not-make-any-transactions']
['Create table If Not Exists Customer (customer_id int, customer_name varchar(20))', 'Create table If Not Exists Orders (order_id int, sale_date date, order_cost int, customer_id int, seller_id int)\n', 'Create table If Not Exists Seller (seller_id int, seller_name varchar(20))\n', 'Truncate table Customer', "insert in...
Database
null
{"headers": {"Customer": ["customer_id", "customer_name"], "Orders": ["order_id", "sale_date", "order_cost", "customer_id", "seller_id"], "Seller": ["seller_id", "seller_name"]}, "rows": {"Customer": [[101, "Alice"], [102, "Bob"], [103, "Charlie"]], "Orders": [[1, "2020-03-01", 1500, 101, 1], [2, "2020-05-25", 2400, 10...
{"mysql": ["Create table If Not Exists Customer (customer_id int, customer_name varchar(20))", "Create table If Not Exists Orders (order_id int, sale_date date, order_cost int, customer_id int, seller_id int)\n", "Create table If Not Exists Seller (seller_id int, seller_name varchar(20))\n"], "mssql": ["Create table Cu...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,608
Special Array With X Elements Greater Than or Equal X
special-array-with-x-elements-greater-than-or-equal-x
<p>You are given an array <code>nums</code> of non-negative integers. <code>nums</code> is considered <strong>special</strong> if there exists a number <code>x</code> such that there are <strong>exactly</strong> <code>x</code> numbers in <code>nums</code> that are <strong>greater than or equal to</strong> <code>x</code...
Easy
215.9K
324.2K
215,892
324,228
66.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int specialArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int specialArray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul...
[3,5]
{ "name": "specialArray", "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', 'Sorting']
1,609
Even Odd Tree
even-odd-tree
<p>A binary tree is named <strong>Even-Odd</strong> if it meets the following conditions:</p> <ul> <li>The root of the binary tree is at level index <code>0</code>, its children are at level index <code>1</code>, their children are at level index <code>2</code>, etc.</li> <li>For every <strong>even-indexed</strong> ...
Medium
178.3K
268.3K
178,335
268,303
66.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre...
[1,10,4,3,null,7,9,12,8,6,null,null,2]
{ "name": "isEvenOddTree", "params": [ { "name": "root", "type": "TreeNode" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Breadth-First Search', 'Binary Tree']
1,610
Maximum Number of Visible Points
maximum-number-of-visible-points
<p>You are given an array <code>points</code>, an integer <code>angle</code>, and your <code>location</code>, where <code>location = [pos<sub>x</sub>, pos<sub>y</sub>]</code> and <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> both denote <strong>integral coordinates</strong> on the X-Y plane.</p> <p>Initially...
Hard
46K
122.5K
45,979
122,514
37.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int visiblePoints(vector<vector<int>>& points, int angle, vector<int>& location) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int visiblePoints(List<List<Integer>> points, int angl...
[[2,1],[2,2],[3,3]] 90 [1,1]
{ "name": "visiblePoints", "params": [ { "name": "points", "type": "list<list<integer>>" }, { "type": "integer", "name": "angle" }, { "type": "list<integer>", "name": "location" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Geometry', 'Sliding Window', 'Sorting']
1,611
Minimum One Bit Operations to Make Integers Zero
minimum-one-bit-operations-to-make-integers-zero
<p>Given an integer <code>n</code>, you must transform it into <code>0</code> using the following operations any number of times:</p> <ul> <li>Change the rightmost (<code>0<sup>th</sup></code>) bit in the binary representation of <code>n</code>.</li> <li>Change the <code>i<sup>th</sup></code> bit in the binary repre...
Hard
62.6K
85.5K
62,618
85,450
73.3%
['minimum-number-of-operations-to-make-array-continuous', 'apply-bitwise-operations-to-make-strings-equal']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumOneBitOperations(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumOneBitOperations(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "d...
3
{ "name": "minimumOneBitOperations", "params": [ { "name": "n", "type": "integer" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Dynamic Programming', 'Bit Manipulation', 'Memoization']
1,612
Check If Two Expression Trees are Equivalent
check-if-two-expression-trees-are-equivalent
null
Medium
8K
11.3K
8,025
11,293
71.1%
['build-binary-expression-tree-from-infix-expression', 'minimum-flips-in-binary-tree-to-get-result', 'evaluate-boolean-binary-tree']
[]
Algorithms
null
[x] [x]
{ "name": "checkEquivalence", "params": [ { "name": "root1", "type": "TreeNode" }, { "type": "TreeNode", "name": "root2" } ], "return": { "type": "boolean" }, "languages": [ "cpp", "java", "python", "csharp", "python3", "javascript" ], ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Tree', 'Depth-First Search', 'Binary Tree', 'Counting']
1,613
Find the Missing IDs
find-the-missing-ids
null
Medium
21.1K
28.9K
21,119
28,885
73.1%
['report-contiguous-dates', 'find-the-start-and-end-number-of-continuous-ranges', 'number-of-transactions-per-visit']
['Create table If Not Exists Customers (customer_id int, customer_name varchar(20))', 'Truncate table Customers', "insert into Customers (customer_id, customer_name) values ('1', 'Alice')", "insert into Customers (customer_id, customer_name) values ('4', 'Bob')", "insert into Customers (customer_id, customer_name) valu...
Database
null
{"headers": {"Customers": ["customer_id", "customer_name"]}, "rows": {"Customers": [[1, "Alice"], [4, "Bob"], [5, "Charlie"]]}}
{"mysql": ["Create table If Not Exists Customers (customer_id int, customer_name varchar(20))"], "mssql": ["Create table Customers (customer_id int, customer_name varchar(20))\n"], "oraclesql": ["Create table Customers (customer_id int, customer_name varchar(20))\n"], "database": true, "name": "find_missing_ids", "pyth...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,614
Maximum Nesting Depth of the Parentheses
maximum-nesting-depth-of-the-parentheses
<p>Given a <strong>valid parentheses string</strong> <code>s</code>, return the <strong>nesting depth</strong> of<em> </em><code>s</code>. The nesting depth is the <strong>maximum</strong> number of nested parentheses.</p> <p>&nbsp;</p> <p><strong class="example">Example 1:</strong></p> <div class="example-block"> <p...
Easy
426.1K
505.9K
426,064
505,882
84.2%
['maximum-nesting-depth-of-two-valid-parentheses-strings']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxDepth(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxDepth(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solu...
"(1+(2*3)+((8)/4))+1"
{ "name": "maxDepth", "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', 'Stack']
1,615
Maximal Network Rank
maximal-network-rank
<p>There is an infrastructure of <code>n</code> cities with some number of <code>roads</code> connecting these cities. Each <code>roads[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates that there is a bidirectional road between cities <code>a<sub>i</sub></code> and <code>b<sub>i</sub></code>.</p> <p>The <strong>ne...
Medium
155.2K
237.5K
155,240
237,466
65.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximalNetworkRank(int n, vector<vector<int>>& roads) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximalNetworkRank(int n, int[][] roads) {\n \n }\n}"}, {"value...
4 [[0,1],[0,3],[1,2],[1,3]]
{ "name": "maximalNetworkRank", "params": [ { "name": "n", "type": "integer" }, { "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...
['Graph']
1,616
Split Two Strings to Make Palindrome
split-two-strings-to-make-palindrome
<p>You are given two strings <code>a</code> and <code>b</code> of the same length. Choose an index and split both strings <strong>at the same index</strong>, splitting <code>a</code> into two strings: <code>a<sub>prefix</sub></code> and <code>a<sub>suffix</sub></code> where <code>a = a<sub>prefix</sub> + a<sub>suffix</...
Medium
28.3K
90.5K
28,316
90,482
31.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkPalindromeFormation(string a, string b) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkPalindromeFormation(String a, String b) {\n \n }\n}"}, {"value...
"x" "y"
{ "name": "checkPalindromeFormation", "params": [ { "name": "a", "type": "string" }, { "type": "string", "name": "b" } ], "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...
['Two Pointers', 'String']
1,617
Count Subtrees With Max Distance Between Cities
count-subtrees-with-max-distance-between-cities
<p>There are <code>n</code> cities numbered from <code>1</code> to <code>n</code>. You are given an array <code>edges</code> of size <code>n-1</code>, where <code>edges[i] = [u<sub>i</sub>, v<sub>i</sub>]</code> represents a bidirectional edge between cities <code>u<sub>i</sub></code> and <code>v<sub>i</sub></code>. Th...
Hard
12.7K
19.1K
12,743
19,117
66.7%
['tree-diameter']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> countSubgraphsForEachDiameter(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] countSubgraphsForEachDiameter(int n, int[][] edges) ...
4 [[1,2],[2,3],[2,4]]
{ "name": "countSubgraphsForEachDiameter", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "edges" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Dynamic Programming', 'Bit Manipulation', 'Tree', 'Enumeration', 'Bitmask']
1,618
Maximum Font to Fit a Sentence in a Screen
maximum-font-to-fit-a-sentence-in-a-screen
null
Medium
7.2K
11.7K
7,162
11,696
61.2%
[]
[]
Algorithms
null
"helloworld" 80 20 [6,8,10,12,14,16,18,24,36]
{ "name": "maxFont", "params": [ { "name": "text", "type": "string" }, { "type": "integer", "name": "w" }, { "type": "integer", "name": "h" }, { "type": "integer[]", "name": "fonts" } ], "return": { "type": "integer" }, "lan...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Binary Search', 'Interactive']
1,619
Mean of Array After Removing Some Elements
mean-of-array-after-removing-some-elements
<p>Given an integer array <code>arr</code>, return <em>the mean of the remaining integers after removing the smallest <code>5%</code> and the largest <code>5%</code> of the elements.</em></p> <p>Answers within <code>10<sup>-5</sup></code> of the <strong>actual answer</strong> will be considered accepted.</p> <p>&nbsp...
Easy
72K
102.7K
72,030
102,699
70.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double trimMean(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double trimMean(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod...
[1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3]
{ "name": "trimMean", "params": [ { "name": "arr", "type": "integer[]" } ], "return": { "type": "double" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting']
1,620
Coordinate With Maximum Network Quality
coordinate-with-maximum-network-quality
<p>You are given an array of network towers <code>towers</code>, where <code>towers[i] = [x<sub>i</sub>, y<sub>i</sub>, q<sub>i</sub>]</code> denotes the <code>i<sup>th</sup></code> network tower with location <code>(x<sub>i</sub>, y<sub>i</sub>)</code> and quality factor <code>q<sub>i</sub></code>. All the coordinates...
Medium
10.1K
26.4K
10,071
26,378
38.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> bestCoordinate(vector<vector<int>>& towers, int radius) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] bestCoordinate(int[][] towers, int radius) {\n \n }...
[[1,2,5],[2,1,7],[3,1,9]] 2
{ "name": "bestCoordinate", "params": [ { "name": "towers", "type": "integer[][]" }, { "type": "integer", "name": "radius" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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']
1,621
Number of Sets of K Non-Overlapping Line Segments
number-of-sets-of-k-non-overlapping-line-segments
<p>Given <code>n</code> points on a 1-D plane, where the <code>i<sup>th</sup></code> point (from <code>0</code> to <code>n-1</code>) is at <code>x = i</code>, find the number of ways we can draw <strong>exactly</strong> <code>k</code> <strong>non-overlapping</strong> line segments such that each segment covers two or m...
Medium
11.5K
25.9K
11,498
25,876
44.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfSets(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfSets(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo...
4 2
{ "name": "numberOfSets", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" }, "manual": false }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Dynamic Programming', 'Combinatorics']
1,622
Fancy Sequence
fancy-sequence
<p>Write an API that generates fancy sequences using the <code>append</code>, <code>addAll</code>, and <code>multAll</code> operations.</p> <p>Implement the <code>Fancy</code> class:</p> <ul> <li><code>Fancy()</code> Initializes the object with an empty sequence.</li> <li><code>void append(val)</code> Appends an in...
Hard
13.4K
74.1K
13,441
74,101
18.1%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Fancy {\npublic:\n Fancy() {\n \n }\n \n void append(int val) {\n \n }\n \n void addAll(int inc) {\n \n }\n \n void multAll(int m) {\n \n }\n \n int getIndex(int idx) {\n \n }\n};\n\n/**\n...
["Fancy","append","addAll","append","multAll","getIndex","addAll","append","multAll","getIndex","getIndex","getIndex"] [[],[2],[3],[7],[2],[0],[3],[10],[2],[0],[1],[2]]
{ "classname": "Fancy", "constructor": { "params": [] }, "methods": [ { "params": [ { "type": "integer", "name": "val" } ], "name": "append", "return": { "type": "void" } }, { "params": [ { "type": ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Math', 'Design', 'Segment Tree']
1,623
All Valid Triplets That Can Represent a Country
all-valid-triplets-that-can-represent-a-country
null
Easy
21.6K
26.7K
21,626
26,718
80.9%
[]
['Create table If Not Exists SchoolA (student_id int, student_name varchar(20))', 'Create table If Not Exists SchoolB (student_id int, student_name varchar(20))', 'Create table If Not Exists SchoolC (student_id int, student_name varchar(20))', 'Truncate table SchoolA', "insert into SchoolA (student_id, student_name) va...
Database
null
{"headers":{"SchoolA":["student_id","student_name"],"SchoolB":["student_id","student_name"],"SchoolC":["student_id","student_name"]},"rows":{"SchoolA":[[1,"Alice"],[2,"Bob"]],"SchoolB":[[3,"Tom"]],"SchoolC":[[3,"Tom"],[2,"Jerry"],[10,"Alice"]]}}
{"mysql": ["Create table If Not Exists SchoolA (student_id int, student_name varchar(20))", "Create table If Not Exists SchoolB (student_id int, student_name varchar(20))", "Create table If Not Exists SchoolC (student_id int, student_name varchar(20))"], "mssql": ["Create table SchoolA (student_id int, student_name var...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,624
Largest Substring Between Two Equal Characters
largest-substring-between-two-equal-characters
<p>Given a string <code>s</code>, return <em>the length of the longest substring between two equal characters, excluding the two characters.</em> If there is no such substring return <code>-1</code>.</p> <p>A <strong>substring</strong> is a contiguous sequence of characters within a string.</p> <p>&nbsp;</p> <p><stro...
Easy
168.1K
246.4K
168,081
246,358
68.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxLengthBetweenEqualCharacters(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxLengthBetweenEqualCharacters(String s) {\n \n }\n}"}, {"value": "python"...
"aa"
{ "name": "maxLengthBetweenEqualCharacters", "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']
1,625
Lexicographically Smallest String After Applying Operations
lexicographically-smallest-string-after-applying-operations
<p>You are given a string <code>s</code> of <strong>even length</strong> consisting of digits from <code>0</code> to <code>9</code>, and two integers <code>a</code> and <code>b</code>.</p> <p>You can apply either of the following two operations any number of times and in any order on <code>s</code>:</p> <ul> <li>Add...
Medium
17.9K
27.5K
17,877
27,543
64.9%
['lexicographically-smallest-string-after-substring-operation', 'lexicographically-smallest-string-after-a-swap']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string findLexSmallestString(string s, int a, int b) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String findLexSmallestString(String s, int a, int b) {\n \n }\n}"}, {"va...
"5525" 9 2
{ "name": "findLexSmallestString", "params": [ { "name": "s", "type": "string" }, { "type": "integer", "name": "a" }, { "type": "integer", "name": "b" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Depth-First Search', 'Breadth-First Search', 'Enumeration']
1,626
Best Team With No Conflicts
best-team-with-no-conflicts
<p>You are the manager of a basketball team. For the upcoming tournament, you want to choose the team with the highest overall score. The score of the team is the <strong>sum</strong> of scores of all the players in the team.</p> <p>However, the basketball team is not allowed to have <strong>conflicts</strong>. A <str...
Medium
90.2K
179.2K
90,237
179,207
50.4%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int bestTeamScore(vector<int>& scores, vector<int>& ages) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int bestTeamScore(int[] scores, int[] ages) {\n \n }\n}"}, {"value"...
[1,3,5,10,15] [1,2,3,4,5]
{ "name": "bestTeamScore", "params": [ { "name": "scores", "type": "integer[]" }, { "type": "integer[]", "name": "ages" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Sorting']
1,627
Graph Connectivity With Threshold
graph-connectivity-with-threshold
<p>We have <code>n</code> cities labeled from <code>1</code> to <code>n</code>. Two different cities with labels <code>x</code> and <code>y</code> are directly connected by a bidirectional road if and only if <code>x</code> and <code>y</code> share a common divisor <strong>strictly greater</strong> than some <code>thre...
Hard
20.2K
42.1K
20,189
42,083
48.0%
['greatest-common-divisor-traversal']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> areConnected(int n, int threshold, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Boolean> areConnected(int n, int threshold, int[][] ...
6 2 [[1,4],[2,5],[3,6]]
{ "name": "areConnected", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "threshold" }, { "type": "integer[][]", "name": "queries" } ], "return": { "type": "list<boolean>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Union Find', 'Number Theory']
1,628
Design an Expression Tree With Evaluate Function
design-an-expression-tree-with-evaluate-function
null
Medium
28.1K
34.2K
28,147
34,153
82.4%
['minimum-flips-in-binary-tree-to-get-result', 'evaluate-boolean-binary-tree']
[]
Algorithms
null
["3","4","+","2","*","7","/"]
{ "name": "buildTree", "params": [ { "name": "s", "type": "string[]" } ], "return": { "type": "integer" }, "manual": true, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3" ] }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Stack', 'Tree', 'Design', 'Binary Tree']
1,629
Slowest Key
slowest-key
<p>A newly designed keypad was tested, where a tester pressed a sequence of <code>n</code> keys, one at a time.</p> <p>You are given a string <code>keysPressed</code> of length <code>n</code>, where <code>keysPressed[i]</code> was the <code>i<sup>th</sup></code> key pressed in the testing sequence, and a sorted list <...
Easy
108.7K
183.5K
108,686
183,525
59.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n char slowestKey(vector<int>& releaseTimes, string keysPressed) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public char slowestKey(int[] releaseTimes, String keysPressed) {\n \n ...
[9,29,49,50] "cbcd"
{ "name": "slowestKey", "params": [ { "type": "integer[]", "name": "releaseTimes" }, { "type": "string", "name": "keysPressed" } ], "return": { "type": "character" }, "manual": false }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String']
1,630
Arithmetic Subarrays
arithmetic-subarrays
<p>A sequence of numbers is called <strong>arithmetic</strong> if it consists of at least two elements, and the difference between every two consecutive elements is the same. More formally, a sequence <code>s</code> is arithmetic if and only if <code>s[i+1] - s[i] == s[1] - s[0] </code>for all valid <code>i</code>.</p>...
Medium
146.5K
175K
146,462
175,014
83.7%
['arithmetic-slices', 'can-make-arithmetic-progression-from-sequence']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> checkArithmeticSubarrays(vector<int>& nums, vector<int>& l, vector<int>& r) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Boolean> checkArithmeticSubarrays(int[] n...
[4,6,5,9,3,7] [0,0,2] [2,3,5]
{ "name": "checkArithmeticSubarrays", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[]", "name": "l" }, { "type": "integer[]", "name": "r" } ], "return": { "type": "list<boolean>" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Sorting']
1,631
Path With Minimum Effort
path-with-minimum-effort
<p>You are a hiker preparing for an upcoming hike. You are given <code>heights</code>, a 2D array of size <code>rows x columns</code>, where <code>heights[row][col]</code> represents the height of cell <code>(row, col)</code>. You are situated in the top-left cell, <code>(0, 0)</code>, and you hope to travel to the bot...
Medium
331.8K
544.1K
331,843
544,092
61.0%
['swim-in-rising-water', 'path-with-maximum-minimum-value', 'find-the-safest-path-in-a-grid']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumEffortPath(vector<vector<int>>& heights) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumEffortPath(int[][] heights) {\n \n }\n}"}, {"value": "python",...
[[1,2,2],[3,8,2],[5,3,5]]
{ "name": "minimumEffortPath", "params": [ { "name": "heights", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Binary Search', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Heap (Priority Queue)', 'Matrix']
1,632
Rank Transform of a Matrix
rank-transform-of-a-matrix
<p>Given an <code>m x n</code> <code>matrix</code>, return <em>a new matrix </em><code>answer</code><em> where </em><code>answer[row][col]</code><em> is the </em><em><strong>rank</strong> of </em><code>matrix[row][col]</code>.</p> <p>The <strong>rank</strong> is an <strong>integer</strong> that represents how large an...
Hard
24.5K
59.3K
24,514
59,305
41.3%
['rank-transform-of-an-array', 'gcd-sort-of-an-array']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> matrixRankTransform(vector<vector<int>>& matrix) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] matrixRankTransform(int[][] matrix) {\n \n }\n}"...
[[1,2],[3,4]]
{ "name": "matrixRankTransform", "params": [ { "name": "matrix", "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', 'Union Find', 'Graph', 'Topological Sort', 'Sorting', 'Matrix']
1,633
Percentage of Users Attended a Contest
percentage-of-users-attended-a-contest
<p>Table: <code>Users</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | user_id | int | | user_name | varchar | +-------------+---------+ user_id is the primary key (column with unique values) for this table. Each row of this table contains the name and the id o...
Easy
356.4K
609.1K
356,429
609,133
58.5%
['queries-quality-and-percentage']
['Create table If Not Exists Users (user_id int, user_name varchar(20))', 'Create table If Not Exists Register (contest_id int, user_id int)', 'Truncate table Users', "insert into Users (user_id, user_name) values ('6', 'Alice')", "insert into Users (user_id, user_name) values ('2', 'Bob')", "insert into Users (user_id...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers":{"Users":["user_id","user_name"],"Register":["contest_id","user_id"]},"rows":{"Users":[[6,"Alice"],[2,"Bob"],[7,"Alex"]],"Register":[[215,6],[209,2],[208,2],[210,6],[208,6],[209,7],[209,6],[215,7],[208,7],[210,2],[207,2],[210,7]]}}
{"mysql": ["Create table If Not Exists Users (user_id int, user_name varchar(20))", "Create table If Not Exists Register (contest_id int, user_id int)"], "mssql": ["Create table Users (user_id int, user_name varchar(20))", "Create table Register (contest_id int, user_id int)"], "oraclesql": ["Create table Users (user_i...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,634
Add Two Polynomials Represented as Linked Lists
add-two-polynomials-represented-as-linked-lists
null
Medium
15.7K
25.9K
15,702
25,884
60.7%
['add-two-numbers', 'merge-two-sorted-lists', 'add-two-numbers-ii']
[]
Algorithms
null
[[1,1]] [[1,0]]
{ "name": "addPoly", "params": [ { "type": "integer[][]", "name": "poly1" }, { "type": "integer[][]", "name": "poly2" } ], "return": { "type": "integer" }, "manual": true, "languages": [ "cpp", "java", "javascript", "python3", "python", "...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List', 'Math', 'Two Pointers']
1,635
Hopper Company Queries I
hopper-company-queries-i
null
Hard
9.8K
20.4K
9,797
20,350
48.1%
['trips-and-users', 'hopper-company-queries-ii', 'hopper-company-queries-iii', 'number-of-times-a-driver-was-a-passenger']
['Create table If Not Exists Drivers (driver_id int, join_date date)', 'Create table If Not Exists Rides (ride_id int, user_id int, requested_at date)', 'Create table If Not Exists AcceptedRides (ride_id int, driver_id int, ride_distance int, ride_duration int)', 'Truncate table Drivers', "insert into Drivers (driver_i...
Database
null
{"headers":{"Drivers":["driver_id","join_date"],"Rides":["ride_id","user_id","requested_at"],"AcceptedRides":["ride_id","driver_id","ride_distance","ride_duration"]},"rows":{"Drivers":[[10,"2019-12-10"],[8,"2020-1-13"],[5,"2020-2-16"],[7,"2020-3-8"],[4,"2020-5-17"],[1,"2020-10-24"],[6,"2021-1-5"]],"Rides":[[6,75,"2019-...
{"mysql": ["Create table If Not Exists Drivers (driver_id int, join_date date)", "Create table If Not Exists Rides (ride_id int, user_id int, requested_at date)", "Create table If Not Exists AcceptedRides (ride_id int, driver_id int, ride_distance int, ride_duration int)"], "mssql": ["Create table Drivers (driver_id in...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,636
Sort Array by Increasing Frequency
sort-array-by-increasing-frequency
<p>Given an array of integers <code>nums</code>, sort the array in <strong>increasing</strong> order based on the frequency of the values. If multiple values have the same frequency, sort them in <strong>decreasing</strong> order.</p> <p>Return the <em>sorted array</em>.</p> <p>&nbsp;</p> <p><strong class="example">E...
Easy
303K
378.1K
303,004
378,113
80.1%
['sort-characters-by-frequency', 'divide-array-into-equal-pairs', 'most-frequent-number-following-key-in-an-array', 'maximum-number-of-pairs-in-array', 'node-with-highest-edge-score', 'sort-the-people']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> frequencySort(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] frequencySort(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Pyth...
[1,1,2,2,2,3]
{ "name": "frequencySort", "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']
1,637
Widest Vertical Area Between Two Points Containing No Points
widest-vertical-area-between-two-points-containing-no-points
<p>Given <code>n</code> <code>points</code> on a 2D plane where <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>, Return<em>&nbsp;the <strong>widest vertical area</strong> between two points such that no points are inside the area.</em></p> <p>A <strong>vertical area</strong> is an area of fixed-width extending...
Easy
186K
213.7K
186,027
213,669
87.1%
['maximum-gap', 'maximum-consecutive-floors-without-special-floors']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxWidthOfVerticalArea(vector<vector<int>>& points) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxWidthOfVerticalArea(int[][] points) {\n \n }\n}"}, {"value": "...
[[8,7],[9,9],[7,4],[9,7]]
{ "name": "maxWidthOfVerticalArea", "params": [ { "name": "points", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sorting']
1,638
Count Substrings That Differ by One Character
count-substrings-that-differ-by-one-character
<p>Given two strings <code>s</code> and <code>t</code>, find the number of ways you can choose a non-empty substring of <code>s</code> and replace a <strong>single character</strong> by a different character such that the resulting substring is a substring of <code>t</code>. In other words, find the number of substring...
Medium
34K
47.6K
34,040
47,580
71.5%
['count-words-obtained-after-adding-a-letter']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSubstrings(string s, string t) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSubstrings(String s, String t) {\n \n }\n}"}, {"value": "python", "text": "P...
"aba" "baba"
{ "name": "countSubstrings", "params": [ { "name": "s", "type": "string" }, { "type": "string", "name": "t" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Dynamic Programming', 'Enumeration']
1,639
Number of Ways to Form a Target String Given a Dictionary
number-of-ways-to-form-a-target-string-given-a-dictionary
<p>You are given a list of strings of the <strong>same length</strong> <code>words</code> and a string <code>target</code>.</p> <p>Your task is to form <code>target</code> using the given <code>words</code> under the following rules:</p> <ul> <li><code>target</code> should be formed from left to right.</li> <li>To ...
Hard
127.2K
222.4K
127,173
222,404
57.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numWays(vector<string>& words, string target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numWays(String[] words, String target) {\n \n }\n}"}, {"value": "python...
["acca","bbbb","caca"] "aba"
{ "name": "numWays", "params": [ { "name": "words", "type": "string[]" }, { "type": "string", "name": "target" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'String', 'Dynamic Programming']
1,640
Check Array Formation Through Concatenation
check-array-formation-through-concatenation
<p>You are given an array of <strong>distinct</strong> integers <code>arr</code> and an array of integer arrays <code>pieces</code>, where the integers in <code>pieces</code> are <strong>distinct</strong>. Your goal is to form <code>arr</code> by concatenating the arrays in <code>pieces</code> <strong>in any order</str...
Easy
87.3K
153.4K
87,302
153,421
56.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canFormArray(vector<int>& arr, vector<vector<int>>& pieces) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canFormArray(int[] arr, int[][] pieces) {\n \n }\n}"...
[15,88] [[88],[15]]
{ "name": "canFormArray", "params": [ { "name": "arr", "type": "integer[]" }, { "type": "integer[][]", "name": "pieces" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table']
1,641
Count Sorted Vowel Strings
count-sorted-vowel-strings
<p>Given an integer <code>n</code>, return <em>the number of strings of length </em><code>n</code><em> that consist only of vowels (</em><code>a</code><em>, </em><code>e</code><em>, </em><code>i</code><em>, </em><code>o</code><em>, </em><code>u</code><em>) and are <strong>lexicographically sorted</strong>.</em></p> <p...
Medium
195.5K
248.1K
195,549
248,149
78.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countVowelStrings(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countVowelStrings(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":...
1
{ "name": "countVowelStrings", "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']
1,642
Furthest Building You Can Reach
furthest-building-you-can-reach
<p>You are given an integer array <code>heights</code> representing the heights of buildings, some <code>bricks</code>, and some <code>ladders</code>.</p> <p>You start your journey from building <code>0</code> and move to the next building by possibly using bricks or ladders.</p> <p>While moving from building <code>i...
Medium
248.3K
494.2K
248,253
494,154
50.2%
['make-the-prefix-sum-non-negative', 'find-building-where-alice-and-bob-can-meet']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int furthestBuilding(vector<int>& heights, int bricks, int ladders) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int furthestBuilding(int[] heights, int bricks, int ladders) {\n ...
[4,2,7,6,9,14,12] 5 1
{ "name": "furthestBuilding", "params": [ { "name": "heights", "type": "integer[]" }, { "type": "integer", "name": "bricks" }, { "type": "integer", "name": "ladders" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Heap (Priority Queue)']
1,643
Kth Smallest Instructions
kth-smallest-instructions
<p>Bob is standing at cell <code>(0, 0)</code>, and he wants to reach <code>destination</code>: <code>(row, column)</code>. He can only travel <strong>right</strong> and <strong>down</strong>. You are going to help Bob by providing <strong>instructions</strong> for him to reach <code>destination</code>.</p> <p>The <st...
Hard
14.8K
32.4K
14,785
32,426
45.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string kthSmallestPath(vector<int>& destination, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String kthSmallestPath(int[] destination, int k) {\n \n }\n}"}, {"val...
[2,3] 1
{ "name": "kthSmallestPath", "params": [ { "name": "destination", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Dynamic Programming', 'Combinatorics']
1,644
Lowest Common Ancestor of a Binary Tree II
lowest-common-ancestor-of-a-binary-tree-ii
null
Medium
108.2K
158.3K
108,170
158,337
68.3%
['lowest-common-ancestor-of-a-binary-search-tree', 'lowest-common-ancestor-of-a-binary-tree', 'lowest-common-ancestor-of-a-binary-tree-iii', 'lowest-common-ancestor-of-a-binary-tree-iv']
[]
Algorithms
null
[3,5,1,6,2,0,8,null,null,7,4] 5 1
{ "name": "lowestCommonAncestor", "params": [ { "name": "root", "type": "TreeNode" }, { "type": "integer", "name": "p" }, { "type": "integer", "name": "q" } ], "return": { "type": "TreeNode" }, "manual": true, "languages": [ "cpp", "j...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Binary Tree']
1,645
Hopper Company Queries II
hopper-company-queries-ii
null
Hard
7.6K
19.2K
7,568
19,204
39.4%
['trips-and-users', 'hopper-company-queries-i', 'hopper-company-queries-iii', 'number-of-times-a-driver-was-a-passenger']
['Create table If Not Exists Drivers (driver_id int, join_date date)', 'Create table If Not Exists Rides (ride_id int, user_id int, requested_at date)', 'Create table If Not Exists AcceptedRides (ride_id int, driver_id int, ride_distance int, ride_duration int)', 'Truncate table Drivers', "insert into Drivers (driver_i...
Database
null
{"headers":{"Drivers":["driver_id","join_date"],"Rides":["ride_id","user_id","requested_at"],"AcceptedRides":["ride_id","driver_id","ride_distance","ride_duration"]},"rows":{"Drivers":[[10,"2019-12-10"],[8,"2020-1-13"],[5,"2020-2-16"],[7,"2020-3-8"],[4,"2020-5-17"],[1,"2020-10-24"],[6,"2021-1-5"]],"Rides":[[6,75,"2019-...
{"mysql": ["Create table If Not Exists Drivers (driver_id int, join_date date)", "Create table If Not Exists Rides (ride_id int, user_id int, requested_at date)", "Create table If Not Exists AcceptedRides (ride_id int, driver_id int, ride_distance int, ride_duration int)"], "mssql": ["Create table Drivers (driver_id in...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,646
Get Maximum in Generated Array
get-maximum-in-generated-array
<p>You are given an integer <code>n</code>. A <strong>0-indexed</strong> integer array <code>nums</code> of length <code>n + 1</code> is generated in the following way:</p> <ul> <li><code>nums[0] = 0</code></li> <li><code>nums[1] = 1</code></li> <li><code>nums[2 * i] = nums[i]</code> when <code>2 &lt;= 2 * i &lt;= ...
Easy
116.1K
228K
116,055
227,989
50.9%
['largest-element-in-an-array-after-merge-operations']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getMaximumGenerated(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getMaximumGenerated(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo...
7
{ "name": "getMaximumGenerated", "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', 'Simulation']
1,647
Minimum Deletions to Make Character Frequencies Unique
minimum-deletions-to-make-character-frequencies-unique
<p>A string <code>s</code> is called <strong>good</strong> if there are no two different characters in <code>s</code> that have the same <strong>frequency</strong>.</p> <p>Given a string <code>s</code>, return<em> the <strong>minimum</strong> number of characters you need to delete to make </em><code>s</code><em> <str...
Medium
285.3K
465.7K
285,283
465,678
61.3%
['minimum-deletions-to-make-array-beautiful', 'removing-minimum-and-maximum-from-array', 'remove-letter-to-equalize-frequency', 'minimum-deletions-to-make-string-k-special']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minDeletions(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minDeletions(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cl...
"aab"
{ "name": "minDeletions", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'String', 'Greedy', 'Sorting']
1,648
Sell Diminishing-Valued Colored Balls
sell-diminishing-valued-colored-balls
<p>You have an <code>inventory</code> of different colored balls, and there is a customer that wants <code>orders</code> balls of <strong>any</strong> color.</p> <p>The customer weirdly values the colored balls. Each colored ball&#39;s value is the number of balls <strong>of that color&nbsp;</strong>you currently have...
Medium
39.8K
133K
39,781
132,984
29.9%
['maximum-running-time-of-n-computers']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxProfit(vector<int>& inventory, int orders) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxProfit(int[] inventory, int orders) {\n \n }\n}"}, {"value": "python...
[2,5] 4
{ "name": "maxProfit", "params": [ { "name": "inventory", "type": "integer[]" }, { "type": "integer", "name": "orders" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Heap (Priority Queue)']
1,649
Create Sorted Array through Instructions
create-sorted-array-through-instructions
<p>Given an integer array <code>instructions</code>, you are asked to create a sorted array from the elements in <code>instructions</code>. You start with an empty container <code>nums</code>. For each element from <strong>left to right</strong> in <code>instructions</code>, insert it into <code>nums</code>. The <stron...
Hard
28.4K
71.4K
28,375
71,431
39.7%
['count-good-triplets-in-an-array', 'longest-substring-of-one-repeating-character', 'sort-array-by-moving-items-to-empty-space']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int createSortedArray(vector<int>& instructions) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int createSortedArray(int[] instructions) {\n \n }\n}"}, {"value": "python",...
[1,5,6,2]
{ "name": "createSortedArray", "params": [ { "name": "instructions", "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', 'Divide and Conquer', 'Binary Indexed Tree', 'Segment Tree', 'Merge Sort', 'Ordered Set']
1,650
Lowest Common Ancestor of a Binary Tree III
lowest-common-ancestor-of-a-binary-tree-iii
null
Medium
347.5K
423K
347,491
422,967
82.2%
['lowest-common-ancestor-of-a-binary-search-tree', 'lowest-common-ancestor-of-a-binary-tree', 'lowest-common-ancestor-of-a-binary-tree-ii', 'lowest-common-ancestor-of-a-binary-tree-iv']
[]
Algorithms
null
[3,5,1,6,2,0,8,null,null,7,4] 5 1
{ "name": "lowestCommonAncestor", "params": [ { "name": "root", "type": "integer[]" }, { "type": "integer", "name": "p" }, { "type": "integer", "name": "q" } ], "return": { "type": "TreeNode" }, "manual": true, "languages": [ "cpp", "...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Two Pointers', 'Tree', 'Binary Tree']
1,651
Hopper Company Queries III
hopper-company-queries-iii
null
Hard
7.8K
11.8K
7,772
11,813
65.8%
['trips-and-users', 'hopper-company-queries-i', 'hopper-company-queries-ii', 'number-of-times-a-driver-was-a-passenger']
['Create table If Not Exists Drivers (driver_id int, join_date date)', 'Create table If Not Exists Rides (ride_id int, user_id int, requested_at date)', 'Create table If Not Exists AcceptedRides (ride_id int, driver_id int, ride_distance int, ride_duration int)', 'Truncate table Drivers', "insert into Drivers (driver_i...
Database
null
{"headers":{"Drivers":["driver_id","join_date"],"Rides":["ride_id","user_id","requested_at"],"AcceptedRides":["ride_id","driver_id","ride_distance","ride_duration"]},"rows":{"Drivers":[[10,"2019-12-10"],[8,"2020-1-13"],[5,"2020-2-16"],[7,"2020-3-8"],[4,"2020-5-17"],[1,"2020-10-24"],[6,"2021-1-5"]],"Rides":[[6,75,"2019-...
{"mysql": ["Create table If Not Exists Drivers (driver_id int, join_date date)", "Create table If Not Exists Rides (ride_id int, user_id int, requested_at date)", "Create table If Not Exists AcceptedRides (ride_id int, driver_id int, ride_distance int, ride_duration int)"], "mssql": ["Create table Drivers (driver_id in...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,652
Defuse the Bomb
defuse-the-bomb
<p>You have a bomb to defuse, and your time is running out! Your informer will provide you with a <strong>circular</strong> array <code>code</code>&nbsp;of length of <code>n</code>&nbsp;and a key <code>k</code>.</p> <p>To decrypt the code, you must replace every number. All the numbers are replaced <strong>simultaneou...
Easy
182.1K
229.9K
182,144
229,857
79.2%
['circular-sentence', 'shortest-distance-to-target-string-in-a-circular-array', 'take-k-of-each-character-from-left-and-right']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> decrypt(vector<int>& code, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] decrypt(int[] code, int k) {\n \n }\n}"}, {"value": "python", "text": "Py...
[5,7,1,4] 3
{ "name": "decrypt", "params": [ { "name": "code", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Sliding Window']
1,653
Minimum Deletions to Make String Balanced
minimum-deletions-to-make-string-balanced
<p>You are given a string <code>s</code> consisting only of characters <code>&#39;a&#39;</code> and <code>&#39;b&#39;</code>​​​​.</p> <p>You can delete any number of characters in <code>s</code> to make <code>s</code> <strong>balanced</strong>. <code>s</code> is <strong>balanced</strong> if there is no pair of indices...
Medium
170.7K
260.3K
170,720
260,285
65.6%
['check-if-all-as-appears-before-all-bs']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumDeletions(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumDeletions(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo...
"aababbab"
{ "name": "minimumDeletions", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming', 'Stack']
1,654
Minimum Jumps to Reach Home
minimum-jumps-to-reach-home
<p>A certain bug&#39;s home is on the x-axis at position <code>x</code>. Help them get there from position <code>0</code>.</p> <p>The bug jumps according to the following rules:</p> <ul> <li>It can jump exactly <code>a</code> positions <strong>forward</strong> (to the right).</li> <li>It can jump exactly <code>b</c...
Medium
48.3K
161.1K
48,322
161,058
30.0%
['reachable-nodes-with-restrictions', 'maximum-number-of-jumps-to-reach-the-last-index']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumJumps(vector<int>& forbidden, int a, int b, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumJumps(int[] forbidden, int a, int b, int x) {\n \n }...
[14,4,18,1,15] 3 15 9
{ "name": "minimumJumps", "params": [ { "name": "forbidden", "type": "integer[]" }, { "type": "integer", "name": "a" }, { "type": "integer", "name": "b" }, { "type": "integer", "name": "x" } ], "return": { "type": "integer" } ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Breadth-First Search']
1,655
Distribute Repeating Integers
distribute-repeating-integers
<p>You are given an array of <code>n</code> integers, <code>nums</code>, where there are at most <code>50</code> unique values in the array. You are also given an array of <code>m</code> customer order quantities, <code>quantity</code>, where <code>quantity[i]</code> is the amount of integers the <code>i<sup>th</sup></...
Hard
18.1K
45.8K
18,142
45,828
39.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canDistribute(vector<int>& nums, vector<int>& quantity) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canDistribute(int[] nums, int[] quantity) {\n \n }\n}"},...
[1,2,3,4] [2]
{ "name": "canDistribute", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer[]", "name": "quantity" } ], "return": { "type": "boolean" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Bitmask']
1,656
Design an Ordered Stream
design-an-ordered-stream
<p>There is a stream of <code>n</code> <code>(idKey, value)</code> pairs arriving in an <strong>arbitrary</strong> order, where <code>idKey</code> is an integer between <code>1</code> and <code>n</code> and <code>value</code> is a string. No two pairs have the same <code>id</code>.</p> <p>Design a stream that returns ...
Easy
97.9K
116K
97,935
115,955
84.5%
['longest-uploaded-prefix']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class OrderedStream {\npublic:\n OrderedStream(int n) {\n \n }\n \n vector<string> insert(int idKey, string value) {\n \n }\n};\n\n/**\n * Your OrderedStream object will be instantiated and called as such:\n * OrderedStream* obj = new Ordered...
["OrderedStream","insert","insert","insert","insert","insert"] [[5],[3,"ccccc"],[1,"aaaaa"],[2,"bbbbb"],[5,"eeeee"],[4,"ddddd"]]
{ "classname": "OrderedStream", "constructor": { "params": [ { "type": "integer", "name": "n" } ] }, "methods": [ { "params": [ { "type": "integer", "name": "idKey" }, { "type": "string", "name": "value...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Design', 'Data Stream']
1,657
Determine if Two Strings Are Close
determine-if-two-strings-are-close
<p>Two strings are considered <strong>close</strong> if you can attain one from the other using the following operations:</p> <ul> <li>Operation 1: Swap any two <strong>existing</strong> characters. <ul> <li>For example, <code>a<u>b</u>cd<u>e</u> -&gt; a<u>e</u>cd<u>b</u></code></li> </ul> </li> <li>Operation ...
Medium
464.7K
859.3K
464,707
859,299
54.1%
['buddy-strings', 'minimum-swaps-to-make-strings-equal', 'minimum-number-of-steps-to-make-two-strings-anagram']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool closeStrings(string word1, string word2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean closeStrings(String word1, String word2) {\n \n }\n}"}, {"value": "pyth...
"abc" "bca"
{ "name": "closeStrings", "params": [ { "name": "word1", "type": "string" }, { "type": "string", "name": "word2" } ], "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', 'Sorting', 'Counting']
1,658
Minimum Operations to Reduce X to Zero
minimum-operations-to-reduce-x-to-zero
<p>You are given an integer array <code>nums</code> and an integer <code>x</code>. In one operation, you can either remove the leftmost or the rightmost element from the array <code>nums</code> and subtract its value from <code>x</code>. Note that this <strong>modifies</strong> the array for future operations.</p> <p>...
Medium
209.1K
522.8K
209,055
522,827
40.0%
['minimum-size-subarray-sum', 'subarray-sum-equals-k', 'minimum-operations-to-convert-number', 'removing-minimum-number-of-magic-beans', 'minimum-operations-to-make-the-integer-zero']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(int[] nums, int x) {\n \n }\n}"}, {"value": "python", "text": "...
[1,1,4,2,3] 5
{ "name": "minOperations", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "x" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Hash Table', 'Binary Search', 'Sliding Window', 'Prefix Sum']
1,659
Maximize Grid Happiness
maximize-grid-happiness
<p>You are given four integers, <code>m</code>, <code>n</code>, <code>introvertsCount</code>, and <code>extrovertsCount</code>. You have an <code>m x n</code> grid, and there are two types of people: introverts and extroverts. There are <code>introvertsCount</code> introverts and <code>extrovertsCount</code> extroverts...
Hard
6.5K
16.4K
6,489
16,376
39.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getMaxGridHappiness(int m, int n, int introvertsCount, int extrovertsCount) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getMaxGridHappiness(int m, int n, int introvertsCou...
2 3 1 2
{ "name": "getMaxGridHappiness", "params": [ { "name": "m", "type": "integer" }, { "type": "integer", "name": "n" }, { "type": "integer", "name": "introvertsCount" }, { "type": "integer", "name": "extrovertsCount" } ], "return": { ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Dynamic Programming', 'Bit Manipulation', 'Memoization', 'Bitmask']
1,660
Correct a Binary Tree
correct-a-binary-tree
null
Medium
21.3K
28.7K
21,321
28,679
74.3%
['flatten-binary-tree-to-linked-list', 'flatten-a-multilevel-doubly-linked-list']
[]
Algorithms
null
[1,2,3] 2 3
{ "name": "correctBinaryTree", "params": [ { "name": "root", "type": "TreeNode" }, { "type": "integer", "name": "fromNode" }, { "type": "integer", "name": "toNode" } ], "return": { "type": "TreeNode" }, "manual": true, "languages": [ "cpp...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree']
1,661
Average Time of Process per Machine
average-time-of-process-per-machine
<p>Table: <code>Activity</code></p> <pre> +----------------+---------+ | Column Name | Type | +----------------+---------+ | machine_id | int | | process_id | int | | activity_type | enum | | timestamp | float | +----------------+---------+ The table shows the user activities for a fac...
Easy
528K
766.8K
528,050
766,754
68.9%
[]
["Create table If Not Exists Activity (machine_id int, process_id int, activity_type ENUM('start', 'end'), timestamp float)", 'Truncate table Activity', "insert into Activity (machine_id, process_id, activity_type, timestamp) values ('0', '0', 'start', '0.712')", "insert into Activity (machine_id, process_id, activity_...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers":{"Activity":["machine_id","process_id","activity_type","timestamp"]},"rows":{"Activity":[[0,0,"start",0.712],[0,0,"end",1.52],[0,1,"start",3.14],[0,1,"end",4.12],[1,0,"start",0.55],[1,0,"end",1.55],[1,1,"start",0.43],[1,1,"end",1.42],[2,0,"start",4.1],[2,0,"end",4.512],[2,1,"start",2.5],[2,1,"end",5]]}}
{"mysql": ["Create table If Not Exists Activity (machine_id int, process_id int, activity_type ENUM('start', 'end'), timestamp float)"], "mssql": ["create table Activity (machine_id int, process_id int, activity_type varchar(15) not null check(activity_type in ('start', 'end')), timestamp float)"], "oraclesql": ["creat...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,662
Check If Two String Arrays are Equivalent
check-if-two-string-arrays-are-equivalent
<p>Given two string arrays <code>word1</code> and <code>word2</code>, return<em> </em><code>true</code><em> if the two arrays <strong>represent</strong> the same string, and </em><code>false</code><em> otherwise.</em></p> <p>A string is <strong>represented</strong> by an array if the array elements concatenated <stron...
Easy
551.4K
643.3K
551,394
643,316
85.7%
['check-if-an-original-string-exists-given-two-encoded-strings']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool arrayStringsAreEqual(vector<string>& word1, vector<string>& word2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean arrayStringsAreEqual(String[] word1, String[] word2) {\...
["ab", "c"] ["a", "bc"]
{ "name": "arrayStringsAreEqual", "params": [ { "name": "word1", "type": "string[]" }, { "type": "string[]", "name": "word2" } ], "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', 'String']
1,663
Smallest String With A Given Numeric Value
smallest-string-with-a-given-numeric-value
<p>The <strong>numeric value</strong> of a <strong>lowercase character</strong> is defined as its position <code>(1-indexed)</code> in the alphabet, so the numeric value of <code>a</code> is <code>1</code>, the numeric value of <code>b</code> is <code>2</code>, the numeric value of <code>c</code> is <code>3</code>, and...
Medium
99.5K
148.5K
99,480
148,471
67.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string getSmallestString(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String getSmallestString(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Pyt...
3 27
{ "name": "getSmallestString", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "k" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Greedy']
1,664
Ways to Make a Fair Array
ways-to-make-a-fair-array
<p>You are given an integer array&nbsp;<code>nums</code>. You can choose <strong>exactly one</strong> index (<strong>0-indexed</strong>) and remove the element. Notice that the index of the elements may change after the removal.</p> <p>For example, if <code>nums = [6,1,7,4,1]</code>:</p> <ul> <li>Choosing to remove ...
Medium
44.6K
69.4K
44,597
69,383
64.3%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int waysToMakeFair(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int waysToMakeFair(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
[2,1,6,4]
{ "name": "waysToMakeFair", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Prefix Sum']
1,665
Minimum Initial Energy to Finish Tasks
minimum-initial-energy-to-finish-tasks
<p>You are given an array <code>tasks</code> where <code>tasks[i] = [actual<sub>i</sub>, minimum<sub>i</sub>]</code>:</p> <ul> <li><code>actual<sub>i</sub></code> is the actual amount of energy you <strong>spend to finish</strong> the <code>i<sup>th</sup></code> task.</li> <li><code>minimum<sub>i</sub></code> is the...
Hard
19.9K
33.8K
19,924
33,771
59.0%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumEffort(vector<vector<int>>& tasks) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumEffort(int[][] tasks) {\n \n }\n}"}, {"value": "python", "text": "Py...
[[1,2],[2,4],[4,8]]
{ "name": "minimumEffort", "params": [ { "name": "tasks", "type": "integer[][]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Sorting']
1,666
Change the Root of a Binary Tree
change-the-root-of-a-binary-tree
null
Medium
5.5K
7.3K
5,456
7,325
74.5%
[]
[]
Algorithms
null
[3,5,1,6,2,0,8,null,null,7,4] 7
{ "name": "foobar", "params": [ { "name": "root", "type": "TreeNode" }, { "type": "integer", "name": "leaf" } ], "return": { "type": "integer" }, "manual": true, "languages": [ "cpp", "java", "python", "csharp", "javascript", "python3" ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Tree', 'Depth-First Search', 'Binary Tree']
1,667
Fix Names in a Table
fix-names-in-a-table
<p>Table: <code>Users</code></p> <pre> +----------------+---------+ | Column Name | Type | +----------------+---------+ | user_id | int | | name | varchar | +----------------+---------+ user_id is the primary key (column with unique values) for this table. This table contains the ID and the ...
Easy
335.6K
550K
335,631
549,963
61.0%
[]
['Create table If Not Exists Users (user_id int, name varchar(40))', 'Truncate table Users', "insert into Users (user_id, name) values ('1', 'aLice')", "insert into Users (user_id, name) values ('2', 'bOB')"]
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers":{"Users":["user_id","name"]},"rows":{"Users":[[1,"aLice"],[2,"bOB"]]}}
{"mysql": ["Create table If Not Exists Users (user_id int, name varchar(40))"], "mssql": ["Create table Users (user_id int, name varchar(40))"], "oraclesql": ["Create table Users (user_id int, name varchar(40))"], "database": true, "name": "fix_names", "pythondata": ["Users = pd.DataFrame([], columns=['user_id', 'name...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,668
Maximum Repeating Substring
maximum-repeating-substring
<p>For a string <code>sequence</code>, a string <code>word</code> is <strong><code>k</code>-repeating</strong> if <code>word</code> concatenated <code>k</code> times is a substring of <code>sequence</code>. The <code>word</code>&#39;s <strong>maximum <code>k</code>-repeating value</strong> is the highest value <code>k<...
Easy
76.4K
194.3K
76,430
194,308
39.3%
['detect-pattern-of-length-m-repeated-k-or-more-times', 'minimum-number-of-operations-to-make-word-k-periodic']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxRepeating(string sequence, string word) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxRepeating(String sequence, String word) {\n \n }\n}"}, {"value": "pytho...
"ababc" "ab"
{ "name": "maxRepeating", "params": [ { "name": "sequence", "type": "string" }, { "type": "string", "name": "word" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'String Matching']
1,669
Merge In Between Linked Lists
merge-in-between-linked-lists
<p>You are given two linked lists: <code>list1</code> and <code>list2</code> of sizes <code>n</code> and <code>m</code> respectively.</p> <p>Remove <code>list1</code>&#39;s nodes from the <code>a<sup>th</sup></code> node to the <code>b<sup>th</sup></code> node, and put <code>list2</code> in their place.</p> <p>The bl...
Medium
241.6K
293.9K
241,635
293,929
82.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ...
[10,1,13,6,9,5] 3 4 [1000000,1000001,1000002]
{ "name": "mergeInBetween", "params": [ { "name": "list1", "type": "ListNode" }, { "type": "integer", "name": "a" }, { "type": "integer", "name": "b" }, { "type": "ListNode", "name": "list2" } ], "return": { "type": "ListNode" ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Linked List']
1,670
Design Front Middle Back Queue
design-front-middle-back-queue
<p>Design a queue that supports <code>push</code> and <code>pop</code> operations in the front, middle, and back.</p> <p>Implement the <code>FrontMiddleBack</code> class:</p> <ul> <li><code>FrontMiddleBack()</code> Initializes the queue.</li> <li><code>void pushFront(int val)</code> Adds <code>val</code> to the <st...
Medium
34.5K
60.5K
34,482
60,456
57.0%
['design-circular-deque', 'design-circular-queue']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class FrontMiddleBackQueue {\npublic:\n FrontMiddleBackQueue() {\n \n }\n \n void pushFront(int val) {\n \n }\n \n void pushMiddle(int val) {\n \n }\n \n void pushBack(int val) {\n \n }\n \n int popFront(...
["FrontMiddleBackQueue","pushFront","pushBack","pushMiddle","pushMiddle","popFront","popMiddle","popMiddle","popBack","popFront"] [[],[1],[2],[3],[4],[],[],[],[],[]]
{ "classname": "FrontMiddleBackQueue", "constructor": { "params": [] }, "methods": [ { "params": [ { "type": "integer", "name": "val" } ], "name": "pushFront", "return": { "type": "void" } }, { "params": [ { ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Linked List', 'Design', 'Queue', 'Data Stream']
1,671
Minimum Number of Removals to Make Mountain Array
minimum-number-of-removals-to-make-mountain-array
<p>You may recall that an array <code>arr</code> is a <strong>mountain array</strong> if and only if:</p> <ul> <li><code>arr.length &gt;= 3</code></li> <li>There exists some index <code>i</code> (<strong>0-indexed</strong>) with <code>0 &lt; i &lt; arr.length - 1</code> such that: <ul> <li><code>arr[0] &lt; arr[1...
Hard
114K
207.4K
114,050
207,439
55.0%
['longest-increasing-subsequence', 'longest-mountain-in-array', 'peak-index-in-a-mountain-array', 'valid-mountain-array', 'find-in-mountain-array', 'beautiful-towers-ii', 'beautiful-towers-i']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumMountainRemovals(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumMountainRemovals(int[] nums) {\n \n }\n}"}, {"value": "python", "te...
[1,3,1]
{ "name": "minimumMountainRemovals", "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', 'Greedy']
1,672
Richest Customer Wealth
richest-customer-wealth
<p>You are given an <code>m x n</code> integer grid <code>accounts</code> where <code>accounts[i][j]</code> is the amount of money the <code>i​​​​​<sup>​​​​​​th</sup>​​​​</code> customer has in the <code>j​​​​​<sup>​​​​​​th</sup></code>​​​​ bank. Return<em> the <strong>wealth</strong> that the richest customer has.</em...
Easy
1M
1.2M
1,039,867
1,174,875
88.5%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumWealth(vector<vector<int>>& accounts) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumWealth(int[][] accounts) {\n \n }\n}"}, {"value": "python", "text...
[[1,2,3],[3,2,1]]
{ "name": "maximumWealth", "params": [ { "name": "accounts", "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']
1,673
Find the Most Competitive Subsequence
find-the-most-competitive-subsequence
<p>Given an integer array <code>nums</code> and a positive integer <code>k</code>, return <em>the most<strong> competitive</strong> subsequence of </em><code>nums</code> <em>of size </em><code>k</code>.</p> <p>An array&#39;s subsequence is a resulting sequence obtained by erasing some (possibly zero) elements from the...
Medium
73.1K
141.8K
73,105
141,823
51.5%
['remove-k-digits', 'smallest-subsequence-of-distinct-characters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> mostCompetitive(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] mostCompetitive(int[] nums, int k) {\n \n }\n}"}, {"value": "pyth...
[3,5,2,6] 2
{ "name": "mostCompetitive", "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', 'Stack', 'Greedy', 'Monotonic Stack']
1,674
Minimum Moves to Make Array Complementary
minimum-moves-to-make-array-complementary
<p>You are given an integer array <code>nums</code> of <strong>even</strong> length <code>n</code> and an integer <code>limit</code>. In one move, you can replace any integer from <code>nums</code> with another integer between <code>1</code> and <code>limit</code>, inclusive.</p> <p>The array <code>nums</code> is <str...
Medium
11K
26.5K
10,992
26,532
41.4%
['zero-array-transformation-ii', 'zero-array-transformation-iii']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minMoves(vector<int>& nums, int limit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minMoves(int[] nums, int limit) {\n \n }\n}"}, {"value": "python", "text": "Py...
[1,2,4,3] 4
{ "name": "minMoves", "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', 'Hash Table', 'Prefix Sum']
1,675
Minimize Deviation in Array
minimize-deviation-in-array
<p>You are given an array <code>nums</code> of <code>n</code> positive integers.</p> <p>You can perform two types of operations on any element of the array any number of times:</p> <ul> <li>If the element is <strong>even</strong>, <strong>divide</strong> it by <code>2</code>. <ul> <li>For example, if the array i...
Hard
97.6K
181.1K
97,645
181,134
53.9%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumDeviation(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumDeviation(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",...
[1,2,3,4]
{ "name": "minimumDeviation", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Greedy', 'Heap (Priority Queue)', 'Ordered Set']
1,676
Lowest Common Ancestor of a Binary Tree IV
lowest-common-ancestor-of-a-binary-tree-iv
null
Medium
55.1K
69.8K
55,066
69,794
78.9%
['lowest-common-ancestor-of-a-binary-search-tree', 'lowest-common-ancestor-of-a-binary-tree', 'lowest-common-ancestor-of-deepest-leaves', 'lowest-common-ancestor-of-a-binary-tree-ii', 'lowest-common-ancestor-of-a-binary-tree-iii', 'lowest-common-ancestor-of-a-binary-tree-iv']
[]
Algorithms
null
[3,5,1,6,2,0,8,null,null,7,4] [4,7]
{ "name": "lowestCommonAncestor", "params": [ { "name": "root", "type": "TreeNode" }, { "type": "integer[]", "name": "nodes" } ], "return": { "type": "TreeNode" }, "manual": true, "languages": [ "cpp", "java", "python", "csharp", "python3", ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Hash Table', 'Tree', 'Depth-First Search', 'Binary Tree']
1,677
Product's Worth Over Invoices
products-worth-over-invoices
null
Easy
18.8K
48.9K
18,801
48,900
38.4%
[]
['Create table If Not Exists Product(product_id int, name varchar(15))', 'Create table If Not Exists Invoice(invoice_id int,product_id int,rest int, paid int, canceled int, refunded int)', 'Truncate table Product', "insert into Product (product_id, name) values ('0', 'ham')", "insert into Product (product_id, name) val...
Database
null
{"headers":{"Product":["product_id","name"],"Invoice":["invoice_id","product_id","rest","paid","canceled","refunded"]},"rows":{"Product":[[0,"ham"],[1,"bacon"]],"Invoice":[[23,0,2,0,5,0],[12,0,0,4,0,3],[1,1,1,1,0,1],[2,1,1,0,1,1],[3,1,0,1,1,1],[4,1,1,1,1,0]]}}
{"mysql": ["Create table If Not Exists Product(product_id int, name varchar(15))", "Create table If Not Exists Invoice(invoice_id int,product_id int,rest int, paid int, canceled int, refunded int)"], "mssql": ["Create table Product(product_id int, name varchar(15))", "Create table Invoice(invoice_id int,product_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']
1,678
Goal Parser Interpretation
goal-parser-interpretation
<p>You own a <strong>Goal Parser</strong> that can interpret a string <code>command</code>. The <code>command</code> consists of an alphabet of <code>&quot;G&quot;</code>, <code>&quot;()&quot;</code> and/or <code>&quot;(al)&quot;</code> in some order. The Goal Parser will interpret <code>&quot;G&quot;</code> as the str...
Easy
287.1K
327.7K
287,142
327,701
87.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string interpret(string command) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String interpret(String command) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau...
"G()(al)"
{ "name": "interpret", "params": [ { "name": "command", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
1,679
Max Number of K-Sum Pairs
max-number-of-k-sum-pairs
<p>You are given an integer array <code>nums</code> and an integer <code>k</code>.</p> <p>In one operation, you can pick two numbers from the array whose sum equals <code>k</code> and remove them from the array.</p> <p>Return <em>the maximum number of operations you can perform on the array</em>.</p> <p>&nbsp;</p> <...
Medium
465.6K
831.2K
465,620
831,184
56.0%
['two-sum', 'count-good-meals', 'divide-players-into-teams-of-equal-skill']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxOperations(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxOperations(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "...
[1,2,3,4] 5
{ "name": "maxOperations", "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', 'Two Pointers', 'Sorting']
1,680
Concatenation of Consecutive Binary Numbers
concatenation-of-consecutive-binary-numbers
<p>Given an integer <code>n</code>, return <em>the <strong>decimal value</strong> of the binary string formed by concatenating the binary representations of </em><code>1</code><em> to </em><code>n</code><em> in order, <strong>modulo </strong></em><code>10<sup>9 </sup>+ 7</code>.</p> <p>&nbsp;</p> <p><strong class="exa...
Medium
93.3K
164.7K
93,270
164,684
56.6%
['maximum-possible-number-by-binary-concatenation']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int concatenatedBinary(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int concatenatedBinary(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode...
1
{ "name": "concatenatedBinary", "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', 'Bit Manipulation', 'Simulation']
1,681
Minimum Incompatibility
minimum-incompatibility
<p>You are given an integer array <code>nums</code>​​​ and an integer <code>k</code>. You are asked to distribute this array into <code>k</code> subsets of <strong>equal size</strong> such that there are no two equal elements in the same subset.</p> <p>A subset&#39;s <strong>incompatibility</strong> is the difference ...
Hard
9.7K
24.4K
9,686
24,449
39.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumIncompatibility(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumIncompatibility(int[] nums, int k) {\n \n }\n}"}, {"value": "...
[1,2,1,4] 2
{ "name": "minimumIncompatibility", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Bit Manipulation', 'Bitmask']
1,682
Longest Palindromic Subsequence II
longest-palindromic-subsequence-ii
null
Medium
6K
11.9K
5,957
11,871
50.2%
['longest-palindromic-subsequence']
[]
Algorithms
null
"bbabab"
{ "name": "longestPalindromeSubseq", "params": [ { "name": "s", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Dynamic Programming']
1,683
Invalid Tweets
invalid-tweets
<p>Table: <code>Tweets</code></p> <pre> +----------------+---------+ | Column Name | Type | +----------------+---------+ | tweet_id | int | | content | varchar | +----------------+---------+ tweet_id is the primary key (column with unique values) for this table. content consists of alphanumeric ...
Easy
1M
1.2M
1,000,077
1,168,204
85.6%
[]
['Create table If Not Exists Tweets(tweet_id int, content varchar(50))', 'Truncate table Tweets', "insert into Tweets (tweet_id, content) values ('1', 'Let us Code')", "insert into Tweets (tweet_id, content) values ('2', 'More than fifteen chars are here!')"]
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers":{"Tweets":["tweet_id","content"]},"rows":{"Tweets":[[1,"Let us Code"],[2,"More than fifteen chars are here!"]]}}
{"mysql": ["Create table If Not Exists Tweets(tweet_id int, content varchar(50))"], "mssql": ["Create table Tweets(tweet_id int, content varchar(50))"], "oraclesql": ["Create table Tweets(tweet_id int, content varchar(50))"], "database": true, "name": "invalid_tweets", "pythondata": ["Tweets = pd.DataFrame([], columns=...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,685
Sum of Absolute Differences in a Sorted Array
sum-of-absolute-differences-in-a-sorted-array
<p>You are given an integer array <code>nums</code> sorted in <strong>non-decreasing</strong> order.</p> <p>Build and return <em>an integer array </em><code>result</code><em> with the same length as </em><code>nums</code><em> such that </em><code>result[i]</code><em> is equal to the <strong>summation of absolute diffe...
Medium
119.8K
175.7K
119,771
175,719
68.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getSumAbsoluteDifferences(int[] nums) {\n \n }\n}"}, {"value":...
[2,3,5]
{ "name": "getSumAbsoluteDifferences", "params": [ { "name": "nums", "type": "integer[]" } ], "return": { "type": "integer[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Prefix Sum']
1,686
Stone Game VI
stone-game-vi
<p>Alice and Bob take turns playing a game, with Alice starting first.</p> <p>There are <code>n</code> stones in a pile. On each player&#39;s turn, they can <strong>remove</strong> a stone from the pile and receive points based on the stone&#39;s value. Alice and Bob may <strong>value the stones differently</strong>.<...
Medium
23.9K
40.9K
23,947
40,945
58.5%
['stone-game', 'stone-game-ii', 'stone-game-iii', 'stone-game-iv', 'stone-game-v', 'stone-game-vii', 'stone-game-viii', 'stone-game-ix']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int stoneGameVI(vector<int>& aliceValues, vector<int>& bobValues) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int stoneGameVI(int[] aliceValues, int[] bobValues) {\n \n ...
[1,3] [2,1]
{ "name": "stoneGameVI", "params": [ { "name": "aliceValues", "type": "integer[]" }, { "type": "integer[]", "name": "bobValues" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Greedy', 'Sorting', 'Heap (Priority Queue)', 'Game Theory']
1,687
Delivering Boxes from Storage to Ports
delivering-boxes-from-storage-to-ports
<p>You have the task of delivering some boxes from storage to their ports using only one ship. However, this ship has a <strong>limit</strong> on the <strong>number of boxes</strong> and the <strong>total weight</strong> that it can carry.</p> <p>You are given an array <code>boxes</code>, where <code>boxes[i] = [ports...
Hard
7.7K
19.6K
7,687
19,626
39.2%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int boxDelivering(vector<vector<int>>& boxes, int portsCount, int maxBoxes, int maxWeight) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int boxDelivering(int[][] boxes, int portsCo...
[[1,1],[2,1],[1,1]] 2 3 3
{ "name": "boxDelivering", "params": [ { "name": "boxes", "type": "integer[][]" }, { "type": "integer", "name": "portsCount" }, { "type": "integer", "name": "maxBoxes" }, { "type": "integer", "name": "maxWeight" } ], "return": { ...
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Segment Tree', 'Queue', 'Heap (Priority Queue)', 'Prefix Sum', 'Monotonic Queue']
1,688
Count of Matches in Tournament
count-of-matches-in-tournament
<p>You are given an integer <code>n</code>, the number of teams in a tournament that has strange rules:</p> <ul> <li>If the current number of teams is <strong>even</strong>, each team gets paired with another team. A total of <code>n / 2</code> matches are played, and <code>n / 2</code> teams advance to the next roun...
Easy
274.2K
319.4K
274,203
319,352
85.9%
['count-distinct-numbers-on-board']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfMatches(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfMatches(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cl...
7
{ "name": "numberOfMatches", "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', 'Simulation']
1,689
Partitioning Into Minimum Number Of Deci-Binary Numbers
partitioning-into-minimum-number-of-deci-binary-numbers
<p>A decimal number is called <strong>deci-binary</strong> if each of its digits is either <code>0</code> or <code>1</code> without any leading zeros. For example, <code>101</code> and <code>1100</code> are <strong>deci-binary</strong>, while <code>112</code> and <code>3001</code> are not.</p> <p>Given a string <code>...
Medium
239.8K
270.6K
239,786
270,640
88.6%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minPartitions(string n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minPartitions(String n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "...
"32"
{ "name": "minPartitions", "params": [ { "name": "n", "type": "string" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String', 'Greedy']
1,690
Stone Game VII
stone-game-vii
<p>Alice and Bob take turns playing a game, with <strong>Alice starting first</strong>.</p> <p>There are <code>n</code> stones arranged in a row. On each player&#39;s turn, they can <strong>remove</strong> either the leftmost stone or the rightmost stone from the row and receive points equal to the <strong>sum</strong...
Medium
39.4K
67.6K
39,354
67,577
58.2%
['stone-game', 'stone-game-ii', 'stone-game-iii', 'stone-game-iv', 'stone-game-v', 'stone-game-vi', 'maximum-score-from-performing-multiplication-operations', 'stone-game-viii', 'stone-game-ix']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int stoneGameVII(vector<int>& stones) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int stoneGameVII(int[] stones) {\n \n }\n}"}, {"value": "python", "text": "Python", "de...
[5,3,1,4,2]
{ "name": "stoneGameVII", "params": [ { "name": "stones", "type": "integer[]" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Math', 'Dynamic Programming', 'Game Theory']
1,691
Maximum Height by Stacking Cuboids
maximum-height-by-stacking-cuboids
<p>Given <code>n</code> <code>cuboids</code> where the dimensions of the <code>i<sup>th</sup></code> cuboid is <code>cuboids[i] = [width<sub>i</sub>, length<sub>i</sub>, height<sub>i</sub>]</code> (<strong>0-indexed</strong>). Choose a <strong>subset</strong> of <code>cuboids</code> and place them on each other.</p> <...
Hard
36.4K
61K
36,414
61,036
59.7%
['the-number-of-weak-characters-in-the-game', 'maximum-number-of-groups-entering-a-competition']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxHeight(vector<vector<int>>& cuboids) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxHeight(int[][] cuboids) {\n \n }\n}"}, {"value": "python", "text": "Python...
[[50,45,20],[95,37,53],[45,23,12]]
{ "name": "maxHeight", "params": [ { "name": "cuboids", "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', 'Sorting']
1,692
Count Ways to Distribute Candies
count-ways-to-distribute-candies
null
Hard
2.8K
4.5K
2,841
4,507
63.0%
['distribute-candies-among-children-i', 'distribute-candies-among-children-ii']
[]
Algorithms
null
3 2
{ "name": "waysToDistribute", "params": [ { "name": "n", "type": "integer" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Dynamic Programming']
1,693
Daily Leads and Partners
daily-leads-and-partners
<p>Table: <code>DailySales</code></p> <pre> +-------------+---------+ | Column Name | Type | +-------------+---------+ | date_id | date | | make_name | varchar | | lead_id | int | | partner_id | int | +-------------+---------+ There is no primary key (column with unique values) for this table....
Easy
158.2K
182.7K
158,195
182,738
86.6%
[]
['Create table If Not Exists DailySales(date_id date, make_name varchar(20), lead_id int, partner_id int)', 'Truncate table DailySales', "insert into DailySales (date_id, make_name, lead_id, partner_id) values ('2020-12-8', 'toyota', '0', '1')", "insert into DailySales (date_id, make_name, lead_id, partner_id) values (...
Database
[{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v...
{"headers":{"DailySales":["date_id","make_name","lead_id","partner_id"]},"rows":{"DailySales":[["2020-12-8","toyota",0,1],["2020-12-8","toyota",1,0],["2020-12-8","toyota",1,2],["2020-12-7","toyota",0,2],["2020-12-7","toyota",0,1],["2020-12-8","honda",1,2],["2020-12-8","honda",2,1],["2020-12-7","honda",0,1],["2020-12-7"...
{"mysql": ["Create table If Not Exists DailySales(date_id date, make_name varchar(20), lead_id int, partner_id int)"], "mssql": ["Create table DailySales(date_id date, make_name varchar(20), lead_id int, partner_id int)"], "oraclesql": ["Create table DailySales(date_id date, make_name varchar(20), lead_id int, partner_...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,694
Reformat Phone Number
reformat-phone-number
<p>You are given a phone number as a string <code>number</code>. <code>number</code> consists of digits, spaces <code>&#39; &#39;</code>, and/or dashes <code>&#39;-&#39;</code>.</p> <p>You would like to reformat the phone number in a certain manner. Firstly, <strong>remove</strong> all spaces and dashes. Then, <strong...
Easy
44.4K
66.5K
44,393
66,486
66.8%
[]
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string reformatNumber(string number) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String reformatNumber(String number) {\n \n }\n}"}, {"value": "python", "text": "Python"...
"1-23-45 6"
{ "name": "reformatNumber", "params": [ { "name": "number", "type": "string" } ], "return": { "type": "string" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['String']
1,695
Maximum Erasure Value
maximum-erasure-value
<p>You are given an array of positive integers <code>nums</code> and want to erase a subarray containing&nbsp;<strong>unique elements</strong>. The <strong>score</strong> you get by erasing the subarray is equal to the <strong>sum</strong> of its elements.</p> <p>Return <em>the <strong>maximum score</strong> you can g...
Medium
144.9K
244.9K
144,851
244,935
59.1%
['longest-substring-without-repeating-characters']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumUniqueSubarray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumUniqueSubarray(int[] nums) {\n \n }\n}"}, {"value": "python", "text":...
[4,2,4,5,6]
{ "name": "maximumUniqueSubarray", "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', 'Sliding Window']
1,696
Jump Game VI
jump-game-vi
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and an integer <code>k</code>.</p> <p>You are initially standing at index <code>0</code>. In one move, you can jump at most <code>k</code> steps forward without going outside the boundaries of the array. That is, you can jump from index <cod...
Medium
116K
252.8K
116,006
252,808
45.9%
['sliding-window-maximum', 'jump-game-vii', 'jump-game-viii', 'maximize-value-of-function-in-a-ball-passing-game']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxResult(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxResult(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Python",...
[1,-1,-2,4,-7,3] 2
{ "name": "maxResult", "params": [ { "name": "nums", "type": "integer[]" }, { "type": "integer", "name": "k" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Dynamic Programming', 'Queue', 'Heap (Priority Queue)', 'Monotonic Queue']
1,697
Checking Existence of Edge Length Limited Paths
checking-existence-of-edge-length-limited-paths
<p>An undirected graph of <code>n</code> nodes is defined by <code>edgeList</code>, where <code>edgeList[i] = [u<sub>i</sub>, v<sub>i</sub>, dis<sub>i</sub>]</code> denotes an edge between nodes <code>u<sub>i</sub></code> and <code>v<sub>i</sub></code> with distance <code>dis<sub>i</sub></code>. Note that there may be ...
Hard
54.9K
87.5K
54,876
87,510
62.7%
['checking-existence-of-edge-length-limited-paths-ii', 'number-of-good-paths', 'minimum-score-of-a-path-between-two-cities']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> distanceLimitedPathsExist(int n, vector<vector<int>>& edgeList, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean[] distanceLimitedPat...
3 [[0,1,2],[1,2,4],[2,0,8],[1,0,16]] [[0,1,2],[0,2,5]]
{ "name": "distanceLimitedPathsExist", "params": [ { "name": "n", "type": "integer" }, { "type": "integer[][]", "name": "edgeList" }, { "type": "integer[][]", "name": "queries" } ], "return": { "type": "boolean[]" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Two Pointers', 'Union Find', 'Graph', 'Sorting']
1,698
Number of Distinct Substrings in a String
number-of-distinct-substrings-in-a-string
null
Medium
12.7K
19.7K
12,657
19,656
64.4%
[]
[]
Algorithms
null
"aabbaba"
{ "name": "countDistinct", "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', 'Trie', 'Rolling Hash', 'Suffix Array', 'Hash Function']
1,699
Number of Calls Between Two Persons
number-of-calls-between-two-persons
null
Medium
48.5K
59.9K
48,510
59,910
81.0%
[]
['Create table If Not Exists Calls (from_id int, to_id int, duration int)', 'Truncate table Calls', "insert into Calls (from_id, to_id, duration) values ('1', '2', '59')", "insert into Calls (from_id, to_id, duration) values ('2', '1', '11')", "insert into Calls (from_id, to_id, duration) values ('1', '3', '20')", "ins...
Database
null
{"headers":{"Calls":["from_id","to_id","duration"]},"rows":{"Calls":[[1,2,59],[2,1,11],[1,3,20],[3,4,100],[3,4,200],[3,4,200],[4,3,499]]}}
{"mysql": ["Create table If Not Exists Calls (from_id int, to_id int, duration int)"], "mssql": ["Create table Calls (from_id int, to_id int, duration int)"], "oraclesql": ["Create table Calls (from_id int, to_id int, duration int)"], "database": true, "name": "number_of_calls", "pythondata": ["Calls = pd.DataFrame([],...
{"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<...
['Database']
1,700
Number of Students Unable to Eat Lunch
number-of-students-unable-to-eat-lunch
<p>The school cafeteria offers circular and square sandwiches at lunch break, referred to by numbers <code>0</code> and <code>1</code> respectively. All students stand in a queue. Each student either prefers square or circular sandwiches.</p> <p>The number of sandwiches in the cafeteria is equal to the number of stude...
Easy
294.2K
374.4K
294,204
374,397
78.6%
['time-needed-to-buy-tickets']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countStudents(vector<int>& students, vector<int>& sandwiches) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countStudents(int[] students, int[] sandwiches) {\n \n ...
[1,1,0,0] [0,1,0,1]
{ "name": "countStudents", "params": [ { "name": "students", "type": "integer[]" }, { "type": "integer[]", "name": "sandwiches" } ], "return": { "type": "integer" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Stack', 'Queue', 'Simulation']
1,701
Average Waiting Time
average-waiting-time
<p>There is a restaurant with a single chef. You are given an array <code>customers</code>, where <code>customers[i] = [arrival<sub>i</sub>, time<sub>i</sub>]:</code></p> <ul> <li><code>arrival<sub>i</sub></code> is the arrival time of the <code>i<sup>th</sup></code> customer. The arrival times are sorted in <strong>...
Medium
206.6K
282.8K
206,621
282,810
73.1%
['average-height-of-buildings-in-each-segment']
[]
Algorithms
[{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double averageWaitingTime(vector<vector<int>>& customers) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double averageWaitingTime(int[][] customers) {\n \n }\n}"}, {"value...
[[1,2],[2,5],[4,3]]
{ "name": "averageWaitingTime", "params": [ { "name": "customers", "type": "integer[][]" } ], "return": { "type": "double" } }
{"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS...
['Array', 'Simulation']