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,101 | The Earliest Moment When Everyone Become Friends | the-earliest-moment-when-everyone-become-friends | null | Medium | 117.2K | 178.6K | 117,164 | 178,557 | 65.6% | ['number-of-provinces'] | [] | Algorithms | null | [[20190101,0,1],[20190104,3,4],[20190107,2,3],[20190211,1,5],[20190224,2,4],[20190301,0,3],[20190312,1,2],[20190322,4,5]]
6 | {
"name": "earliestAcq",
"params": [
{
"name": "logs",
"type": "integer[][]"
},
{
"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', 'Union Find', 'Sorting'] |
1,102 | Path With Maximum Minimum Value | path-with-maximum-minimum-value | null | Medium | 65.8K | 122K | 65,790 | 121,972 | 53.9% | ['path-with-minimum-effort'] | [] | Algorithms | null | [[5,4,5],[1,2,6],[7,4,6]] | {
"name": "maximumMinimumPath",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Heap (Priority Queue)', 'Matrix'] |
1,103 | Distribute Candies to People | distribute-candies-to-people | <p>We distribute some number of <code>candies</code>, to a row of <strong><code>n = num_people</code></strong> people in the following way:</p>
<p>We then give 1 candy to the first person, 2 candies to the second person, and so on until we give <code>n</code> candies to the last person.</p>
<p>The... | Easy | 97.6K | 147.4K | 97,558 | 147,445 | 66.2% | ['distribute-money-to-maximum-children'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> distributeCandies(int candies, int num_people) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] distributeCandies(int candies, int num_people) {\n \n }\n}"}... | 7
4 | {
"name": "distributeCandies",
"params": [
{
"name": "candies",
"type": "integer"
},
{
"type": "integer",
"name": "num_people"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Simulation'] |
1,104 | Path In Zigzag Labelled Binary Tree | path-in-zigzag-labelled-binary-tree | <p>In an infinite binary tree where every node has two children, the nodes are labelled in row order.</p>
<p>In the odd numbered rows (ie., the first, third, fifth,...), the labelling is left to right, while in the even numbered rows (second, fourth, sixth,...), the labelling is right to left.</p>
<p><img alt="" src=... | Medium | 49.5K | 65.6K | 49,515 | 65,639 | 75.4% | ['cycle-length-queries-in-a-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> pathInZigZagTree(int label) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> pathInZigZagTree(int label) {\n \n }\n}"}, {"value": "python", "text": ... | 14 | {
"name": "pathInZigZagTree",
"params": [
{
"name": "label",
"type": "integer"
}
],
"return": {
"type": "list<integer>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Tree', 'Binary Tree'] |
1,105 | Filling Bookcase Shelves | filling-bookcase-shelves | <p>You are given an array <code>books</code> where <code>books[i] = [thickness<sub>i</sub>, height<sub>i</sub>]</code> indicates the thickness and height of the <code>i<sup>th</sup></code> book. You are also given an integer <code>shelfWidth</code>.</p>
<p>We want to place these books in order onto bookcase shelves th... | Medium | 148.6K | 216.4K | 148,645 | 216,376 | 68.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minHeightShelves(vector<vector<int>>& books, int shelfWidth) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minHeightShelves(int[][] books, int shelfWidth) {\n \n }... | [[1,1],[2,3],[2,3],[1,1],[1,1],[1,1],[1,2]]
4 | {
"name": "minHeightShelves",
"params": [
{
"name": "books",
"type": "integer[][]"
},
{
"type": "integer",
"name": "shelfWidth"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming'] |
1,106 | Parsing A Boolean Expression | parsing-a-boolean-expression | <p>A <strong>boolean expression</strong> is an expression that evaluates to either <code>true</code> or <code>false</code>. It can be in one of the following shapes:</p>
<ul>
<li><code>'t'</code> that evaluates to <code>true</code>.</li>
<li><code>'f'</code> that evaluates to <code>false</code>.</li>... | Hard | 131.1K | 187.4K | 131,119 | 187,362 | 70.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool parseBoolExpr(string expression) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean parseBoolExpr(String expression) {\n \n }\n}"}, {"value": "python", "text": "Py... | "&(|(f))" | {
"name": "parseBoolExpr",
"params": [
{
"name": "expression",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Stack', 'Recursion'] |
1,107 | New Users Daily Count | new-users-daily-count | null | Medium | 40.4K | 89.9K | 40,388 | 89,875 | 44.9% | [] | ["Create table If Not Exists Traffic (user_id int, activity ENUM('login', 'logout', 'jobs', 'groups', 'homepage'), activity_date date)", 'Truncate table Traffic', "insert into Traffic (user_id, activity, activity_date) values ('1', 'login', '2019-05-01')", "insert into Traffic (user_id, activity, activity_date) values ... | Database | null | {"headers":{"Traffic":["user_id","activity","activity_date"]},"rows":{"Traffic":[[1,"login","2019-05-01"],[1,"homepage","2019-05-01"],[1,"logout","2019-05-01"],[2,"login","2019-06-21"],[2,"logout","2019-06-21"],[3,"login","2019-01-01"],[3,"jobs","2019-01-01"],[3,"logout","2019-01-01"],[4,"login","2019-06-21"],[4,"group... | {"mysql": ["Create table If Not Exists Traffic (user_id int, activity ENUM('login', 'logout', 'jobs', 'groups', 'homepage'), activity_date date)"], "mssql": ["Create table Traffic (user_id int, activity VARCHAR(10) NOT NULL CHECK (activity IN ('login', 'logout', 'jobs', 'groups', 'homepage')), activity_date date)"], "o... | {"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,108 | Defanging an IP Address | defanging-an-ip-address | <p>Given a valid (IPv4) IP <code>address</code>, return a defanged version of that IP address.</p>
<p>A <em>defanged IP address</em> replaces every period <code>"."</code> with <code>"[.]"</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</s... | Easy | 745.2K | 831.6K | 745,218 | 831,641 | 89.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string defangIPaddr(string address) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String defangIPaddr(String address) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | "1.1.1.1" | {
"name": "defangIPaddr",
"params": [
{
"name": "address",
"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,109 | Corporate Flight Bookings | corporate-flight-bookings | <p>There are <code>n</code> flights that are labeled from <code>1</code> to <code>n</code>.</p>
<p>You are given an array of flight bookings <code>bookings</code>, where <code>bookings[i] = [first<sub>i</sub>, last<sub>i</sub>, seats<sub>i</sub>]</code> represents a booking for flights <code>first<sub>i</sub></code> t... | Medium | 79.7K | 124.9K | 79,721 | 124,925 | 63.8% | ['zero-array-transformation-ii', 'zero-array-transformation-iii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> corpFlightBookings(vector<vector<int>>& bookings, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] corpFlightBookings(int[][] bookings, int n) {\n \n ... | [[1,2,10],[2,3,20],[2,5,25]]
5 | {
"name": "corpFlightBookings",
"params": [
{
"name": "bookings",
"type": "integer[][]"
},
{
"type": "integer",
"name": "n"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Prefix Sum'] |
1,110 | Delete Nodes And Return Forest | delete-nodes-and-return-forest | <p>Given the <code>root</code> of a binary tree, each node in the tree has a distinct value.</p>
<p>After deleting all nodes with a value in <code>to_delete</code>, we are left with a forest (a disjoint union of trees).</p>
<p>Return the roots of the trees in the remaining forest. You may return the result in any ord... | Medium | 363.9K | 502.5K | 363,919 | 502,498 | 72.4% | ['count-nodes-with-the-highest-score'] | [] | 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,2,3,4,5,6,7]
[3,5] | {
"name": "delNodes",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"type": "integer[]",
"name": "to_delete"
}
],
"return": {
"type": "list<TreeNode>"
},
"manual": true
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Tree', 'Depth-First Search', 'Binary Tree'] |
1,111 | Maximum Nesting Depth of Two Valid Parentheses Strings | maximum-nesting-depth-of-two-valid-parentheses-strings | <p>A string is a <em>valid parentheses string</em> (denoted VPS) if and only if it consists of <code>"("</code> and <code>")"</code> characters only, and:</p>
<ul>
<li>It is the empty string, or</li>
<li>It can be written as <code>AB</code> (<code>A</code> concatenated with&nb... | Medium | 29.7K | 41.6K | 29,667 | 41,596 | 71.3% | ['maximum-nesting-depth-of-the-parentheses'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> maxDepthAfterSplit(string seq) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] maxDepthAfterSplit(String seq) {\n \n }\n}"}, {"value": "python", "text": "P... | "(()())" | {
"name": "maxDepthAfterSplit",
"params": [
{
"name": "seq",
"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,112 | Highest Grade For Each Student | highest-grade-for-each-student | null | Medium | 70.7K | 99.4K | 70,662 | 99,402 | 71.1% | ['department-highest-salary'] | ['Create table If Not Exists Enrollments (student_id int, course_id int, grade int)', 'Truncate table Enrollments', "insert into Enrollments (student_id, course_id, grade) values ('2', '2', '95')", "insert into Enrollments (student_id, course_id, grade) values ('2', '3', '95')", "insert into Enrollments (student_id, co... | Database | null | {"headers":{"Enrollments":["student_id","course_id","grade"]},"rows":{"Enrollments":[[2,2,95],[2,3,95],[1,1,90],[1,2,99],[3,1,80],[3,2,75],[3,3,82]]}} | {"mysql": ["Create table If Not Exists Enrollments (student_id int, course_id int, grade int)"], "mssql": ["Create table Enrollments (student_id int, course_id int, grade int)"], "oraclesql": ["Create table Enrollments (student_id int, course_id int, grade int)"], "database": true, "name": "highest_grade", "pythondata"... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,113 | Reported Posts | reported-posts | null | Easy | 50.6K | 77.8K | 50,629 | 77,769 | 65.1% | [] | ["Create table If Not Exists Actions (user_id int, post_id int, action_date date, action ENUM('view', 'like', 'reaction', 'comment', 'report', 'share'), extra varchar(10))", 'Truncate table Actions', "insert into Actions (user_id, post_id, action_date, action, extra) values ('1', '1', '2019-07-01', 'view', NULL)", "ins... | Database | null | {"headers":{"Actions":["user_id","post_id","action_date","action","extra"]},"rows":{"Actions":[[1,1,"2019-07-01","view",null],[1,1,"2019-07-01","like",null],[1,1,"2019-07-01","share",null],[2,4,"2019-07-04","view",null],[2,4,"2019-07-04","report","spam"],[3,4,"2019-07-04","view",null],[3,4,"2019-07-04","report","spam"]... | {"mysql": ["Create table If Not Exists Actions (user_id int, post_id int, action_date date, action ENUM('view', 'like', 'reaction', 'comment', 'report', 'share'), extra varchar(10))"], "mssql": ["create table Actions (user_id int, post_id int, action_date date, action VARCHAR(10) NOT NULL CHECK (action IN ('view', 'lik... | {"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,114 | Print in Order | print-in-order | <p>Suppose we have a class:</p>
<pre>
public class Foo {
public void first() { print("first"); }
public void second() { print("second"); }
public void third() { print("third"); }
}
</pre>
<p>The same instance of <code>Foo</code> will be passed to three different threads. Thread A w... | Easy | 186.1K | 262.7K | 186,093 | 262,658 | 70.8% | ['print-foobar-alternately'] | [] | Concurrency | [{"value": "cpp", "text": "C++", "defaultCode": "class Foo {\npublic:\n Foo() {\n \n }\n\n void first(function<void()> printFirst) {\n \n // printFirst() outputs \"first\". Do not change or remove this line.\n printFirst();\n }\n\n void second(function<void()> printSecond) {\n... | [1,2,3] | {
"name": "foobar",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
},
"languages": [
"java",
"cpp",
"python",
"python3",
"c",
"csharp"
],
"manual": true
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Concurrency'] |
1,115 | Print FooBar Alternately | print-foobar-alternately | <p>Suppose you are given the following code:</p>
<pre>
class FooBar {
public void foo() {
for (int i = 0; i < n; i++) {
print("foo");
}
}
public void bar() {
for (int i = 0; i < n; i++) {
print("bar");
}
}
}
</pre>
<p>The same instance of <code>FooBar</co... | Medium | 102.9K | 149.3K | 102,926 | 149,295 | 68.9% | ['print-in-order', 'print-zero-even-odd'] | [] | Concurrency | [{"value": "cpp", "text": "C++", "defaultCode": "class FooBar {\nprivate:\n int n;\n\npublic:\n FooBar(int n) {\n this->n = n;\n }\n\n void foo(function<void()> printFoo) {\n \n for (int i = 0; i < n; i++) {\n \n \t// printFoo() outputs \"foo\". Do not change or remove... | 1 | {
"name": "FooBar",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
},
"languages": [
"java",
"cpp",
"python",
"c",
"python3",
"csharp",
"golang"
],
"manual": true
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Concurrency'] |
1,116 | Print Zero Even Odd | print-zero-even-odd | <p>You have a function <code>printNumber</code> that can be called with an integer parameter and prints it to the console.</p>
<ul>
<li>For example, calling <code>printNumber(7)</code> prints <code>7</code> to the console.</li>
</ul>
<p>You are given an instance of the class <code>ZeroEvenOdd</code> that has three f... | Medium | 62.6K | 99.3K | 62,626 | 99,307 | 63.1% | ['print-foobar-alternately', 'fizz-buzz-multithreaded'] | [] | Concurrency | [{"value": "cpp", "text": "C++", "defaultCode": "class ZeroEvenOdd {\nprivate:\n int n;\n\npublic:\n ZeroEvenOdd(int n) {\n this->n = n;\n }\n\n // printNumber(x) outputs \"x\", where x is an integer.\n void zero(function<void(int)> printNumber) {\n \n }\n\n void even(function<void(in... | 2 | {
"name": "printZeroEvenOdd",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
},
"languages": [
"java",
"python",
"python3",
"cpp",
"c",
"csharp"
],
"manual": true
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Concurrency'] |
1,117 | Building H2O | building-h2o | <p>There are two kinds of threads: <code>oxygen</code> and <code>hydrogen</code>. Your goal is to group these threads to form water molecules.</p>
<p>There is a barrier where each thread has to wait until a complete molecule can be formed. Hydrogen and oxygen threads will be given <code>releaseHydrogen</code> and <cod... | Medium | 65.6K | 114.1K | 65,626 | 114,135 | 57.5% | [] | [] | Concurrency | [{"value": "cpp", "text": "C++", "defaultCode": "class H2O {\npublic:\n H2O() {\n \n }\n\n void hydrogen(function<void()> releaseHydrogen) {\n \n // releaseHydrogen() outputs \"H\". Do not change or remove this line.\n releaseHydrogen();\n }\n\n void oxygen(function<void()> re... | "HOH" | {
"name": "H2O",
"params": [
{
"name": "water",
"type": "string"
}
],
"return": {
"type": "string"
},
"languages": [
"java",
"cpp",
"python",
"python3",
"csharp",
"c"
],
"manual": true
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Concurrency'] |
1,118 | Number of Days in a Month | number-of-days-in-a-month | null | Easy | 9.2K | 15.6K | 9,185 | 15,592 | 58.9% | [] | [] | Algorithms | null | 1992
7 | {
"name": "numberOfDays",
"params": [
{
"name": "year",
"type": "integer"
},
{
"name": "month",
"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'] |
1,119 | Remove Vowels from a String | remove-vowels-from-a-string | null | Easy | 114.5K | 125.5K | 114,517 | 125,546 | 91.2% | ['reverse-vowels-of-a-string', 'remove-digit-from-number-to-maximize-result'] | [] | Algorithms | null | "leetcodeisacommunityforcoders" | {
"name": "removeVowels",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "string"
},
"manual": false
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String'] |
1,120 | Maximum Average Subtree | maximum-average-subtree | null | Medium | 71.7K | 107.3K | 71,674 | 107,333 | 66.8% | ['count-nodes-equal-to-sum-of-descendants', 'count-nodes-equal-to-average-of-subtree'] | [] | Algorithms | null | [5,6,1] | {
"name": "maximumAverageSubtree",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"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... | ['Tree', 'Depth-First Search', 'Binary Tree'] |
1,121 | Divide Array Into Increasing Sequences | divide-array-into-increasing-sequences | null | Hard | 5.2K | 8.6K | 5,183 | 8,572 | 60.5% | [] | [] | Algorithms | null | [1,2,2,3,3,4,4]
3 | {
"name": "canDivideIntoSubsequences",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Counting'] |
1,122 | Relative Sort Array | relative-sort-array | <p>Given two arrays <code>arr1</code> and <code>arr2</code>, the elements of <code>arr2</code> are distinct, and all elements in <code>arr2</code> are also in <code>arr1</code>.</p>
<p>Sort the elements of <code>arr1</code> such that the relative ordering of items in <code>arr1</code> are the same as in <code>arr2</co... | Easy | 364.5K | 486.7K | 364,470 | 486,666 | 74.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> relativeSortArray(vector<int>& arr1, vector<int>& arr2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] relativeSortArray(int[] arr1, int[] arr2) {\n \n }\... | [2,3,1,3,2,4,6,7,9,2,19]
[2,1,4,3,9,6] | {
"name": "relativeSortArray",
"params": [
{
"name": "arr1",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "arr2"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sorting', 'Counting Sort'] |
1,123 | Lowest Common Ancestor of Deepest Leaves | lowest-common-ancestor-of-deepest-leaves | <p>Given the <code>root</code> of a binary tree, return <em>the lowest common ancestor of its deepest leaves</em>.</p>
<p>Recall that:</p>
<ul>
<li>The node of a binary tree is a leaf if and only if it has no children</li>
<li>The depth of the root of the tree is <code>0</code>. if the depth of a node is <code>d</c... | Medium | 223.1K | 283.1K | 223,113 | 283,141 | 78.8% | ['lowest-common-ancestor-of-a-binary-tree-iv'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [3,5,1,6,2,0,8,null,null,7,4] | {
"name": "lcaDeepestLeaves",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "TreeNode"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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,124 | Longest Well-Performing Interval | longest-well-performing-interval | <p>We are given <code>hours</code>, a list of the number of hours worked per day for a given employee.</p>
<p>A day is considered to be a <em>tiring day</em> if and only if the number of hours worked is (strictly) greater than <code>8</code>.</p>
<p>A <em>well-performing interval</em> is an interval of days for which... | Medium | 38.1K | 106.6K | 38,055 | 106,584 | 35.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestWPI(vector<int>& hours) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestWPI(int[] hours) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | [9,9,6,0,6,6,9] | {
"name": "longestWPI",
"params": [
{
"name": "hours",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Stack', 'Monotonic Stack', 'Prefix Sum'] |
1,125 | Smallest Sufficient Team | smallest-sufficient-team | <p>In a project, you have a list of required skills <code>req_skills</code>, and a list of people. The <code>i<sup>th</sup></code> person <code>people[i]</code> contains a list of skills that the person has.</p>
<p>Consider a sufficient team: a set of people such that for every required skill in <code>req_skills</code... | Hard | 67.4K | 121.9K | 67,434 | 121,924 | 55.3% | ['the-number-of-good-subsets', 'minimum-number-of-work-sessions-to-finish-the-tasks', 'maximum-rows-covered-by-columns'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> smallestSufficientTeam(vector<string>& req_skills, vector<vector<string>>& people) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] smallestSufficientTeam(String[] re... | ["java","nodejs","reactjs"]
[["java"],["nodejs"],["nodejs","reactjs"]] | {
"name": "smallestSufficientTeam",
"params": [
{
"name": "req_skills",
"type": "string[]"
},
{
"type": "list<list<string>>",
"name": "people"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Bit Manipulation', 'Bitmask'] |
1,126 | Active Businesses | active-businesses | null | Medium | 49K | 74.4K | 49,002 | 74,376 | 65.9% | [] | ['Create table If Not Exists Events (business_id int, event_type varchar(10), occurrences int)', 'Truncate table Events', "insert into Events (business_id, event_type, occurrences) values ('1', 'reviews', '7')", "insert into Events (business_id, event_type, occurrences) values ('3', 'reviews', '3')", "insert into Event... | Database | null | {"headers":{"Events":["business_id","event_type","occurrences"]},"rows":{"Events":[[1,"reviews",7],[3,"reviews",3],[1,"ads",11],[2,"ads",7],[3,"ads",6],[1,"page views",3],[2,"page views",12]]}} | {"mysql": ["Create table If Not Exists Events (business_id int, event_type varchar(10), occurrences int)"], "mssql": ["Create table Events (business_id int, event_type varchar(10), occurrences int)"], "oraclesql": ["Create table Events (business_id int, event_type varchar(10), occurrences int)"], "database": true, "nam... | {"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,127 | User Purchase Platform | user-purchase-platform | null | Hard | 17.6K | 37.3K | 17,579 | 37,303 | 47.1% | [] | ["Create table If Not Exists Spending (user_id int, spend_date date, platform ENUM('desktop', 'mobile'), amount int)", 'Truncate table Spending', "insert into Spending (user_id, spend_date, platform, amount) values ('1', '2019-07-01', 'mobile', '100')", "insert into Spending (user_id, spend_date, platform, amount) valu... | Database | null | {"headers":{"Spending":["user_id","spend_date","platform","amount"]},"rows":{"Spending":[[1,"2019-07-01","mobile",100],[1,"2019-07-01","desktop",100],[2,"2019-07-01","mobile",100],[2,"2019-07-02","mobile",100],[3,"2019-07-01","desktop",100],[3,"2019-07-02","desktop",100]]}} | {"mysql": ["Create table If Not Exists Spending (user_id int, spend_date date, platform ENUM('desktop', 'mobile'), amount int)"], "mssql": ["create table Spending (user_id int, spend_date date, platform VARCHAR(10) NOT NULL CHECK (platform IN ('desktop', 'mobile')), amount int)"], "oraclesql": ["create table Spending (... | {"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,128 | Number of Equivalent Domino Pairs | number-of-equivalent-domino-pairs | <p>Given a list of <code>dominoes</code>, <code>dominoes[i] = [a, b]</code> is <strong>equivalent to</strong> <code>dominoes[j] = [c, d]</code> if and only if either (<code>a == c</code> and <code>b == d</code>), or (<code>a == d</code> and <code>b == c</code>) - that is, one domino can be rotated to be equal to anothe... | Easy | 78.2K | 159.3K | 78,168 | 159,257 | 49.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numEquivDominoPairs(vector<vector<int>>& dominoes) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numEquivDominoPairs(int[][] dominoes) {\n \n }\n}"}, {"value": "py... | [[1,2],[2,1],[3,4],[5,6]] | {
"name": "numEquivDominoPairs",
"params": [
{
"name": "dominoes",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Counting'] |
1,129 | Shortest Path with Alternating Colors | shortest-path-with-alternating-colors | <p>You are given an integer <code>n</code>, the number of nodes in a directed graph where the nodes are labeled from <code>0</code> to <code>n - 1</code>. Each edge is red or blue in this graph, and there could be self-edges and parallel edges.</p>
<p>You are given two arrays <code>redEdges</code> and <code>blueEdges<... | Medium | 132.1K | 280.2K | 132,136 | 280,156 | 47.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> shortestAlternatingPaths(int n, vector<vector<int>>& redEdges, vector<vector<int>>& blueEdges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] shortestAlternatingPat... | 3
[[0,1],[1,2]]
[] | {
"name": "shortestAlternatingPaths",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "redEdges"
},
{
"type": "integer[][]",
"name": "blueEdges"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Breadth-First Search', 'Graph'] |
1,130 | Minimum Cost Tree From Leaf Values | minimum-cost-tree-from-leaf-values | <p>Given an array <code>arr</code> of positive integers, consider all binary trees such that:</p>
<ul>
<li>Each node has either <code>0</code> or <code>2</code> children;</li>
<li>The values of <code>arr</code> correspond to the values of each <strong>leaf</strong> in an in-order traversal of the tree.</li>
<li>The... | Medium | 110.3K | 163.2K | 110,341 | 163,178 | 67.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int mctFromLeafValues(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int mctFromLeafValues(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [6,2,4] | {
"name": "mctFromLeafValues",
"params": [
{
"name": "arr",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Stack', 'Greedy', 'Monotonic Stack'] |
1,131 | Maximum of Absolute Value Expression | maximum-of-absolute-value-expression | <p>Given two arrays of integers with equal lengths, return the maximum value of:</p>
<p><code>|arr1[i] - arr1[j]| + |arr2[i] - arr2[j]| + |i - j|</code></p>
<p>where the maximum is taken over all <code>0 <= i, j < arr1.length</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<... | Medium | 27.2K | 56.5K | 27,245 | 56,519 | 48.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxAbsValExpr(vector<int>& arr1, vector<int>& arr2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxAbsValExpr(int[] arr1, int[] arr2) {\n \n }\n}"}, {"value": "p... | [1,2,3,4]
[-1,4,5,6] | {
"name": "maxAbsValExpr",
"params": [
{
"name": "arr1",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "arr2"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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'] |
1,132 | Reported Posts II | reported-posts-ii | null | Medium | 41.3K | 128.2K | 41,343 | 128,150 | 32.3% | [] | ["Create table If Not Exists Actions (user_id int, post_id int, action_date date, action ENUM('view', 'like', 'reaction', 'comment', 'report', 'share'), extra varchar(10))", 'create table if not exists Removals (post_id int, remove_date date)', 'Truncate table Actions', "insert into Actions (user_id, post_id, action_da... | Database | null | {"headers":{"Actions":["user_id","post_id","action_date","action","extra"],"Removals":["post_id","remove_date"]},"rows":{"Actions":[[1,1,"2019-07-01","view",null],[1,1,"2019-07-01","like",null],[1,1,"2019-07-01","share",null],[2,2,"2019-07-04","view",null],[2,2,"2019-07-04","report","spam"],[3,4,"2019-07-04","view",nul... | {"mysql": ["Create table If Not Exists Actions (user_id int, post_id int, action_date date, action ENUM('view', 'like', 'reaction', 'comment', 'report', 'share'), extra varchar(10))", "create table if not exists Removals (post_id int, remove_date date)"], "mssql": ["create table Actions (user_id int, post_id int, actio... | {"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,133 | Largest Unique Number | largest-unique-number | null | Easy | 89.1K | 126K | 89,112 | 125,976 | 70.7% | [] | [] | Algorithms | null | [5,7,3,9,4,9,8,3,1] | {
"name": "largestUniqueNumber",
"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,134 | Armstrong Number | armstrong-number | null | Easy | 40.2K | 51.7K | 40,235 | 51,704 | 77.8% | [] | [] | Algorithms | null | 153 | {
"name": "isArmstrong",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math'] |
1,135 | Connecting Cities With Minimum Cost | connecting-cities-with-minimum-cost | null | Medium | 81.4K | 130.2K | 81,385 | 130,179 | 62.5% | ['minimum-cost-to-reach-city-with-discounts'] | [] | Algorithms | null | 3
[[1,2,5],[1,3,6],[2,3,1]] | {
"name": "minimumCost",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "connections",
"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... | ['Union Find', 'Graph', 'Heap (Priority Queue)', 'Minimum Spanning Tree'] |
1,136 | Parallel Courses | parallel-courses | null | Medium | 97.3K | 157.5K | 97,261 | 157,527 | 61.7% | ['course-schedule-ii', 'parallel-courses-ii', 'parallel-courses-iii'] | [] | Algorithms | null | 3
[[1,3],[2,3]] | {
"name": "minimumSemesters",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "relations",
"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... | ['Graph', 'Topological Sort'] |
1,137 | N-th Tribonacci Number | n-th-tribonacci-number | <p>The Tribonacci sequence T<sub>n</sub> is defined as follows: </p>
<p>T<sub>0</sub> = 0, T<sub>1</sub> = 1, T<sub>2</sub> = 1, and T<sub>n+3</sub> = T<sub>n</sub> + T<sub>n+1</sub> + T<sub>n+2</sub> for n >= 0.</p>
<p>Given <code>n</code>, return the value of T<sub>n</sub>.</p>
<p> </p>
<p><strong cla... | Easy | 921.2K | 1.4M | 921,184 | 1,447,703 | 63.6% | ['climbing-stairs', 'fibonacci-number'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int tribonacci(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int tribonacci(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Soluti... | 4 | {
"name": "tribonacci",
"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', 'Memoization'] |
1,138 | Alphabet Board Path | alphabet-board-path | <p>On an alphabet board, we start at position <code>(0, 0)</code>, corresponding to character <code>board[0][0]</code>.</p>
<p>Here, <code>board = ["abcde", "fghij", "klmno", "pqrst", "uvwxy", "z"]</code>, as shown in the diagram below.</p>
<p><img alt=... | Medium | 55.4K | 107.4K | 55,393 | 107,401 | 51.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string alphabetBoardPath(string target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String alphabetBoardPath(String target) {\n \n }\n}"}, {"value": "python", "text": "P... | "leet" | {
"name": "alphabetBoardPath",
"params": [
{
"name": "target",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String'] |
1,139 | Largest 1-Bordered Square | largest-1-bordered-square | <p>Given a 2D <code>grid</code> of <code>0</code>s and <code>1</code>s, return the number of elements in the largest <strong>square</strong> subgrid that has all <code>1</code>s on its <strong>border</strong>, or <code>0</code> if such a subgrid doesn't exist in the <code>grid</code>.</p>
<p> <... | Medium | 27.8K | 54.9K | 27,759 | 54,887 | 50.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largest1BorderedSquare(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largest1BorderedSquare(int[][] grid) {\n \n }\n}"}, {"value": "pyth... | [[1,1,1],[1,0,1],[1,1,1]] | {
"name": "largest1BorderedSquare",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Matrix'] |
1,140 | Stone Game II | stone-game-ii | <p>Alice and Bob continue their games with piles of stones. There are a number of piles <strong>arranged in a row</strong>, and each pile has a positive integer number of stones <code>piles[i]</code>. The objective of the game is to end with the most stones.</p>
<p>Alice and Bob take turns, with Alice starting first.<... | Medium | 184.2K | 252.2K | 184,180 | 252,238 | 73.0% | ['stone-game-v', 'stone-game-vi', 'stone-game-vii', 'stone-game-viii', 'stone-game-ix'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int stoneGameII(vector<int>& piles) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int stoneGameII(int[] piles) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | [2,7,9,4,4] | {
"name": "stoneGameII",
"params": [
{
"name": "piles",
"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', 'Prefix Sum', 'Game Theory'] |
1,141 | User Activity for the Past 30 Days I | user-activity-for-the-past-30-days-i | <p>Table: <code>Activity</code></p>
<pre>
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| user_id | int |
| session_id | int |
| activity_date | date |
| activity_type | enum |
+---------------+---------+
This table may have duplicate rows.
The activity_type... | Easy | 368.7K | 747.2K | 368,720 | 747,169 | 49.3% | [] | ["Create table If Not Exists Activity (user_id int, session_id int, activity_date date, activity_type ENUM('open_session', 'end_session', 'scroll_down', 'send_message'))", 'Truncate table Activity', "insert into Activity (user_id, session_id, activity_date, activity_type) values ('1', '1', '2019-07-20', 'open_session')... | 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":["user_id","session_id","activity_date","activity_type"]},"rows":{"Activity":[[1,1,"2019-07-20","open_session"],[1,1,"2019-07-20","scroll_down"],[1,1,"2019-07-20","end_session"],[2,4,"2019-07-20","open_session"],[2,4,"2019-07-21","send_message"],[2,4,"2019-07-21","end_session"],[3,2,"2019-07-21",... | {"mysql": ["Create table If Not Exists Activity (user_id int, session_id int, activity_date date, activity_type ENUM('open_session', 'end_session', 'scroll_down', 'send_message'))"], "mssql": ["create table Activity (user_id int, session_id int, activity_date date, activity_type varchar(15) not null check(activity_type... | {"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,142 | User Activity for the Past 30 Days II | user-activity-for-the-past-30-days-ii | null | Easy | 46K | 128.7K | 45,987 | 128,743 | 35.7% | [] | ["Create table If Not Exists Activity (user_id int, session_id int, activity_date date, activity_type ENUM('open_session', 'end_session', 'scroll_down', 'send_message'))", 'Truncate table Activity', "insert into Activity (user_id, session_id, activity_date, activity_type) values ('1', '1', '2019-07-20', 'open_session')... | Database | null | {"headers":{"Activity":["user_id","session_id","activity_date","activity_type"]},"rows":{"Activity":[[1,1,"2019-07-20","open_session"],[1,1,"2019-07-20","scroll_down"],[1,1,"2019-07-20","end_session"],[2,4,"2019-07-20","open_session"],[2,4,"2019-07-21","send_message"],[2,4,"2019-07-21","end_session"],[3,2,"2019-07-21",... | {"mysql": ["Create table If Not Exists Activity (user_id int, session_id int, activity_date date, activity_type ENUM('open_session', 'end_session', 'scroll_down', 'send_message'))"], "mssql": ["create table Activity (user_id int, session_id int, activity_date date, activity_type varchar(15) not null check(activity_type... | {"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,143 | Longest Common Subsequence | longest-common-subsequence | <p>Given two strings <code>text1</code> and <code>text2</code>, return <em>the length of their longest <strong>common subsequence</strong>. </em>If there is no <strong>common subsequence</strong>, return <code>0</code>.</p>
<p>A <strong>subsequence</strong> of a string is a new string generated from the original strin... | Medium | 1.4M | 2.4M | 1,415,212 | 2,436,772 | 58.1% | ['longest-palindromic-subsequence', 'delete-operation-for-two-strings', 'shortest-common-supersequence', 'maximize-number-of-subsequences-in-a-string', 'subsequence-with-the-minimum-score'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestCommonSubsequence(string text1, string text2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestCommonSubsequence(String text1, String text2) {\n \n }\n}... | "abcde"
"ace" | {
"name": "longestCommonSubsequence",
"params": [
{
"name": "text1",
"type": "string"
},
{
"type": "string",
"name": "text2"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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,144 | Decrease Elements To Make Array Zigzag | decrease-elements-to-make-array-zigzag | <p>Given an array <code>nums</code> of integers, a <em>move</em> consists of choosing any element and <strong>decreasing it by 1</strong>.</p>
<p>An array <code>A</code> is a <em>zigzag array</em> if either:</p>
<ul>
<li>Every even-indexed element is greater than adjacent elements, ie. <code>A[0]... | Medium | 22.9K | 47.4K | 22,900 | 47,421 | 48.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int movesToMakeZigzag(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int movesToMakeZigzag(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python... | [1,2,3] | {
"name": "movesToMakeZigzag",
"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'] |
1,145 | Binary Tree Coloring Game | binary-tree-coloring-game | <p>Two players play a turn based game on a binary tree. We are given the <code>root</code> of this binary tree, and the number of nodes <code>n</code> in the tree. <code>n</code> is odd, and each node has a distinct value from <code>1</code> to <code>n</code>.</p>
<p>Initially, the first player names a value <code>x</... | Medium | 50.6K | 96.7K | 50,630 | 96,656 | 52.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,2,3,4,5,6,7,8,9,10,11]
11
3 | {
"name": "btreeGameWinningMove",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"type": "integer",
"name": "n"
},
{
"type": "integer",
"name": "x"
}
],
"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', 'Depth-First Search', 'Binary Tree'] |
1,146 | Snapshot Array | snapshot-array | <p>Implement a SnapshotArray that supports the following interface:</p>
<ul>
<li><code>SnapshotArray(int length)</code> initializes an array-like data structure with the given length. <strong>Initially, each element equals 0</strong>.</li>
<li><code>void set(index, val)</code> sets the element at the given <code>ind... | Medium | 239.7K | 652.4K | 239,675 | 652,419 | 36.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class SnapshotArray {\npublic:\n SnapshotArray(int length) {\n \n }\n \n void set(int index, int val) {\n \n }\n \n int snap() {\n \n }\n \n int get(int index, int snap_id) {\n \n }\n};\n\n/**\n * Your Snapshot... | ["SnapshotArray","set","snap","set","get"]
[[3],[0,5],[],[0,6],[0,0]] | {
"classname": "SnapshotArray",
"maxbytesperline": 400000,
"constructor": {
"params": [
{
"type": "integer",
"name": "length"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "index"
},
{
"type": ... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Binary Search', 'Design'] |
1,147 | Longest Chunked Palindrome Decomposition | longest-chunked-palindrome-decomposition | <p>You are given a string <code>text</code>. You should split it to k substrings <code>(subtext<sub>1</sub>, subtext<sub>2</sub>, ..., subtext<sub>k</sub>)</code> such that:</p>
<ul>
<li><code>subtext<sub>i</sub></code> is a <strong>non-empty</strong> string.</li>
<li>The concatenation of all the substrings is equal... | Hard | 27.6K | 47.1K | 27,649 | 47,070 | 58.7% | ['palindrome-rearrangement-queries'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestDecomposition(string text) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestDecomposition(String text) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | "ghiabcdefhelloadamhelloabcdefghi" | {
"name": "longestDecomposition",
"params": [
{
"name": "text",
"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... | ['Two Pointers', 'String', 'Dynamic Programming', 'Greedy', 'Rolling Hash', 'Hash Function'] |
1,148 | Article Views I | article-views-i | <p>Table: <code>Views</code></p>
<pre>
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| article_id | int |
| author_id | int |
| viewer_id | int |
| view_date | date |
+---------------+---------+
There is no primary key (column with unique values) for ... | Easy | 1.2M | 1.5M | 1,152,260 | 1,492,980 | 77.2% | [] | ['Create table If Not Exists Views (article_id int, author_id int, viewer_id int, view_date date)', 'Truncate table Views', "insert into Views (article_id, author_id, viewer_id, view_date) values ('1', '3', '5', '2019-08-01')", "insert into Views (article_id, author_id, viewer_id, view_date) values ('1', '3', '6', '201... | 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":{"Views":["article_id","author_id","viewer_id","view_date"]},"rows":{"Views":[[1,3,5,"2019-08-01"],[1,3,6,"2019-08-02"],[2,7,7,"2019-08-01"],[2,7,6,"2019-08-02"],[4,7,1,"2019-07-22"],[3,4,4,"2019-07-21"],[3,4,4,"2019-07-21"]]}} | {"mysql": ["Create table If Not Exists Views (article_id int, author_id int, viewer_id int, view_date date)"], "mssql": ["Create table Views (article_id int, author_id int, viewer_id int, view_date date)"], "oraclesql": ["Create table Views (article_id int, author_id int, viewer_id int, view_date date)", "ALTER SESSION... | {"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,149 | Article Views II | article-views-ii | null | Medium | 41.1K | 87K | 41,080 | 86,999 | 47.2% | [] | ['Create table If Not Exists Views (article_id int, author_id int, viewer_id int, view_date date)', 'Truncate table Views', "insert into Views (article_id, author_id, viewer_id, view_date) values ('1', '3', '5', '2019-08-01')", "insert into Views (article_id, author_id, viewer_id, view_date) values ('3', '4', '5', '201... | Database | null | {"headers":{"Views":["article_id","author_id","viewer_id","view_date"]},"rows":{"Views":[[1,3,5,"2019-08-01"],[3,4,5,"2019-08-01"],[1,3,6,"2019-08-02"],[2,7,7,"2019-08-01"],[2,7,6,"2019-08-02"],[4,7,1,"2019-07-22"],[3,4,4,"2019-07-21"],[3,4,4,"2019-07-21"]]}} | {"mysql": ["Create table If Not Exists Views (article_id int, author_id int, viewer_id int, view_date date)"], "mssql": ["Create table Views (article_id int, author_id int, viewer_id int, view_date date)"], "oraclesql": ["Create table Views (article_id int, author_id int, viewer_id int, view_date date)", "ALTER SESSION... | {"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,150 | Check If a Number Is Majority Element in a Sorted Array | check-if-a-number-is-majority-element-in-a-sorted-array | null | Easy | 55K | 93.2K | 55,030 | 93,178 | 59.1% | ['majority-element', 'majority-element-ii'] | [] | Algorithms | null | [2,4,5,5,5,5,5,6,6]
5 | {
"name": "isMajorityElement",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "target",
"type": "integer"
}
],
"return": {
"type": "boolean"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search'] |
1,151 | Minimum Swaps to Group All 1's Together | minimum-swaps-to-group-all-1s-together | null | Medium | 85.1K | 139.4K | 85,142 | 139,394 | 61.1% | ['minimum-adjacent-swaps-for-k-consecutive-ones', 'minimum-swaps-to-group-all-1s-together-ii', 'time-needed-to-rearrange-a-binary-string', 'minimum-moves-to-pick-k-ones'] | [] | Algorithms | null | [1,0,1,0,1] | {
"name": "minSwaps",
"params": [
{
"name": "data",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Sliding Window'] |
1,152 | Analyze User Website Visit Pattern | analyze-user-website-visit-pattern | null | Medium | 116.2K | 267.8K | 116,238 | 267,787 | 43.4% | [] | [] | Algorithms | null | ["joe","joe","joe","james","james","james","james","mary","mary","mary"]
[1,2,3,4,5,6,7,8,9,10]
["home","about","career","home","cart","maps","home","home","about","career"] | {
"name": "mostVisitedPattern",
"params": [
{
"name": "username",
"type": "string[]"
},
{
"name": "timestamp",
"type": "integer[]"
},
{
"name": "website",
"type": "string[]"
}
],
"return": {
"type": "list<string>"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sorting'] |
1,153 | String Transforms Into Another String | string-transforms-into-another-string | null | Hard | 53.2K | 152.8K | 53,198 | 152,811 | 34.8% | [] | [] | Algorithms | null | "aabcc"
"ccdee" | {
"name": "canConvert",
"params": [
{
"name": "str1",
"type": "string"
},
{
"name": "str2",
"type": "string"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String'] |
1,154 | Day of the Year | day-of-the-year | <p>Given a string <code>date</code> representing a <a href="https://en.wikipedia.org/wiki/Gregorian_calendar" target="_blank">Gregorian calendar</a> date formatted as <code>YYYY-MM-DD</code>, return <em>the day number of the year</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong... | Easy | 75.3K | 157.1K | 75,268 | 157,113 | 47.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int dayOfYear(string date) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int dayOfYear(String date) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cl... | "2019-01-09" | {
"name": "dayOfYear",
"params": [
{
"name": "date",
"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... | ['Math', 'String'] |
1,155 | Number of Dice Rolls With Target Sum | number-of-dice-rolls-with-target-sum | <p>You have <code>n</code> dice, and each dice has <code>k</code> faces numbered from <code>1</code> to <code>k</code>.</p>
<p>Given three integers <code>n</code>, <code>k</code>, and <code>target</code>, return <em>the number of possible ways (out of the </em><code>k<sup>n</sup></code><em> total ways) </em><em>to rol... | Medium | 319.9K | 520.3K | 319,896 | 520,286 | 61.5% | ['equal-sum-arrays-with-minimum-number-of-operations', 'find-missing-observations'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numRollsToTarget(int n, int k, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numRollsToTarget(int n, int k, int target) {\n \n }\n}"}, {"value": "pytho... | 1
6
3 | {
"name": "numRollsToTarget",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer",
"name": "k"
},
{
"type": "integer",
"name": "target"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming'] |
1,156 | Swap For Longest Repeated Character Substring | swap-for-longest-repeated-character-substring | <p>You are given a string <code>text</code>. You can swap two of the characters in the <code>text</code>.</p>
<p>Return <em>the length of the longest substring with repeated characters</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> text = "ababa"
<s... | Medium | 36K | 82.5K | 35,985 | 82,505 | 43.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxRepOpt1(string text) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxRepOpt1(String text) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "... | "ababa" | {
"name": "maxRepOpt1",
"params": [
{
"name": "text",
"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', 'Sliding Window'] |
1,157 | Online Majority Element In Subarray | online-majority-element-in-subarray | <p>Design a data structure that efficiently finds the <strong>majority element</strong> of a given subarray.</p>
<p>The <strong>majority element</strong> of a subarray is an element that occurs <code>threshold</code> times or more in the subarray.</p>
<p>Implementing the <code>MajorityChecker</code> class:</p>
<ul>
... | Hard | 18.7K | 44.2K | 18,685 | 44,186 | 42.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class MajorityChecker {\npublic:\n MajorityChecker(vector<int>& arr) {\n \n }\n \n int query(int left, int right, int threshold) {\n \n }\n};\n\n/**\n * Your MajorityChecker object will be instantiated and called as such:\n * MajorityChecker*... | ["MajorityChecker","query","query","query"]
[[[1,1,2,2,1,1]],[0,5,4],[0,3,3],[2,3,2]] | {
"classname": "MajorityChecker",
"constructor": {
"params": [
{
"type": "integer[]",
"name": "arr"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "left"
},
{
"type": "integer",
"name": ... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Design', 'Binary Indexed Tree', 'Segment Tree'] |
1,158 | Market Analysis I | market-analysis-i | <p>Table: <code>Users</code></p>
<pre>
+----------------+---------+
| Column Name | Type |
+----------------+---------+
| user_id | int |
| join_date | date |
| favorite_brand | varchar |
+----------------+---------+
user_id is the primary key (column with unique values) of this table.
This ta... | Medium | 127.2K | 222.4K | 127,175 | 222,427 | 57.2% | [] | ['Create table If Not Exists Users (user_id int, join_date date, favorite_brand varchar(10))', 'Create table If Not Exists Orders (order_id int, order_date date, item_id int, buyer_id int, seller_id int)', 'Create table If Not Exists Items (item_id int, item_brand varchar(10))', 'Truncate table Users', "insert into Use... | 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","join_date","favorite_brand"],"Orders":["order_id","order_date","item_id","buyer_id","seller_id"],"Items":["item_id","item_brand"]},"rows":{"Users":[[1,"2018-01-01","Lenovo"],[2,"2018-02-09","Samsung"],[3,"2018-01-19","LG"],[4,"2018-05-21","HP"]],"Orders":[[1,"2019-08-01",4,1,2],[2,"2018-... | {"mysql": ["Create table If Not Exists Users (user_id int, join_date date, favorite_brand varchar(10))", "Create table If Not Exists Orders (order_id int, order_date date, item_id int, buyer_id int, seller_id int)", "Create table If Not Exists Items (item_id int, item_brand varchar(10))"], "mssql": ["Create table Users... | {"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,159 | Market Analysis II | market-analysis-ii | null | Hard | 21.3K | 36.9K | 21,270 | 36,850 | 57.7% | [] | ['Create table If Not Exists Users (user_id int, join_date date, favorite_brand varchar(10))', 'Create table If Not Exists Orders (order_id int, order_date date, item_id int, buyer_id int, seller_id int)', 'Create table If Not Exists Items (item_id int, item_brand varchar(10))', 'Truncate table Users', "insert into Use... | Database | null | {"headers":{"Users":["user_id","join_date","favorite_brand"],"Orders":["order_id","order_date","item_id","buyer_id","seller_id"],"Items":["item_id","item_brand"]},"rows":{"Users":[[1,"2019-01-01","Lenovo"],[2,"2019-02-09","Samsung"],[3,"2019-01-19","LG"],[4,"2019-05-21","HP"]],"Orders":[[1,"2019-08-01",4,1,2],[2,"2019-... | {"mysql": ["Create table If Not Exists Users (user_id int, join_date date, favorite_brand varchar(10))", "Create table If Not Exists Orders (order_id int, order_date date, item_id int, buyer_id int, seller_id int)", "Create table If Not Exists Items (item_id int, item_brand varchar(10))"], "mssql": ["Create table Users... | {"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,160 | Find Words That Can Be Formed by Characters | find-words-that-can-be-formed-by-characters | <p>You are given an array of strings <code>words</code> and a string <code>chars</code>.</p>
<p>A string is <strong>good</strong> if it can be formed by characters from <code>chars</code> (each character can only be used once).</p>
<p>Return <em>the sum of lengths of all good strings in words</em>.</p>
<p> </p>... | Easy | 293.6K | 414K | 293,624 | 413,964 | 70.9% | ['ransom-note', 'rearrange-characters-to-make-target-string'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countCharacters(vector<string>& words, string chars) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countCharacters(String[] words, String chars) {\n \n }\n}"}, {"v... | ["cat","bt","hat","tree"]
"atach" | {
"name": "countCharacters",
"params": [
{
"name": "words",
"type": "string[]"
},
{
"name": "chars",
"type": "string"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Counting'] |
1,161 | Maximum Level Sum of a Binary Tree | maximum-level-sum-of-a-binary-tree | <p>Given the <code>root</code> of a binary tree, the level of its root is <code>1</code>, the level of its children is <code>2</code>, and so on.</p>
<p>Return the <strong>smallest</strong> level <code>x</code> such that the sum of all the values of nodes at level <code>x</code> is <strong>maximal</strong>.</p>
<p>&n... | Medium | 366.6K | 544.8K | 366,599 | 544,809 | 67.3% | ['kth-largest-sum-in-a-binary-tree', 'cousins-in-binary-tree-ii'] | [] | 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,7,0,7,-8,null,null] | {
"name": "maxLevelSum",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
1,162 | As Far from Land as Possible | as-far-from-land-as-possible | <p>Given an <code>n x n</code> <code>grid</code> containing only values <code>0</code> and <code>1</code>, where <code>0</code> represents water and <code>1</code> represents land, find a water cell such that its distance to the nearest land cell is maximized, and return the distance. If no land or ... | Medium | 166.7K | 322K | 166,710 | 322,002 | 51.8% | ['shortest-distance-from-all-buildings', 'k-highest-ranked-items-within-a-price-range', 'maximum-manhattan-distance-after-k-changes'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxDistance(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxDistance(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [[1,0,1],[0,0,0],[1,0,1]] | {
"name": "maxDistance",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Breadth-First Search', 'Matrix'] |
1,163 | Last Substring in Lexicographical Order | last-substring-in-lexicographical-order | <p>Given a string <code>s</code>, return <em>the last substring of</em> <code>s</code> <em>in lexicographical order</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> s = "abab"
<strong>Output:</strong> "bab"
<strong>Explanation:</strong> The s... | Hard | 37.6K | 109.3K | 37,587 | 109,350 | 34.4% | ['find-the-lexicographically-largest-string-from-the-box-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string lastSubstring(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String lastSubstring(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCo... | "abab" | {
"name": "lastSubstring",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "string"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String'] |
1,164 | Product Price at a Given Date | product-price-at-a-given-date | <p>Table: <code>Products</code></p>
<pre>
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| product_id | int |
| new_price | int |
| change_date | date |
+---------------+---------+
(product_id, change_date) is the primary key (combination of columns with unique ... | Medium | 227K | 396.6K | 226,983 | 396,638 | 57.2% | [] | ['Create table If Not Exists Products (product_id int, new_price int, change_date date)', 'Truncate table Products', "insert into Products (product_id, new_price, change_date) values ('1', '20', '2019-08-14')", "insert into Products (product_id, new_price, change_date) values ('2', '50', '2019-08-14')", "insert into Pr... | 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":{"Products":["product_id","new_price","change_date"]},"rows":{"Products":[[1,20,"2019-08-14"],[2,50,"2019-08-14"],[1,30,"2019-08-15"],[1,35,"2019-08-16"],[2,65,"2019-08-17"],[3,20,"2019-08-18"]]}} | {"mysql": ["Create table If Not Exists Products (product_id int, new_price int, change_date date)"], "mssql": ["Create table Products (product_id int, new_price int, change_date date)"], "oraclesql": ["Create table Products (product_id int, new_price int, change_date date)", "ALTER SESSION SET nls_date_format='YYYY-MM-... | {"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,165 | Single-Row Keyboard | single-row-keyboard | null | Easy | 90.3K | 103K | 90,257 | 102,961 | 87.7% | [] | [] | Algorithms | null | "abcdefghijklmnopqrstuvwxyz"
"cba" | {
"name": "calculateTime",
"params": [
{
"name": "keyboard",
"type": "string"
},
{
"name": "word",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String'] |
1,166 | Design File System | design-file-system | null | Medium | 72.5K | 113.4K | 72,467 | 113,402 | 63.9% | [] | [] | Algorithms | null | ["FileSystem","createPath","get"]
[[],["/a",1],["/a"]] | {
"classname": "FileSystem",
"maxbytesperline": 400000,
"constructor": {
"params": []
},
"methods": [
{
"name": "createPath",
"params": [
{
"type": "string",
"name": "path"
},
{
"type": "integer",
"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... | ['Hash Table', 'String', 'Design', 'Trie'] |
1,167 | Minimum Cost to Connect Sticks | minimum-cost-to-connect-sticks | null | Medium | 136K | 191.7K | 136,027 | 191,674 | 71.0% | ['minimum-cost-to-merge-stones'] | [] | Algorithms | null | [2,4,3] | {
"name": "connectSticks",
"params": [
{
"name": "sticks",
"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)'] |
1,168 | Optimize Water Distribution in a Village | optimize-water-distribution-in-a-village | null | Hard | 54.1K | 83.1K | 54,114 | 83,118 | 65.1% | [] | [] | Algorithms | null | 3
[1,2,2]
[[1,2,1],[2,3,1]] | {
"name": "minCostToSupplyWater",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "wells",
"type": "integer[]"
},
{
"name": "pipes",
"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... | ['Union Find', 'Graph', 'Heap (Priority Queue)', 'Minimum Spanning Tree'] |
1,169 | Invalid Transactions | invalid-transactions | <p>A transaction is possibly invalid if:</p>
<ul>
<li>the amount exceeds <code>$1000</code>, or;</li>
<li>if it occurs within (and including) <code>60</code> minutes of another transaction with the <strong>same name</strong> in a <strong>different city</strong>.</li>
</ul>
<p>You are given an array of strings <code... | Medium | 90K | 288.2K | 89,960 | 288,239 | 31.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> invalidTransactions(vector<string>& transactions) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> invalidTransactions(String[] transactions) {\n \n ... | ["alice,20,800,mtv","alice,50,100,beijing"] | {
"name": "invalidTransactions",
"params": [
{
"name": "transactions",
"type": "string[]"
}
],
"return": {
"type": "list<string>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Sorting'] |
1,170 | Compare Strings by Frequency of the Smallest Character | compare-strings-by-frequency-of-the-smallest-character | <p>Let the function <code>f(s)</code> be the <strong>frequency of the lexicographically smallest character</strong> in a non-empty string <code>s</code>. For example, if <code>s = "dcce"</code> then <code>f(s) = 2</code> because the lexicographically smallest character is <code>'c'</code>, which has a... | Medium | 86.4K | 138.1K | 86,436 | 138,149 | 62.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> numSmallerByFrequency(vector<string>& queries, vector<string>& words) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] numSmallerByFrequency(String[] queries, String[... | ["cbd"]
["zaaaz"] | {
"name": "numSmallerByFrequency",
"params": [
{
"name": "queries",
"type": "string[]"
},
{
"type": "string[]",
"name": "words"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Binary Search', 'Sorting'] |
1,171 | Remove Zero Sum Consecutive Nodes from Linked List | remove-zero-sum-consecutive-nodes-from-linked-list | <p>Given the <code>head</code> of a linked list, we repeatedly delete consecutive sequences of nodes that sum to <code>0</code> until there are no such sequences.</p>
<p>After doing so, return the head of the final linked list. You may return any such answer.</p>
<p> </p>
<p>(Note that in the examples belo... | Medium | 174.9K | 331.2K | 174,894 | 331,192 | 52.8% | ['delete-n-nodes-after-m-nodes-of-a-linked-list'] | [] | 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 * ... | [1,2,-3,3,1] | {
"name": "removeZeroSumSublists",
"params": [
{
"name": "head",
"type": "ListNode"
}
],
"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... | ['Hash Table', 'Linked List'] |
1,172 | Dinner Plate Stacks | dinner-plate-stacks | <p>You have an infinite number of stacks arranged in a row and numbered (left to right) from <code>0</code>, each of the stacks has the same maximum capacity.</p>
<p>Implement the <code>DinnerPlates</code> class:</p>
<ul>
<li><code>DinnerPlates(int capacity)</code> Initializes the object with the maximum capacity of... | Hard | 20.7K | 63.1K | 20,686 | 63,136 | 32.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class DinnerPlates {\npublic:\n DinnerPlates(int capacity) {\n \n }\n \n void push(int val) {\n \n }\n \n int pop() {\n \n }\n \n int popAtStack(int index) {\n \n }\n};\n\n/**\n * Your DinnerPlates object will ... | ["DinnerPlates","push","push","push","push","push","popAtStack","push","push","popAtStack","popAtStack","pop","pop","pop","pop","pop"]
[[2],[1],[2],[3],[4],[5],[0],[20],[21],[0],[2],[],[],[],[],[]] | {
"classname": "DinnerPlates",
"constructor": {
"params": [
{
"type": "integer",
"name": "capacity"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "val"
}
],
"name": "push",
"return": {
"t... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'Stack', 'Design', 'Heap (Priority Queue)'] |
1,173 | Immediate Food Delivery I | immediate-food-delivery-i | null | Easy | 84K | 103.9K | 84,044 | 103,922 | 80.9% | [] | ['Create table If Not Exists Delivery (delivery_id int, customer_id int, order_date date, customer_pref_delivery_date date)', 'Truncate table Delivery', "insert into Delivery (delivery_id, customer_id, order_date, customer_pref_delivery_date) values ('1', '1', '2019-08-01', '2019-08-02')", "insert into Delivery (delive... | Database | null | {"headers":{"Delivery":["delivery_id","customer_id","order_date","customer_pref_delivery_date"]},"rows":{"Delivery":[[1,1,"2019-08-01","2019-08-02"],[2,5,"2019-08-02","2019-08-02"],[3,1,"2019-08-11","2019-08-11"],[4,3,"2019-08-24","2019-08-26"],[5,4,"2019-08-21","2019-08-22"],[6,2,"2019-08-11","2019-08-13"]]}} | {"mysql": ["Create table If Not Exists Delivery (delivery_id int, customer_id int, order_date date, customer_pref_delivery_date date)"], "mssql": ["Create table Delivery (delivery_id int, customer_id int, order_date date, customer_pref_delivery_date date)"], "oraclesql": ["Create table Delivery (delivery_id int, custom... | {"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,174 | Immediate Food Delivery II | immediate-food-delivery-ii | <p>Table: <code>Delivery</code></p>
<pre>
+-----------------------------+---------+
| Column Name | Type |
+-----------------------------+---------+
| delivery_id | int |
| customer_id | int |
| order_date | date |
| customer_pref_delivery_... | Medium | 297.9K | 552.4K | 297,943 | 552,400 | 53.9% | [] | ['Create table If Not Exists Delivery (delivery_id int, customer_id int, order_date date, customer_pref_delivery_date date)', 'Truncate table Delivery', "insert into Delivery (delivery_id, customer_id, order_date, customer_pref_delivery_date) values ('1', '1', '2019-08-01', '2019-08-02')", "insert into Delivery (delive... | 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":{"Delivery":["delivery_id","customer_id","order_date","customer_pref_delivery_date"]},"rows":{"Delivery":[[1,1,"2019-08-01","2019-08-02"],[2,2,"2019-08-02","2019-08-02"],[3,1,"2019-08-11","2019-08-12"],[4,3,"2019-08-24","2019-08-24"],[5,3,"2019-08-21","2019-08-22"],[6,2,"2019-08-11","2019-08-13"],[7,4,"2019-... | {"mysql": ["Create table If Not Exists Delivery (delivery_id int, customer_id int, order_date date, customer_pref_delivery_date date)"], "mssql": ["Create table Delivery (delivery_id int, customer_id int, order_date date, customer_pref_delivery_date date)"], "oraclesql": ["Create table Delivery (delivery_id int, custom... | {"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,175 | Prime Arrangements | prime-arrangements | <p>Return the number of permutations of 1 to <code>n</code> so that prime numbers are at prime indices (1-indexed.)</p>
<p><em>(Recall that an integer is prime if and only if it is greater than 1, and cannot be written as a product of two positive integers both smaller than it.)</em></p>
<p>Since the answer... | Easy | 36.4K | 61.6K | 36,444 | 61,584 | 59.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numPrimeArrangements(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numPrimeArrangements(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "default... | 5 | {
"name": "numPrimeArrangements",
"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'] |
1,176 | Diet Plan Performance | diet-plan-performance | null | Easy | 36.2K | 67K | 36,187 | 66,972 | 54.0% | [] | [] | Algorithms | null | [1,2,3,4,5]
1
3
3 | {
"name": "dietPlanPerformance",
"params": [
{
"name": "calories",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
},
{
"type": "integer",
"name": "lower"
},
{
"type": "integer",
"name": "upper"
}
],
"return": {
"type": ... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Sliding Window'] |
1,177 | Can Make Palindrome from Substring | can-make-palindrome-from-substring | <p>You are given a string <code>s</code> and array <code>queries</code> where <code>queries[i] = [left<sub>i</sub>, right<sub>i</sub>, k<sub>i</sub>]</code>. We may rearrange the substring <code>s[left<sub>i</sub>...right<sub>i</sub>]</code> for each query and then choose up to <code>k<sub>i</sub></code> of them to rep... | Medium | 31.5K | 78.7K | 31,474 | 78,738 | 40.0% | ['plates-between-candles', 'maximize-the-number-of-partitions-after-operations'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> canMakePaliQueries(string s, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Boolean> canMakePaliQueries(String s, int[][] queries) {\n... | "abcda"
[[3,3,0],[1,2,0],[0,3,1],[0,3,2],[0,4,1]] | {
"name": "canMakePaliQueries",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "integer[][]",
"name": "queries"
}
],
"return": {
"type": "list<boolean>"
},
"manual": false
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Bit Manipulation', 'Prefix Sum'] |
1,178 | Number of Valid Words for Each Puzzle | number-of-valid-words-for-each-puzzle | With respect to a given <code>puzzle</code> string, a <code>word</code> is <em>valid</em> if both the following conditions are satisfied:
<ul>
<li><code>word</code> contains the first letter of <code>puzzle</code>.</li>
<li>For each letter in <code>word</code>, that letter is in <code>puzzle</code>.
<ul>
<li>For e... | Hard | 32.8K | 69.7K | 32,767 | 69,723 | 47.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findNumOfValidWords(vector<string>& words, vector<string>& puzzles) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> findNumOfValidWords(String[] words, Strin... | ["aaaa","asas","able","ability","actt","actor","access"]
["aboveyz","abrodyz","abslute","absoryz","actresz","gaswxyz"] | {
"name": "findNumOfValidWords",
"params": [
{
"name": "words",
"type": "string[]"
},
{
"type": "string[]",
"name": "puzzles"
}
],
"return": {
"type": "list<integer>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Bit Manipulation', 'Trie'] |
1,179 | Reformat Department Table | reformat-department-table | <p>Table: <code>Department</code></p>
<pre>
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| revenue | int |
| month | varchar |
+-------------+---------+
In SQL,(id, month) is the primary key of this table.
The table has information about the reve... | Easy | 139.3K | 181.4K | 139,261 | 181,397 | 76.8% | [] | ['Create table If Not Exists Department (id int, revenue int, month varchar(5))', 'Truncate table Department', "insert into Department (id, revenue, month) values ('1', '8000', 'Jan')", "insert into Department (id, revenue, month) values ('2', '9000', 'Jan')", "insert into Department (id, revenue, month) values ('3', '... | 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":{"Department":["id","revenue","month"]},"rows":{"Department":[[1,8000,"Jan"],[2,9000,"Jan"],[3,10000,"Feb"],[1,7000,"Feb"],[1,6000,"Mar"]]}} | {"mysql": ["Create table If Not Exists Department (id int, revenue int, month varchar(5))"], "mssql": ["Create table Department (id int, revenue int, month varchar(5))"], "oraclesql": ["Create table Department (id int, revenue int, month varchar(5))"], "database": true, "name": "reformat_table", "pythondata": ["Departm... | {"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,180 | Count Substrings with Only One Distinct Letter | count-substrings-with-only-one-distinct-letter | null | Easy | 29.5K | 36.6K | 29,518 | 36,648 | 80.5% | [] | [] | Algorithms | null | "aaaba" | {
"name": "countLetters",
"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... | ['Math', 'String'] |
1,181 | Before and After Puzzle | before-and-after-puzzle | null | Medium | 10K | 21.5K | 9,989 | 21,498 | 46.5% | [] | [] | Algorithms | null | ["writing code","code rocks"] | {
"name": "beforeAndAfterPuzzles",
"params": [
{
"name": "phrases",
"type": "string[]"
}
],
"return": {
"type": "list<string>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Sorting'] |
1,182 | Shortest Distance to Target Color | shortest-distance-to-target-color | null | Medium | 37.2K | 67.1K | 37,182 | 67,073 | 55.4% | [] | [] | Algorithms | null | [1,1,2,1,3,2,2,3,3]
[[1,3],[2,2],[6,1]] | {
"name": "shortestDistanceColor",
"params": [
{
"name": "colors",
"type": "integer[]"
},
{
"name": "queries",
"type": "integer[][]"
}
],
"return": {
"type": "list<integer>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Dynamic Programming'] |
1,183 | Maximum Number of Ones | maximum-number-of-ones | null | Hard | 5.6K | 8.1K | 5,552 | 8,096 | 68.6% | [] | [] | Algorithms | null | 3
3
2
1 | {
"name": "maximumNumberOfOnes",
"params": [
{
"name": "width",
"type": "integer"
},
{
"name": "height",
"type": "integer"
},
{
"name": "sideLength",
"type": "integer"
},
{
"name": "maxOnes",
"type": "integer"
}
],
"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... | ['Math', 'Greedy', 'Sorting', 'Heap (Priority Queue)'] |
1,184 | Distance Between Bus Stops | distance-between-bus-stops | <p>A bus has <code>n</code> stops numbered from <code>0</code> to <code>n - 1</code> that form a circle. We know the distance between all pairs of neighboring stops where <code>distance[i]</code> is the distance between the stops number <code>i</code> and <code>(i + 1) % n</code>.</p>
<p>The bus goes al... | Easy | 69.2K | 127K | 69,217 | 127,017 | 54.5% | ['minimum-costs-using-the-train-line'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int distanceBetweenBusStops(vector<int>& distance, int start, int destination) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int distanceBetweenBusStops(int[] distance, int start, i... | [1,2,3,4]
0
1 | {
"name": "distanceBetweenBusStops",
"params": [
{
"name": "distance",
"type": "integer[]"
},
{
"type": "integer",
"name": "start"
},
{
"type": "integer",
"name": "destination"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array'] |
1,185 | Day of the Week | day-of-the-week | <p>Given a date, return the corresponding day of the week for that date.</p>
<p>The input is given as three integers representing the <code>day</code>, <code>month</code> and <code>year</code> respectively.</p>
<p>Return the answer as one of the following values <code>{"Sunday", "Monday", &qu... | Easy | 77.1K | 132.1K | 77,106 | 132,147 | 58.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string dayOfTheWeek(int day, int month, int year) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String dayOfTheWeek(int day, int month, int year) {\n \n }\n}"}, {"value": ... | 31
8
2019 | {
"name": "dayOfTheWeek",
"params": [
{
"name": "day",
"type": "integer"
},
{
"type": "integer",
"name": "month"
},
{
"type": "integer",
"name": "year"
}
],
"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... | ['Math'] |
1,186 | Maximum Subarray Sum with One Deletion | maximum-subarray-sum-with-one-deletion | <p>Given an array of integers, return the maximum sum for a <strong>non-empty</strong> subarray (contiguous elements) with at most one element deletion. In other words, you want to choose a subarray and optionally delete one element from it so that there is still at least one element left and the sum of ... | Medium | 59.9K | 133.7K | 59,936 | 133,687 | 44.8% | ['maximize-subarray-sum-after-removing-all-occurrences-of-one-element', 'maximum-unique-subarray-sum-after-deletion'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumSum(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumSum(int[] arr) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode"... | [1,-2,0,3] | {
"name": "maximumSum",
"params": [
{
"name": "arr",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming'] |
1,187 | Make Array Strictly Increasing | make-array-strictly-increasing | <p>Given two integer arrays <code>arr1</code> and <code>arr2</code>, return the minimum number of operations (possibly zero) needed to make <code>arr1</code> strictly increasing.</p>
<p>In one operation, you can choose two indices <code>0 <= i < arr1.length</code> and <code>0 <= ... | Hard | 61.8K | 106.8K | 61,816 | 106,841 | 57.9% | ['make-array-non-decreasing-or-non-increasing'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int makeArrayIncreasing(vector<int>& arr1, vector<int>& arr2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int makeArrayIncreasing(int[] arr1, int[] arr2) {\n \n }\n}"}, ... | [1,5,3,6,7]
[1,3,2,4] | {
"name": "makeArrayIncreasing",
"params": [
{
"name": "arr1",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "arr2"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Sorting'] |
1,188 | Design Bounded Blocking Queue | design-bounded-blocking-queue | null | Medium | 58K | 79.6K | 58,048 | 79,563 | 73.0% | [] | [] | Concurrency | null | 1
1
["BoundedBlockingQueue","enqueue","dequeue","dequeue","enqueue","enqueue","enqueue","enqueue","dequeue"]
[[2],[1],[],[],[0],[2],[3],[4],[]] | {
"name": "foobar",
"params": [
{
"name": "numsProducerThread",
"type": "integer"
},
{
"type": "integer",
"name": "numsConsumerThread"
},
{
"type": "string[]",
"name": "methods"
},
{
"type": "integer[]",
"name": "params"
}
],
"retur... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Concurrency'] |
1,189 | Maximum Number of Balloons | maximum-number-of-balloons | <p>Given a string <code>text</code>, you want to use the characters of <code>text</code> to form as many instances of the word <strong>"balloon"</strong> as possible.</p>
<p>You can use each character in <code>text</code> <strong>at most once</strong>. Return the maximum number of instances that can be forme... | Easy | 267.4K | 447.8K | 267,402 | 447,828 | 59.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxNumberOfBalloons(string text) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxNumberOfBalloons(String text) {\n \n }\n}"}, {"value": "python", "text": "Python"... | "nlaebolko" | {
"name": "maxNumberOfBalloons",
"params": [
{
"name": "text",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Counting'] |
1,190 | Reverse Substrings Between Each Pair of Parentheses | reverse-substrings-between-each-pair-of-parentheses | <p>You are given a string <code>s</code> that consists of lower case English letters and brackets.</p>
<p>Reverse the strings in each pair of matching parentheses, starting from the innermost one.</p>
<p>Your result should <strong>not</strong> contain any brackets.</p>
<p> </p>
<p><strong class="example">Exampl... | Medium | 230.2K | 321.2K | 230,214 | 321,176 | 71.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string reverseParentheses(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String reverseParentheses(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | "(abcd)" | {
"name": "reverseParentheses",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Stack'] |
1,191 | K-Concatenation Maximum Sum | k-concatenation-maximum-sum | <p>Given an integer array <code>arr</code> and an integer <code>k</code>, modify the array by repeating it <code>k</code> times.</p>
<p>For example, if <code>arr = [1, 2]</code> and <code>k = 3 </code>then the modified array will be <code>[1, 2, 1, 2, 1, 2]</code>.</p>
<p>Return the maximum sub-array sum in the modif... | Medium | 38.6K | 160.2K | 38,650 | 160,203 | 24.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int kConcatenationMaxSum(vector<int>& arr, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int kConcatenationMaxSum(int[] arr, int k) {\n \n }\n}"}, {"value": "python... | [1,2]
3 | {
"name": "kConcatenationMaxSum",
"params": [
{
"name": "arr",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming'] |
1,192 | Critical Connections in a Network | critical-connections-in-a-network | <p>There are <code>n</code> servers numbered from <code>0</code> to <code>n - 1</code> connected by undirected server-to-server <code>connections</code> forming a network where <code>connections[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> represents a connection between servers <code>a<sub>i</sub></code> and <code>b<sub... | Hard | 268.7K | 468.1K | 268,693 | 468,072 | 57.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> criticalConnections(int n, vector<vector<int>>& connections) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> criticalConnections(int n, List<Li... | 4
[[0,1],[1,2],[2,0],[1,3]] | {
"name": "criticalConnections",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "list<list<integer>>",
"name": "connections"
}
],
"return": {
"type": "list<list<integer>>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Depth-First Search', 'Graph', 'Biconnected Component'] |
1,193 | Monthly Transactions I | monthly-transactions-i | <p>Table: <code>Transactions</code></p>
<pre>
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| id | int |
| country | varchar |
| state | enum |
| amount | int |
| trans_date | date |
+---------------+---------+
id is the primary key... | Medium | 345.2K | 592.5K | 345,218 | 592,464 | 58.3% | ['monthly-transactions-ii'] | ["Create table If Not Exists Transactions (id int, country varchar(4), state enum('approved', 'declined'), amount int, trans_date date)", 'Truncate table Transactions', "insert into Transactions (id, country, state, amount, trans_date) values ('121', 'US', 'approved', '1000', '2018-12-18')", "insert into Transactions (... | 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":{"Transactions":["id","country","state","amount","trans_date"]},"rows":{"Transactions":[[121,"US","approved",1000,"2018-12-18"],[122,"US","declined",2000,"2018-12-19"],[123,"US","approved",2000,"2019-01-01"],[124,"DE","approved",2000,"2019-01-07"]]}} | {"mysql": ["Create table If Not Exists Transactions (id int, country varchar(4), state enum('approved', 'declined'), amount int, trans_date date)"], "mssql": ["Create table Transactions (id int, country varchar(4), state varchar(10) check(state in ('approved', 'declined')), amount int, trans_date date)"], "oraclesql": ... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,194 | Tournament Winners | tournament-winners | null | Hard | 22.9K | 46.1K | 22,899 | 46,052 | 49.7% | [] | ['Create table If Not Exists Players (player_id int, group_id int)', 'Create table If Not Exists Matches (match_id int, first_player int, second_player int, first_score int, second_score int)\n', 'Truncate table Players', "insert into Players (player_id, group_id) values ('10', '2')", "insert into Players (player_id, g... | Database | null | {"headers":{"Players":["player_id","group_id"],"Matches":["match_id","first_player","second_player","first_score","second_score"]},"rows":{"Players":[[10,2],[15,1],[20,3],[25,1],[30,1],[35,2],[40,3],[45,1],[50,2]],"Matches":[[1,15,45,3,0],[2,30,25,1,2],[3,30,15,2,0],[4,40,20,5,2],[5,35,50,1,1]]}} | {"mysql": ["Create table If Not Exists Players (player_id int, group_id int)", "Create table If Not Exists Matches (match_id int, first_player int, second_player int, first_score int, second_score int)\n"], "mssql": ["Create table Players (player_id int, group_id int)", "Create table Matches (match_id int, first_player... | {"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,195 | Fizz Buzz Multithreaded | fizz-buzz-multithreaded | <p>You have the four functions:</p>
<ul>
<li><code>printFizz</code> that prints the word <code>"fizz"</code> to the console,</li>
<li><code>printBuzz</code> that prints the word <code>"buzz"</code> to the console,</li>
<li><code>printFizzBuzz</code> that prints the word <code>"fizzbuzz"... | Medium | 59.2K | 80.4K | 59,233 | 80,352 | 73.7% | ['fizz-buzz', 'print-zero-even-odd'] | [] | Concurrency | [{"value": "cpp", "text": "C++", "defaultCode": "class FizzBuzz {\nprivate:\n int n;\n\npublic:\n FizzBuzz(int n) {\n this->n = n;\n }\n\n // printFizz() outputs \"fizz\".\n void fizz(function<void()> printFizz) {\n \n }\n\n // printBuzz() outputs \"buzz\".\n void buzz(function<voi... | 15 | {
"name": "foobar",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
},
"manual": true,
"languages": [
"java",
"cpp",
"python3",
"python",
"csharp",
"c"
]
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Concurrency'] |
1,196 | How Many Apples Can You Put into the Basket | how-many-apples-can-you-put-into-the-basket | null | Easy | 43.3K | 64.6K | 43,335 | 64,629 | 67.1% | [] | [] | Algorithms | null | [100,200,150,1000] | {
"name": "maxNumberOfApples",
"params": [
{
"name": "weight",
"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,197 | Minimum Knight Moves | minimum-knight-moves | null | Medium | 173.3K | 420.6K | 173,326 | 420,632 | 41.2% | ['check-knight-tour-configuration'] | [] | Algorithms | null | 2
1 | {
"name": "minKnightMoves",
"params": [
{
"name": "x",
"type": "integer"
},
{
"name": "y",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Breadth-First Search'] |
1,198 | Find Smallest Common Element in All Rows | find-smallest-common-element-in-all-rows | null | Medium | 48.3K | 63.2K | 48,288 | 63,195 | 76.4% | ['intersection-of-multiple-arrays'] | [] | Algorithms | null | [[1,2,3,4,5],[2,4,5,8,10],[3,5,7,9,11],[1,3,5,7,9]] | {
"name": "smallestCommonElement",
"params": [
{
"name": "mat",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Binary Search', 'Matrix', 'Counting'] |
1,199 | Minimum Time to Build Blocks | minimum-time-to-build-blocks | null | Hard | 6.9K | 14.9K | 6,895 | 14,942 | 46.1% | ['find-time-required-to-eliminate-bacterial-strains'] | [] | Algorithms | null | [1]
1 | {
"name": "minBuildTime",
"params": [
{
"name": "blocks",
"type": "integer[]"
},
{
"name": "split",
"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', 'Greedy', 'Heap (Priority Queue)'] |
1,200 | Minimum Absolute Difference | minimum-absolute-difference | <p>Given an array of <strong>distinct</strong> integers <code>arr</code>, find all pairs of elements with the minimum absolute difference of any two elements.</p>
<p>Return a list of pairs in ascending order(with respect to pairs), each pair <code>[a, b]</code> follows</p>
<ul>
<li><code>a, b</code> are from <code>a... | Easy | 234.6K | 333.1K | 234,621 | 333,103 | 70.4% | ['minimum-cost-of-buying-candies-with-discount', 'minimize-the-maximum-difference-of-pairs'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> minimumAbsDifference(vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<Integer>> minimumAbsDifference(int[] arr) {\n \n }\n}"},... | [4,2,1,3] | {
"name": "minimumAbsDifference",
"params": [
{
"name": "arr",
"type": "integer[]"
}
],
"return": {
"type": "list<list<integer>>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Sorting'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.