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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
601 | Human Traffic of Stadium | human-traffic-of-stadium | <p>Table: <code>Stadium</code></p>
<pre>
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| id | int |
| visit_date | date |
| people | int |
+---------------+---------+
visit_date is the column with unique values for this table.
Each row of this table... | Hard | 125.9K | 253.8K | 125,870 | 253,845 | 49.6% | [] | ['Create table If Not Exists Stadium (id int, visit_date DATE NULL, people int)', 'Truncate table Stadium', "insert into Stadium (id, visit_date, people) values ('1', '2017-01-01', '10')", "insert into Stadium (id, visit_date, people) values ('2', '2017-01-02', '109')", "insert into Stadium (id, visit_date, people) val... | 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": {"Stadium": ["id", "visit_date", "people"]}, "rows": {"Stadium": [[1, "2017-01-01", 10], [2, "2017-01-02", 109], [3, "2017-01-03", 150], [4, "2017-01-04", 99], [5, "2017-01-05", 145], [6, "2017-01-06", 1455], [7, "2017-01-07", 199], [8, "2017-01-09", 188]]}} | {"mysql": ["Create table If Not Exists Stadium (id int, visit_date DATE NULL, people int)"], "mssql": ["Create table Stadium (id int, visit_date DATE NULL, people int)"], "oraclesql": ["Create table Stadium (id int, visit_date DATE, people int)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD'"], "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'] |
602 | Friend Requests II: Who Has the Most Friends | friend-requests-ii-who-has-the-most-friends | <p>Table: <code>RequestAccepted</code></p>
<pre>
+----------------+---------+
| Column Name | Type |
+----------------+---------+
| requester_id | int |
| accepter_id | int |
| accept_date | date |
+----------------+---------+
(requester_id, accepter_id) is the primary key (combination of colu... | Medium | 225.4K | 373.4K | 225,427 | 373,400 | 60.4% | [] | ['Create table If Not Exists RequestAccepted (requester_id int not null, accepter_id int null, accept_date date null)', 'Truncate table RequestAccepted', "insert into RequestAccepted (requester_id, accepter_id, accept_date) values ('1', '2', '2016/06/03')", "insert into RequestAccepted (requester_id, accepter_id, accep... | 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":{"RequestAccepted":["requester_id","accepter_id","accept_date"]},"rows":{"RequestAccepted":[[1,2,"2016/06/03"],[1,3,"2016/06/08"],[2,3,"2016/06/08"],[3,4,"2016/06/09"]]}} | {"mysql": ["Create table If Not Exists RequestAccepted (requester_id int not null, accepter_id int null, accept_date date null)"], "mssql": ["Create table RequestAccepted (requester_id int not null, accepter_id int null, accept_date date null)"], "oraclesql": ["Create table RequestAccepted (requester_id int not null, a... | {"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'] |
603 | Consecutive Available Seats | consecutive-available-seats | null | Easy | 95.2K | 145.4K | 95,169 | 145,409 | 65.4% | [] | ['Create table If Not Exists Cinema (seat_id int primary key auto_increment, free bool)', 'Truncate table Cinema', "insert into Cinema (seat_id, free) values ('1', '1')", "insert into Cinema (seat_id, free) values ('2', '0')", "insert into Cinema (seat_id, free) values ('3', '1')", "insert into Cinema (seat_id, free) v... | Database | null | {"headers":{"Cinema":["seat_id","free"]},"rows":{"Cinema":[[1,1],[2,0],[3,1],[4,1],[5,1]]}} | {"mysql": ["Create table If Not Exists Cinema (seat_id int primary key auto_increment, free bool)"], "mssql": ["Create table Cinema (seat_id int primary key, free BIT)"], "oraclesql": ["Create table Cinema (seat_id int primary key, free NUMBER(1))"], "database": true, "name": "consecutive_available_seats", "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'] |
604 | Design Compressed String Iterator | design-compressed-string-iterator | null | Easy | 36.6K | 91.2K | 36,584 | 91,213 | 40.1% | ['lru-cache', 'string-compression'] | [] | Algorithms | null | ["StringIterator","next","next","next","next","next","next","hasNext","next","hasNext"]
[["L1e2t1C1o1d1e1"],[],[],[],[],[],[],[],[],[]] | {
"classname": "StringIterator",
"maxbytesperline": 200000,
"constructor": {
"params": [
{
"type": "string",
"name": "compressedString"
}
]
},
"methods": [
{
"name" : "next",
"params": [
],
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Design', 'Iterator'] |
605 | Can Place Flowers | can-place-flowers | <p>You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in <strong>adjacent</strong> plots.</p>
<p>Given an integer array <code>flowerbed</code> containing <code>0</code>'s and <code>1</code>'s, where <code>0</code> means empty and <code>1</code... | Easy | 1.1M | 3.9M | 1,127,366 | 3,909,040 | 28.8% | ['teemo-attacking', 'asteroid-collision'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canPlaceFlowers(vector<int>& flowerbed, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canPlaceFlowers(int[] flowerbed, int n) {\n \n }\n}"}, {"value": ... | [1,0,0,0,1]
1 | {
"name": "canPlaceFlowers",
"params": [
{
"name": "flowerbed",
"type": "integer[]"
},
{
"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... | ['Array', 'Greedy'] |
606 | Construct String from Binary Tree | construct-string-from-binary-tree | <p>Given the <code>root</code> node of a binary tree, your task is to create a string representation of the tree following a specific set of formatting rules. The representation should be based on a preorder traversal of the binary tree and must adhere to the following guidelines:</p>
<ul>
<li>
<p><strong>Node Repre... | Medium | 336.6K | 481.2K | 336,637 | 481,163 | 70.0% | ['construct-binary-tree-from-string', 'find-duplicate-subtrees'] | [] | 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] | {
"name": "tree2str",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"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', 'Tree', 'Depth-First Search', 'Binary Tree'] |
607 | Sales Person | sales-person | <p>Table: <code>SalesPerson</code></p>
<pre>
+-----------------+---------+
| Column Name | Type |
+-----------------+---------+
| sales_id | int |
| name | varchar |
| salary | int |
| commission_rate | int |
| hire_date | date |
+-----------------+---------+
sale... | Easy | 271K | 411.7K | 271,031 | 411,737 | 65.8% | [] | ['Create table If Not Exists SalesPerson (sales_id int, name varchar(255), salary int, commission_rate int, hire_date date)', 'Create table If Not Exists Company (com_id int, name varchar(255), city varchar(255))', 'Create table If Not Exists Orders (order_id int, order_date date, com_id int, sales_id int, amount int)'... | 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": {"SalesPerson": ["sales_id", "name", "salary", "commission_rate","hire_date"], "Company": ["com_id", "name","city"],"Orders":["order_id","order_date","com_id","sales_id","amount"]}, "rows": {"SalesPerson": [[1, "John", 100000, 6, "4/1/2006"], [2, "Amy", 12000, 5,"5/1/2010"], [3, "Mark", 65000, 12, "12/25/20... | {"mysql": ["Create table If Not Exists SalesPerson (sales_id int, name varchar(255), salary int, commission_rate int, hire_date date)", "Create table If Not Exists Company (com_id int, name varchar(255), city varchar(255))", "Create table If Not Exists Orders (order_id int, order_date date, com_id int, sales_id int, am... | {"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'] |
608 | Tree Node | tree-node | <p>Table: <code>Tree</code></p>
<pre>
+-------------+------+
| Column Name | Type |
+-------------+------+
| id | int |
| p_id | int |
+-------------+------+
id is the column with unique values for this table.
Each row of this table contains information about the id of a node and the id of its parent... | Medium | 188.4K | 255.9K | 188,439 | 255,881 | 73.6% | [] | ['Create table If Not Exists Tree (id int, p_id int)', 'Truncate table Tree', "insert into Tree (id, p_id) values ('1', NULL)", "insert into Tree (id, p_id) values ('2', '1')", "insert into Tree (id, p_id) values ('3', '1')", "insert into Tree (id, p_id) values ('4', '2')", "insert into Tree (id, p_id) values ('5', '2'... | 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":{"Tree":["id","p_id"]},"rows":{"Tree":[[1,null],[2,1],[3,1],[4,2],[5,2]]}} | {"mysql": ["Create table If Not Exists Tree (id int, p_id int)"], "mssql": ["Create table Tree (id int, p_id int)"], "oraclesql": ["Create table Tree (id int, p_id int)"], "database": true, "name": "tree_node", "pythondata": ["Tree = pd.DataFrame([], columns=['id', 'p_id']).astype({'id':'Int64', 'p_id':'Int64'})"], "po... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
609 | Find Duplicate File in System | find-duplicate-file-in-system | <p>Given a list <code>paths</code> of directory info, including the directory path, and all the files with contents in this directory, return <em>all the duplicate files in the file system in terms of their paths</em>. You may return the answer in <strong>any order</strong>.</p>
<p>A group of duplicate files consists ... | Medium | 160.6K | 237.8K | 160,643 | 237,796 | 67.6% | ['delete-duplicate-folders-in-system'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<string>> findDuplicate(vector<string>& paths) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<List<String>> findDuplicate(String[] paths) {\n \n }\n}"}, {... | ["root/a 1.txt(abcd) 2.txt(efgh)","root/c 3.txt(abcd)","root/c/d 4.txt(efgh)","root 4.txt(efgh)"] | {
"name": "findDuplicate",
"params": [
{
"name": "paths",
"type": "string[]"
}
],
"return": {
"type": "list<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'] |
610 | Triangle Judgement | triangle-judgement | <p>Table: <code>Triangle</code></p>
<pre>
+-------------+------+
| Column Name | Type |
+-------------+------+
| x | int |
| y | int |
| z | int |
+-------------+------+
In SQL, (x, y, z) is the primary key column for this table.
Each row of this table contains the lengths of three lin... | Easy | 311.9K | 424.7K | 311,871 | 424,738 | 73.4% | [] | ['Create table If Not Exists Triangle (x int, y int, z int)', 'Truncate table Triangle', "insert into Triangle (x, y, z) values ('13', '15', '30')", "insert into Triangle (x, y, z) values ('10', '20', '15')"] | 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":{"Triangle":["x","y","z"]},"rows":{"Triangle":[[13,15,30],[10,20,15]]}} | {"mysql": ["Create table If Not Exists Triangle (x int, y int, z int)"], "mssql": ["Create table Triangle (x int, y int, z int)"], "oraclesql": ["Create table Triangle (x int, y int, z int)"], "database": true, "name": "triangle_judgement", "pythondata": ["Triangle = pd.DataFrame([], columns=['x', 'y', 'z']).astype({'x... | {"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'] |
611 | Valid Triangle Number | valid-triangle-number | <p>Given an integer array <code>nums</code>, return <em>the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [2,2,3,4]
<strong>Output:</strong> ... | Medium | 222.5K | 427.4K | 222,492 | 427,441 | 52.1% | ['3sum-smaller', 'find-polygon-with-the-largest-perimeter'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int triangleNumber(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int triangleNumber(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [2,2,3,4] | {
"name": "triangleNumber",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Binary Search', 'Greedy', 'Sorting'] |
612 | Shortest Distance in a Plane | shortest-distance-in-a-plane | null | Medium | 44.9K | 73.2K | 44,884 | 73,247 | 61.3% | [] | ['Create Table If Not Exists Point2D (x int not null, y int not null)', 'Truncate table Point2D', "insert into Point2D (x, y) values ('-1', '-1')", "insert into Point2D (x, y) values ('0', '0')", "insert into Point2D (x, y) values ('-1', '-2')"] | Database | null | {"headers":{"Point2D":["x","y"]},"rows":{"Point2D":[[-1,-1],[0,0],[-1,-2]]}} | {"mysql": ["Create Table If Not Exists Point2D (x int not null, y int not null)"], "mssql": ["Create Table Point2D (x int not null, y int not null)"], "oraclesql": ["Create Table Point2D (x int not null, y int not null)"], "database": true, "name": "shortest_distance", "pythondata": ["Point2D = pd.DataFrame([], columns... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
613 | Shortest Distance in a Line | shortest-distance-in-a-line | null | Easy | 78.8K | 98.5K | 78,822 | 98,543 | 80.0% | [] | ['Create Table If Not Exists Point (x int not null)', 'Truncate table Point', "insert into Point (x) values ('-1')", "insert into Point (x) values ('0')", "insert into Point (x) values ('2')"] | Database | null | {"headers":{"Point":["x"]},"rows":{"Point":[[-1],[0],[2]]}} | {"mysql": ["Create Table If Not Exists Point (x int not null)"], "mssql": ["Create Table Point (x int not null)"], "oraclesql": ["Create Table Point (x int not null)"], "database": true, "name": "shortest_distance", "pythondata": ["Point = pd.DataFrame([], columns=['x']).astype({'x':'Int64'})"], "postgresql": ["Create ... | {"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'] |
614 | Second Degree Follower | second-degree-follower | null | Medium | 58.1K | 146.2K | 58,124 | 146,204 | 39.8% | [] | ['Create table If Not Exists Follow (followee varchar(255), follower varchar(255))', 'Truncate table Follow', "insert into Follow (followee, follower) values ('Alice', 'Bob')", "insert into Follow (followee, follower) values ('Bob', 'Cena')", "insert into Follow (followee, follower) values ('Bob', 'Donald')", "insert i... | Database | null | {"headers":{"Follow":["followee","follower"]},"rows":{"Follow":[["Alice", "Bob"], ["Bob", "Cena"], ["Bob", "Donald"], ["Donald", "Edward"]]}} | {"mysql": ["Create table If Not Exists Follow (followee varchar(255), follower varchar(255))"], "mssql": ["Create table Follow (followee varchar(255), follower varchar(255))"], "oraclesql": ["Create table Follow (followee varchar(255), follower varchar(255))"], "database": true, "name": "second_degree_follower", "pytho... | {"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'] |
615 | Average Salary: Departments VS Company | average-salary-departments-vs-company | null | Hard | 40.1K | 70.9K | 40,130 | 70,912 | 56.6% | ['countries-you-can-safely-invest-in'] | ['Create table If Not Exists Salary (id int, employee_id int, amount int, pay_date date)', 'Create table If Not Exists Employee (employee_id int, department_id int)', 'Truncate table Salary', "insert into Salary (id, employee_id, amount, pay_date) values ('1', '1', '9000', '2017/03/31')", "insert into Salary (id, emplo... | Database | null | {"headers":{"Salary":["id","employee_id","amount","pay_date"],"Employee":["employee_id","department_id"]},"rows":{"Salary":[[1,1,9000,"2017/03/31"],[2,2,6000,"2017/03/31"],[3,3,10000,"2017/03/31"],[4,1,7000,"2017/02/28"],[5,2,6000,"2017/02/28"],[6,3,8000,"2017/02/28"]],"Employee":[[1,1],[2,2],[3,2]]}} | {"mysql": ["Create table If Not Exists Salary (id int, employee_id int, amount int, pay_date date)", "Create table If Not Exists Employee (employee_id int, department_id int)"], "mssql": ["Create table Salary (id int, employee_id int, amount int, pay_date date)", "Create table Employee (employee_id int, department_id i... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
616 | Add Bold Tag in String | add-bold-tag-in-string | null | Medium | 99K | 195K | 99,041 | 194,984 | 50.8% | ['merge-intervals', 'tag-validator'] | [] | Algorithms | null | "abcxyz123"
["abc","123"] | {
"name": "addBoldTag",
"params": [
{
"name": "s",
"type": "string"
},
{
"name": "words",
"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... | ['Array', 'Hash Table', 'String', 'Trie', 'String Matching'] |
617 | Merge Two Binary Trees | merge-two-binary-trees | <p>You are given two binary trees <code>root1</code> and <code>root2</code>.</p>
<p>Imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not. You need to merge the two trees into a new binary tree. The merge rule is that if two nodes overlap, then su... | Easy | 831.8K | 1M | 831,831 | 1,049,847 | 79.2% | [] | [] | 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,3,2,5]
[2,1,3,null,4,null,7] | {
"name": "mergeTrees",
"params": [
{
"name": "root1",
"type": "TreeNode",
"dealloc": false
},
{
"name": "root2",
"type": "TreeNode",
"dealloc": false
}
],
"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... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
618 | Students Report By Geography | students-report-by-geography | null | Hard | 26.6K | 41.8K | 26,618 | 41,806 | 63.7% | [] | ['Create table If Not Exists Student (name varchar(50), continent varchar(7))', 'Truncate table Student', "insert into Student (name, continent) values ('Jane', 'America')", "insert into Student (name, continent) values ('Pascal', 'Europe')", "insert into Student (name, continent) values ('Xi', 'Asia')", "insert into S... | Database | null | {"headers":{"Student":["name","continent"]},"rows":{"Student":[["Jane","America"],["Pascal","Europe"],["Xi","Asia"],["Jack","America"]]}} | {"mysql": ["Create table If Not Exists Student (name varchar(50), continent varchar(7))"], "mssql": ["Create table Student (name varchar(50), continent varchar(7))"], "oraclesql": ["Create table Student (name varchar(50), continent varchar(7))"], "database": true, "name": "geography_report", "pythondata": ["Student = p... | {"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'] |
619 | Biggest Single Number | biggest-single-number | <p>Table: <code>MyNumbers</code></p>
<pre>
+-------------+------+
| Column Name | Type |
+-------------+------+
| num | int |
+-------------+------+
This table may contain duplicates (In other words, there is no primary key for this table in SQL).
Each row of this table contains an integer.
</pre>
<p> <... | Easy | 361.3K | 523.8K | 361,303 | 523,758 | 69.0% | [] | ['Create table If Not Exists MyNumbers (num int)', 'Truncate table MyNumbers', "insert into MyNumbers (num) values ('8')", "insert into MyNumbers (num) values ('8')", "insert into MyNumbers (num) values ('3')", "insert into MyNumbers (num) values ('3')", "insert into MyNumbers (num) values ('1')", "insert into MyNumber... | 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": {"MyNumbers": ["num"]}, "rows": {"MyNumbers": [[8],[8],[3],[3],[1],[4],[5],[6]]}} | {"mysql": ["Create table If Not Exists MyNumbers (num int)"], "mssql": ["Create table MyNumbers (num int)"], "oraclesql": ["Create table MyNumbers (num int)"], "database": true, "name": "biggest_single_number", "pythondata": ["MyNumbers = pd.DataFrame([], columns=['num']).astype({'num':'Int64'})"], "postgresql": ["Crea... | {"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'] |
620 | Not Boring Movies | not-boring-movies | <p>Table: <code>Cinema</code></p>
<pre>
+----------------+----------+
| Column Name | Type |
+----------------+----------+
| id | int |
| movie | varchar |
| description | varchar |
| rating | float |
+----------------+----------+
id is the primary key (column with uniq... | Easy | 772.1K | 1M | 772,058 | 1,031,749 | 74.8% | [] | ['Create table If Not Exists cinema (id int, movie varchar(255), description varchar(255), rating float(2, 1))', 'Truncate table cinema', "insert into cinema (id, movie, description, rating) values ('1', 'War', 'great 3D', '8.9')", "insert into cinema (id, movie, description, rating) values ('2', 'Science', 'fiction', ... | 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":{"cinema":["id", "movie", "description", "rating"]},"rows":{"cinema":[[1, "War", "great 3D", 8.9], [2, "Science", "fiction", 8.5], [3, "irish", "boring", 6.2], [4, "Ice song", "Fantacy", 8.6], [5, "House card", "Interesting", 9.1]]}} | {"mysql": ["Create table If Not Exists cinema (id int, movie varchar(255), description varchar(255), rating float(2, 1))"], "mssql": ["Create table cinema (id int, movie varchar(255), description varchar(255), rating decimal(2, 1))"], "oraclesql": ["Create table cinema (id int, movie varchar(255), description varchar(2... | {"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'] |
621 | Task Scheduler | task-scheduler | <p>You are given an array of CPU <code>tasks</code>, each labeled with a letter from A to Z, and a number <code>n</code>. Each CPU interval can be idle or allow the completion of one task. Tasks can be completed in any order, but there's a constraint: there has to be a gap of <strong>at least</strong> <code>n</code... | Medium | 769.4K | 1.3M | 769,421 | 1,258,905 | 61.1% | ['rearrange-string-k-distance-apart', 'reorganize-string', 'maximum-number-of-weeks-for-which-you-can-work', 'find-minimum-time-to-finish-all-jobs-ii', 'task-scheduler-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int leastInterval(vector<char>& tasks, int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int leastInterval(char[] tasks, int n) {\n \n }\n}"}, {"value": "python", "text... | ["A","A","A","B","B","B"]
2 | {
"name": "leastInterval",
"params": [
{
"name": "tasks",
"type": "character[]"
},
{
"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', 'Hash Table', 'Greedy', 'Sorting', 'Heap (Priority Queue)', 'Counting'] |
622 | Design Circular Queue | design-circular-queue | <p>Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle, and the last position is connected back to the first position to make a circle. It is also called "Ring Buffer".</p>
<p>One of... | Medium | 375.3K | 715.2K | 375,275 | 715,244 | 52.5% | ['design-circular-deque', 'design-front-middle-back-queue'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class MyCircularQueue {\npublic:\n MyCircularQueue(int k) {\n \n }\n \n bool enQueue(int value) {\n \n }\n \n bool deQueue() {\n \n }\n \n int Front() {\n \n }\n \n int Rear() {\n \n }\n \n ... | ["MyCircularQueue","enQueue","enQueue","enQueue","enQueue","Rear","isFull","deQueue","enQueue","Rear"]
[[3],[1],[2],[3],[4],[],[],[],[4],[]] | {
"classname": "MyCircularQueue",
"constructor": {
"params": [
{
"type": "integer",
"name": "k"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "value"
}
],
"name": "enQueue",
"return": {
"... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Linked List', 'Design', 'Queue'] |
623 | Add One Row to Tree | add-one-row-to-tree | <p>Given the <code>root</code> of a binary tree and two integers <code>val</code> and <code>depth</code>, add a row of nodes with value <code>val</code> at the given depth <code>depth</code>.</p>
<p>Note that the <code>root</code> node is at depth <code>1</code>.</p>
<p>The adding rule is:</p>
<ul>
<li>Given the in... | Medium | 287.6K | 449.2K | 287,636 | 449,212 | 64.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [4,2,6,3,1,5]
1
2 | {
"name": "addOneRow",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"name": "val",
"type": "integer"
},
{
"name": "depth",
"type": "integer"
}
],
"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... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
624 | Maximum Distance in Arrays | maximum-distance-in-arrays | <p>You are given <code>m</code> <code>arrays</code>, where each array is sorted in <strong>ascending order</strong>.</p>
<p>You can pick up two integers from two different arrays (each array picks one) and calculate the distance. We define the distance between two integers <code>a</code> and <code>b</code> to be their... | Medium | 187.4K | 411K | 187,446 | 411,045 | 45.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxDistance(vector<vector<int>>& arrays) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxDistance(List<List<Integer>> arrays) {\n \n }\n}"}, {"value": "python", "... | [[1,2,3],[4,5],[1,2,3]] | {
"name": "maxDistance",
"params": [
{
"name": "arrays",
"type": "list<list<integer>>"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy'] |
625 | Minimum Factorization | minimum-factorization | null | Medium | 11.8K | 34.9K | 11,784 | 34,905 | 33.8% | [] | [] | Algorithms | null | 48 | {
"name": "smallestFactorization",
"params": [
{
"name": "num",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Greedy'] |
626 | Exchange Seats | exchange-seats | <p>Table: <code>Seat</code></p>
<pre>
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| id | int |
| student | varchar |
+-------------+---------+
id is the primary key (unique value) column for this table.
Each row of this table indicates the name and the ID of a student... | Medium | 326.8K | 452K | 326,795 | 452,001 | 72.3% | [] | ['Create table If Not Exists Seat (id int, student varchar(255))', 'Truncate table Seat', "insert into Seat (id, student) values ('1', 'Abbot')", "insert into Seat (id, student) values ('2', 'Doris')", "insert into Seat (id, student) values ('3', 'Emerson')", "insert into Seat (id, student) values ('4', 'Green')", "ins... | 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": {"Seat": ["id","student"]}, "rows": {"Seat": [[1,"Abbot"],[2,"Doris"],[3,"Emerson"],[4,"Green"],[5,"Jeames"]]}} | {"mysql": ["Create table If Not Exists Seat (id int, student varchar(255))"], "mssql": ["Create table Seat (id int, student varchar(255))"], "oraclesql": ["Create table Seat (id int, student varchar(255))"], "database": true, "name": "exchange_seats", "pythondata": ["Seat = pd.DataFrame([], columns=['id', 'student']).a... | {"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'] |
627 | Swap Salary | swap-salary | <p>Table: <code>Salary</code></p>
<pre>
+-------------+----------+
| Column Name | Type |
+-------------+----------+
| id | int |
| name | varchar |
| sex | ENUM |
| salary | int |
+-------------+----------+
id is the primary key (column with unique values) for this tabl... | Easy | 460.3K | 548.7K | 460,310 | 548,714 | 83.9% | [] | ['Create table If Not Exists Salary (id int, name varchar(100), sex char(1), salary int)', 'Truncate table Salary', "insert into Salary (id, name, sex, salary) values ('1', 'A', 'm', '2500')", "insert into Salary (id, name, sex, salary) values ('2', 'B', 'f', '1500')", "insert into Salary (id, name, sex, salary) values... | Database | [{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v... | {"headers":{"Salary":["id","name","sex","salary"]},"rows":{"Salary":[[1,"A","m",2500],[2,"B","f",1500],[3,"C","m",5500],[4,"D","f",500]]}} | {"mysql": ["Create table If Not Exists Salary (id int, name varchar(100), sex char(1), salary int)"], "mssql": ["Create table Salary (id int, name varchar(100), sex char(1), salary int)"], "oraclesql": ["Create table Salary (id int, name varchar(100), sex char(1), salary int)"], "database": true, "manual": true, "name"... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
628 | Maximum Product of Three Numbers | maximum-product-of-three-numbers | <p>Given an integer array <code>nums</code>, <em>find three numbers whose product is maximum and return the maximum product</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre><strong>Input:</strong> nums = [1,2,3]
<strong>Output:</strong> 6
</pre><p><strong class="example">Example 2:</stro... | Easy | 399.1K | 881.9K | 399,081 | 881,897 | 45.3% | ['maximum-product-subarray'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumProduct(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumProduct(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [1,2,3] | {
"name": "maximumProduct",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Sorting'] |
629 | K Inverse Pairs Array | k-inverse-pairs-array | <p>For an integer array <code>nums</code>, an <strong>inverse pair</strong> is a pair of integers <code>[i, j]</code> where <code>0 <= i < j < nums.length</code> and <code>nums[i] > nums[j]</code>.</p>
<p>Given two integers n and k, return the number of different arrays consisting of numbers from <code>1</... | Hard | 134.6K | 274.2K | 134,642 | 274,243 | 49.1% | ['count-the-number-of-inversions'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int kInversePairs(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int kInversePairs(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "default... | 3
0 | {
"name": "kInversePairs",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming'] |
630 | Course Schedule III | course-schedule-iii | <p>There are <code>n</code> different online courses numbered from <code>1</code> to <code>n</code>. You are given an array <code>courses</code> where <code>courses[i] = [duration<sub>i</sub>, lastDay<sub>i</sub>]</code> indicate that the <code>i<sup>th</sup></code> course should be taken <b>continuously</b> for <code>... | Hard | 122K | 301.3K | 122,046 | 301,341 | 40.5% | ['course-schedule', 'course-schedule-ii', 'parallel-courses-iii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int scheduleCourse(vector<vector<int>>& courses) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int scheduleCourse(int[][] courses) {\n \n }\n}"}, {"value": "python", "text... | [[100,200],[200,1300],[1000,1250],[2000,3200]] | {
"name": "scheduleCourse",
"params": [
{
"name": "courses",
"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', 'Heap (Priority Queue)'] |
631 | Design Excel Sum Formula | design-excel-sum-formula | null | Hard | 24K | 55.1K | 24,030 | 55,081 | 43.6% | [] | [] | Algorithms | null | ["Excel","set","sum","set","get"]
[[3,"C"],[1,"A",2],[3,"C",["A1","A1:B2"]],[2,"B",2],[3,"C"]] | {
"classname": "Excel",
"maxbytesperline": 200000,
"constructor": {
"params": [
{
"type": "integer",
"name": "height"
},
{
"type": "character",
"name": "width"
}
]
},
"methods": [
{
"name": "set",
"params": [
{
"... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'String', 'Graph', 'Design', 'Topological Sort', 'Matrix'] |
632 | Smallest Range Covering Elements from K Lists | smallest-range-covering-elements-from-k-lists | <p>You have <code>k</code> lists of sorted integers in <strong>non-decreasing order</strong>. Find the <b>smallest</b> range that includes at least one number from each of the <code>k</code> lists.</p>
<p>We define the range <code>[a, b]</code> is smaller than range <code>[c, d]</code> if <code>b - a < d - c</... | Hard | 212.9K | 305.3K | 212,888 | 305,333 | 69.7% | ['minimum-window-substring'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> smallestRange(vector<vector<int>>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] smallestRange(List<List<Integer>> nums) {\n \n }\n}"}, {"value": "... | [[4,10,15,24,26],[0,9,12,20],[5,18,22,30]] | {
"name": "smallestRange",
"params": [
{
"name": "nums",
"type": "list<list<integer>>"
}
],
"return": {
"type": "integer[]"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Greedy', 'Sliding Window', 'Sorting', 'Heap (Priority Queue)'] |
633 | Sum of Square Numbers | sum-of-square-numbers | <p>Given a non-negative integer <code>c</code>, decide whether there're two integers <code>a</code> and <code>b</code> such that <code>a<sup>2</sup> + b<sup>2</sup> = c</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> c = 5
<strong>Output:</strong> true
<s... | Medium | 385.5K | 1.1M | 385,451 | 1,058,658 | 36.4% | ['valid-perfect-square', 'sum-of-squares-of-special-elements'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool judgeSquareSum(int c) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean judgeSquareSum(int c) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ... | 5 | {
"name": "judgeSquareSum",
"params": [
{
"name": "c",
"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', 'Two Pointers', 'Binary Search'] |
634 | Find the Derangement of An Array | find-the-derangement-of-an-array | null | Medium | 11.8K | 28.4K | 11,826 | 28,369 | 41.7% | [] | [] | Algorithms | null | 3 | {
"name": "findDerangement",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Dynamic Programming', 'Combinatorics'] |
635 | Design Log Storage System | design-log-storage-system | null | Medium | 37.1K | 62.6K | 37,055 | 62,567 | 59.2% | ['design-in-memory-file-system'] | [] | Algorithms | null | ["LogSystem","put","put","put","retrieve","retrieve"]
[[],[1,"2017:01:01:23:59:59"],[2,"2017:01:01:22:59:59"],[3,"2016:01:01:00:00:00"],["2016:01:01:01:01:01","2017:01:01:23:00:00","Year"],["2016:01:01:01:01:01","2017:01:01:23:00:00","Hour"]] | {
"classname": "LogSystem",
"maxbytesperline": 200000,
"constructor": {
"params": []
},
"methods": [
{
"name": "put",
"params": [
{
"type": "integer",
"name": "id"
},
{
"type": "string",
"name": "timestamp"
}
],
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Ordered Set'] |
636 | Exclusive Time of Functions | exclusive-time-of-functions | <p>On a <strong>single-threaded</strong> CPU, we execute a program containing <code>n</code> functions. Each function has a unique ID between <code>0</code> and <code>n-1</code>.</p>
<p>Function calls are <strong>stored in a <a href="https://en.wikipedia.org/wiki/Call_stack">call stack</a></strong>: when a function ca... | Medium | 269.6K | 419K | 269,611 | 419,026 | 64.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> exclusiveTime(int n, vector<string>& logs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] exclusiveTime(int n, List<String> logs) {\n \n }\n}"}, {"value":... | 2
["0:start:0","1:start:2","1:end:5","0:end:6"] | {
"name": "exclusiveTime",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "logs",
"type": "list<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', 'Stack'] |
637 | Average of Levels in Binary Tree | average-of-levels-in-binary-tree | Given the <code>root</code> of a binary tree, return <em>the average value of the nodes on each level in the form of an array</em>. Answers within <code>10<sup>-5</sup></code> of the actual answer will be accepted.
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode... | Easy | 631.5K | 854.7K | 631,518 | 854,671 | 73.9% | ['binary-tree-level-order-traversal', 'binary-tree-level-order-traversal-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... | [3,9,20,null,null,15,7] | {
"name": "averageOfLevels",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "list<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', 'Breadth-First Search', 'Binary Tree'] |
638 | Shopping Offers | shopping-offers | <p>In LeetCode Store, there are <code>n</code> items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or more different kinds of items with a sale price.</p>
<p>You are given an integer array <code>price</code> where <code>price[i]</code> is the price of the <... | Medium | 69K | 133.1K | 68,964 | 133,077 | 51.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int shoppingOffers(vector<int>& price, vector<vector<int>>& special, vector<int>& needs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int shoppingOffers(List<Integer> price, List<L... | [2,5]
[[3,0,5],[1,2,10]]
[3,2] | {
"name": "shoppingOffers",
"params": [
{
"name": "price",
"type": "list<integer>"
},
{
"name": "special",
"type": "list<list<integer>>"
},
{
"name": "needs",
"type": "list<integer>"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Memoization', 'Bitmask'] |
639 | Decode Ways II | decode-ways-ii | <p>A message containing letters from <code>A-Z</code> can be <strong>encoded</strong> into numbers using the following mapping:</p>
<pre>
'A' -> "1"
'B' -> "2"
...
'Z' -> "26"
</pre>
<p>To <strong>decode</strong> an encoded message, all the digits must be... | Hard | 81.1K | 260.7K | 81,076 | 260,729 | 31.1% | ['decode-ways', 'number-of-ways-to-separate-numbers', 'number-of-ways-to-divide-a-long-corridor'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numDecodings(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numDecodings(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cl... | "*" | {
"name": "numDecodings",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
640 | Solve the Equation | solve-the-equation | <p>Solve a given equation and return the value of <code>'x'</code> in the form of a string <code>"x=#value"</code>. The equation contains only <code>'+'</code>, <code>'-'</code> operation, the variable <code>'x'</code> and its coefficient. You should return <code>"No solut... | Medium | 44.1K | 99.3K | 44,122 | 99,268 | 44.4% | ['fraction-addition-and-subtraction', 'minimize-result-by-adding-parentheses-to-expression'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string solveEquation(string equation) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String solveEquation(String equation) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | "x+5-3+x=6+x-2" | {
"name": "solveEquation",
"params": [
{
"name": "equation",
"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... | ['Math', 'String', 'Simulation'] |
641 | Design Circular Deque | design-circular-deque | <p>Design your implementation of the circular double-ended queue (deque).</p>
<p>Implement the <code>MyCircularDeque</code> class:</p>
<ul>
<li><code>MyCircularDeque(int k)</code> Initializes the deque with a maximum size of <code>k</code>.</li>
<li><code>boolean insertFront()</code> Adds an item at the front of De... | Medium | 173.4K | 268.6K | 173,362 | 268,579 | 64.5% | ['design-circular-queue', 'design-front-middle-back-queue'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class MyCircularDeque {\npublic:\n MyCircularDeque(int k) {\n \n }\n \n bool insertFront(int value) {\n \n }\n \n bool insertLast(int value) {\n \n }\n \n bool deleteFront() {\n \n }\n \n bool deleteLast(... | ["MyCircularDeque","insertLast","insertLast","insertFront","insertFront","getRear","isFull","deleteLast","insertFront","getFront"]
[[3],[1],[2],[3],[4],[],[],[],[4],[]] | {
"classname": "MyCircularDeque",
"constructor": {
"params": [
{
"type": "integer",
"name": "k"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "value"
}
],
"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', 'Linked List', 'Design', 'Queue'] |
642 | Design Search Autocomplete System | design-search-autocomplete-system | null | Hard | 153.4K | 311.1K | 153,413 | 311,145 | 49.3% | ['implement-trie-prefix-tree'] | [] | Algorithms | null | ["AutocompleteSystem","input","input","input","input"]
[[["i love you","island","iroman","i love leetcode"],[5,3,2,2]],["i"],[" "],["a"],["#"]] | {
"classname": "AutocompleteSystem",
"maxbytesperline": 200000,
"constructor": {
"params": [
{
"type": "string[]",
"name": "sentences"
},
{
"type": "integer[]",
"name": "times"
},
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Depth-First Search', 'Design', 'Trie', 'Sorting', 'Heap (Priority Queue)', 'Data Stream'] |
643 | Maximum Average Subarray I | maximum-average-subarray-i | <p>You are given an integer array <code>nums</code> consisting of <code>n</code> elements, and an integer <code>k</code>.</p>
<p>Find a contiguous subarray whose <strong>length is equal to</strong> <code>k</code> that has the maximum average value and return <em>this value</em>. Any answer with a calculation error les... | Easy | 780K | 1.7M | 780,020 | 1,735,729 | 44.9% | ['maximum-average-subarray-ii', 'k-radius-subarray-averages'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double findMaxAverage(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double findMaxAverage(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "... | [1,12,-5,-6,50,3]
4 | {
"name": "findMaxAverage",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "double"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Sliding Window'] |
644 | Maximum Average Subarray II | maximum-average-subarray-ii | null | Hard | 21.9K | 58.5K | 21,867 | 58,527 | 37.4% | ['maximum-average-subarray-i'] | [] | Algorithms | null | [1,12,-5,-6,50,3]
4 | {
"name": "findMaxAverage",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "double"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Prefix Sum'] |
645 | Set Mismatch | set-mismatch | <p>You have a set of integers <code>s</code>, which originally contains all the numbers from <code>1</code> to <code>n</code>. Unfortunately, due to some error, one of the numbers in <code>s</code> got duplicated to another number in the set, which results in <strong>repetition of one</strong> number and <strong>loss o... | Easy | 519.5K | 1.2M | 519,522 | 1,158,253 | 44.9% | ['find-the-duplicate-number'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findErrorNums(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findErrorNums(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [1,2,2,4] | {
"name": "findErrorNums",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Bit Manipulation', 'Sorting'] |
646 | Maximum Length of Pair Chain | maximum-length-of-pair-chain | <p>You are given an array of <code>n</code> pairs <code>pairs</code> where <code>pairs[i] = [left<sub>i</sub>, right<sub>i</sub>]</code> and <code>left<sub>i</sub> < right<sub>i</sub></code>.</p>
<p>A pair <code>p2 = [c, d]</code> <strong>follows</strong> a pair <code>p1 = [a, b]</code> if <code>b < c</code>. A ... | Medium | 271.7K | 447.8K | 271,681 | 447,750 | 60.7% | ['longest-increasing-subsequence', 'non-decreasing-subsequences', 'longest-non-decreasing-subarray-from-two-arrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findLongestChain(vector<vector<int>>& pairs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findLongestChain(int[][] pairs) {\n \n }\n}"}, {"value": "python", "text... | [[1,2],[2,3],[3,4]] | {
"name": "findLongestChain",
"params": [
{
"name": "pairs",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Greedy', 'Sorting'] |
647 | Palindromic Substrings | palindromic-substrings | <p>Given a string <code>s</code>, return <em>the number of <strong>palindromic substrings</strong> in it</em>.</p>
<p>A string is a <strong>palindrome</strong> when it reads the same backward as forward.</p>
<p>A <strong>substring</strong> is a contiguous sequence of characters within the string.</p>
<p> </p>
<... | Medium | 972.5K | 1.4M | 972,468 | 1,361,791 | 71.4% | ['longest-palindromic-substring', 'longest-palindromic-subsequence'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSubstrings(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSubstrings(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode... | "abc" | {
"name": "countSubstrings",
"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... | ['Two Pointers', 'String', 'Dynamic Programming'] |
648 | Replace Words | replace-words | <p>In English, we have a concept called <strong>root</strong>, which can be followed by some other word to form another longer word - let's call this word <strong>derivative</strong>. For example, when the <strong>root</strong> <code>"help"</code> is followed by the word <code>"ful"</code>, we c... | Medium | 294.2K | 430.9K | 294,226 | 430,889 | 68.3% | ['implement-trie-prefix-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string replaceWords(vector<string>& dictionary, string sentence) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String replaceWords(List<String> dictionary, String sentence) {\n ... | ["cat","bat","rat"]
"the cattle was rattled by the battery" | {
"name": "replaceWords",
"params": [
{
"name": "dictionary",
"type": "list<string>"
},
{
"name": "sentence",
"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... | ['Array', 'Hash Table', 'String', 'Trie'] |
649 | Dota2 Senate | dota2-senate | <p>In the world of Dota2, there are two parties: the Radiant and the Dire.</p>
<p>The Dota2 senate consists of senators coming from two parties. Now the Senate wants to decide on a change in the Dota2 game. The voting for this change is a round-based procedure. In each round, each senator can exercise <strong>one</str... | Medium | 220.4K | 453.2K | 220,428 | 453,154 | 48.6% | ['teemo-attacking'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string predictPartyVictory(string senate) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String predictPartyVictory(String senate) {\n \n }\n}"}, {"value": "python", "text"... | "RD" | {
"name": "predictPartyVictory",
"params": [
{
"name": "senate",
"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', 'Greedy', 'Queue'] |
650 | 2 Keys Keyboard | 2-keys-keyboard | <p>There is only one character <code>'A'</code> on the screen of a notepad. You can perform one of two operations on this notepad for each step:</p>
<ul>
<li>Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).</li>
<li>Paste: You can paste the characters which are... | Medium | 273.1K | 458.8K | 273,072 | 458,809 | 59.5% | ['4-keys-keyboard', 'broken-calculator', 'smallest-value-after-replacing-with-sum-of-prime-factors', 'distinct-prime-factors-of-product-of-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minSteps(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minSteps(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Solution(o... | 3 | {
"name": "minSteps",
"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'] |
651 | 4 Keys Keyboard | 4-keys-keyboard | null | Medium | 32K | 57.3K | 32,007 | 57,302 | 55.9% | ['2-keys-keyboard'] | [] | Algorithms | null | 3 | {
"name": "maxA",
"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'] |
652 | Find Duplicate Subtrees | find-duplicate-subtrees | <p>Given the <code>root</code> of a binary tree, return all <strong>duplicate subtrees</strong>.</p>
<p>For each kind of duplicate subtrees, you only need to return the root node of any <b>one</b> of them.</p>
<p>Two trees are <strong>duplicate</strong> if they have the <strong>same structure</strong> with the <... | Medium | 288.5K | 481.1K | 288,487 | 481,063 | 60.0% | ['serialize-and-deserialize-binary-tree', 'serialize-and-deserialize-bst', 'construct-string-from-binary-tree', 'delete-duplicate-folders-in-system'] | [] | 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,null,2,4,null,null,4] | {
"name": "findDuplicateSubtrees",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "list<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', 'Binary Tree'] |
653 | Two Sum IV - Input is a BST | two-sum-iv-input-is-a-bst | <p>Given the <code>root</code> of a binary search tree and an integer <code>k</code>, return <code>true</code> <em>if there exist two elements in the BST such that their sum is equal to</em> <code>k</code>, <em>or</em> <code>false</code> <em>otherwise</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</stro... | Easy | 636K | 1M | 635,950 | 1,025,561 | 62.0% | ['two-sum', 'two-sum-ii-input-array-is-sorted', 'two-sum-iii-data-structure-design', 'two-sum-bsts'] | [] | 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... | [5,3,6,2,4,null,7]
9 | {
"name": "findTarget",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"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... | ['Hash Table', 'Two Pointers', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Search Tree', 'Binary Tree'] |
654 | Maximum Binary Tree | maximum-binary-tree | <p>You are given an integer array <code>nums</code> with no duplicates. A <strong>maximum binary tree</strong> can be built recursively from <code>nums</code> using the following algorithm:</p>
<ol>
<li>Create a root node whose value is the maximum value in <code>nums</code>.</li>
<li>Recursively build the left subt... | Medium | 325.2K | 378.9K | 325,225 | 378,932 | 85.8% | ['maximum-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... | [3,2,1,6,0,5] | {
"name": "constructMaximumBinaryTree",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "TreeNode",
"dealloc": 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', 'Divide and Conquer', 'Stack', 'Tree', 'Monotonic Stack', 'Binary Tree'] |
655 | Print Binary Tree | print-binary-tree | <p>Given the <code>root</code> of a binary tree, construct a <strong>0-indexed</strong> <code>m x n</code> string matrix <code>res</code> that represents a <strong>formatted layout</strong> of the tree. The formatted layout matrix should be constructed using the following rules:</p>
<ul>
<li>The <strong>height</stron... | Medium | 77.9K | 119.1K | 77,856 | 119,142 | 65.3% | [] | [] | 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] | {
"name": "printTree",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "list<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... | ['Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
656 | Coin Path | coin-path | null | Hard | 14.8K | 45.7K | 14,788 | 45,691 | 32.4% | ['house-robber', 'house-robber-ii'] | [] | Algorithms | null | [1,2,4,-1,2]
2 | {
"name": "cheapestJump",
"params": [
{
"name": "coins",
"type": "integer[]"
},
{
"name": "maxJump",
"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', 'Dynamic Programming'] |
657 | Robot Return to Origin | robot-return-to-origin | <p>There is a robot starting at the position <code>(0, 0)</code>, the origin, on a 2D plane. Given a sequence of its moves, judge if this robot <strong>ends up at </strong><code>(0, 0)</code> after it completes its moves.</p>
<p>You are given a string <code>moves</code> that represents the move sequence of the robot w... | Easy | 481.5K | 632.9K | 481,543 | 632,928 | 76.1% | ['number-of-provinces', 'execution-of-all-suffix-instructions-staying-in-a-grid', 'furthest-point-from-origin'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool judgeCircle(string moves) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean judgeCircle(String moves) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | "UD" | {
"name": "judgeCircle",
"params": [
{
"name": "moves",
"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', 'Simulation'] |
658 | Find K Closest Elements | find-k-closest-elements | <p>Given a <strong>sorted</strong> integer array <code>arr</code>, two integers <code>k</code> and <code>x</code>, return the <code>k</code> closest integers to <code>x</code> in the array. The result should also be sorted in ascending order.</p>
<p>An integer <code>a</code> is closer to <code>x</code> than an integer... | Medium | 674.6K | 1.4M | 674,555 | 1,392,059 | 48.5% | ['guess-number-higher-or-lower', 'guess-number-higher-or-lower-ii', 'find-k-th-smallest-pair-distance', 'find-closest-number-to-zero'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findClosestElements(vector<int>& arr, int k, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> findClosestElements(int[] arr, int k, int x) {\n \... | [1,2,3,4,5]
4
3 | {
"name": "findClosestElements",
"params": [
{
"name": "arr",
"type": "integer[]"
},
{
"name": "k",
"type": "integer"
},
{
"name": "x",
"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', 'Two Pointers', 'Binary Search', 'Sliding Window', 'Sorting', 'Heap (Priority Queue)'] |
659 | Split Array into Consecutive Subsequences | split-array-into-consecutive-subsequences | <p>You are given an integer array <code>nums</code> that is <strong>sorted in non-decreasing order</strong>.</p>
<p>Determine if it is possible to split <code>nums</code> into <strong>one or more subsequences</strong> such that <strong>both</strong> of the following conditions are true:</p>
<ul>
<li>Each subsequence... | Medium | 137.9K | 268.1K | 137,874 | 268,121 | 51.4% | ['top-k-frequent-elements', 'divide-array-in-sets-of-k-consecutive-numbers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isPossible(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isPossible(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defau... | [1,2,3,3,4,5] | {
"name": "isPossible",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "boolean"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Greedy', 'Heap (Priority Queue)'] |
660 | Remove 9 | remove-9 | null | Hard | 11.1K | 19.3K | 11,051 | 19,268 | 57.4% | [] | [] | Algorithms | null | 9 | {
"name": "newInteger",
"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'] |
661 | Image Smoother | image-smoother | <p>An <strong>image smoother</strong> is a filter of the size <code>3 x 3</code> that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not pres... | Easy | 182.5K | 267.7K | 182,509 | 267,737 | 68.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> imageSmoother(vector<vector<int>>& img) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] imageSmoother(int[][] img) {\n \n }\n}"}, {"value": "pyth... | [[1,1,1],[1,0,1],[1,1,1]] | {
"name": "imageSmoother",
"params": [
{
"name": "img",
"type": "integer[][]"
}
],
"return": {
"type": "integer[][]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Matrix'] |
662 | Maximum Width of Binary Tree | maximum-width-of-binary-tree | <p>Given the <code>root</code> of a binary tree, return <em>the <strong>maximum width</strong> of the given tree</em>.</p>
<p>The <strong>maximum width</strong> of a tree is the maximum <strong>width</strong> among all levels.</p>
<p>The <strong>width</strong> of one level is defined as the length between the end-nod... | Medium | 465.5K | 1.1M | 465,489 | 1,061,018 | 43.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [1,3,2,5,3,null,9] | {
"name": "widthOfBinaryTree",
"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'] |
663 | Equal Tree Partition | equal-tree-partition | null | Medium | 32.4K | 78.1K | 32,419 | 78,066 | 41.5% | ['create-components-with-same-value'] | [] | Algorithms | null | [5,10,10,null,null,2,3] | {
"name": "checkEqualTree",
"params": [
{
"name": "root",
"type": "TreeNode"
}
],
"return": {
"type": "boolean"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search', 'Binary Tree'] |
664 | Strange Printer | strange-printer | <p>There is a strange printer with the following two special properties:</p>
<ul>
<li>The printer can only print a sequence of <strong>the same character</strong> each time.</li>
<li>At each turn, the printer can print new characters starting from and ending at any place and will cover the original existing characte... | Hard | 151.8K | 249.7K | 151,798 | 249,748 | 60.8% | ['remove-boxes', 'strange-printer-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int strangePrinter(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int strangePrinter(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":... | "aaabbb" | {
"name": "strangePrinter",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
665 | Non-decreasing Array | non-decreasing-array | <p>Given an array <code>nums</code> with <code>n</code> integers, your task is to check if it could become non-decreasing by modifying <strong>at most one element</strong>.</p>
<p>We define an array is non-decreasing if <code>nums[i] <= nums[i + 1]</code> holds for every <code>i</code> (<strong>0-based</strong>) su... | Medium | 278.9K | 1.1M | 278,932 | 1,115,397 | 25.0% | ['make-array-non-decreasing-or-non-increasing', 'find-good-days-to-rob-the-bank', 'count-non-decreasing-subarrays-after-k-operations'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkPossibility(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkPossibility(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Pyt... | [4,2,3] | {
"name": "checkPossibility",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "boolean"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array'] |
666 | Path Sum IV | path-sum-iv | null | Medium | 40K | 64K | 40,048 | 63,957 | 62.6% | ['path-sum', 'path-sum-ii', 'binary-tree-maximum-path-sum', 'path-sum-iii'] | [] | Algorithms | null | [113,215,221] | {
"name": "pathSum",
"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', 'Tree', 'Depth-First Search', 'Binary Tree'] |
667 | Beautiful Arrangement II | beautiful-arrangement-ii | <p>Given two integers <code>n</code> and <code>k</code>, construct a list <code>answer</code> that contains <code>n</code> different positive integers ranging from <code>1</code> to <code>n</code> and obeys the following requirement:</p>
<ul>
<li>Suppose this list is <code>answer = [a<sub>1</sub>, a<sub>2</sub>,... | Medium | 57K | 94.4K | 56,961 | 94,407 | 60.3% | ['beautiful-arrangement'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> constructArray(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] constructArray(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | 3
1 | {
"name": "constructArray",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "integer[]"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math'] |
668 | Kth Smallest Number in Multiplication Table | kth-smallest-number-in-multiplication-table | <p>Nearly everyone has used the <a href="https://en.wikipedia.org/wiki/Multiplication_table" target="_blank">Multiplication Table</a>. The multiplication table of size <code>m x n</code> is an integer matrix <code>mat</code> where <code>mat[i][j] == i * j</code> (<strong>1-indexed</strong>).</p>
<p>Given three integer... | Hard | 73.1K | 139K | 73,149 | 139,032 | 52.6% | ['kth-smallest-element-in-a-sorted-matrix', 'find-k-th-smallest-pair-distance', 'k-th-smallest-prime-fraction', 'minimum-time-to-eat-all-grains', 'kth-smallest-amount-with-single-denomination-combination'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findKthNumber(int m, int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findKthNumber(int m, int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Pyt... | 3
3
5 | {
"name": "findKthNumber",
"params": [
{
"name": "m",
"type": "integer"
},
{
"name": "n",
"type": "integer"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Binary Search'] |
669 | Trim a Binary Search Tree | trim-a-binary-search-tree | <p>Given the <code>root</code> of a binary search tree and the lowest and highest boundaries as <code>low</code> and <code>high</code>, trim the tree so that all its elements lies in <code>[low, high]</code>. Trimming the tree should <strong>not</strong> change the relative structure of the elements that will remain in... | Medium | 317.7K | 478.9K | 317,736 | 478,932 | 66.3% | [] | [] | 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,0,2]
1
2 | {
"name": "trimBST",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"name": "low",
"type": "integer"
},
{
"name": "high",
"type": "integer"
}
],
"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... | ['Tree', 'Depth-First Search', 'Binary Search Tree', 'Binary Tree'] |
670 | Maximum Swap | maximum-swap | <p>You are given an integer <code>num</code>. You can swap two digits at most once to get the maximum valued number.</p>
<p>Return <em>the maximum valued number you can get</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> num = 2736
<strong>Output:</strong> 723... | Medium | 454.1K | 877.5K | 454,081 | 877,542 | 51.7% | ['create-maximum-number'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumSwap(int num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumSwap(int num) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class ... | 2736 | {
"name": "maximumSwap",
"params": [
{
"name": "num",
"type": "integer"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Greedy'] |
671 | Second Minimum Node In a Binary Tree | second-minimum-node-in-a-binary-tree | <p>Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly <code>two</code> or <code>zero</code> sub-node. If the node has two sub-nodes, then this node's value is the smaller value among its two sub-nodes. More formally, the property <cod... | Easy | 216.4K | 478.9K | 216,398 | 478,894 | 45.2% | ['kth-smallest-element-in-a-bst'] | [] | 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... | [2,2,5,null,null,5,7] | {
"name": "findSecondMinimumValue",
"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', 'Binary Tree'] |
672 | Bulb Switcher II | bulb-switcher-ii | <p>There is a room with <code>n</code> bulbs labeled from <code>1</code> to <code>n</code> that all are turned on initially, and <strong>four buttons</strong> on the wall. Each of the four buttons has a different functionality where:</p>
<ul>
<li><strong>Button 1:</strong> Flips the status of all the bulbs.</li>
<li... | Medium | 26.2K | 53K | 26,192 | 52,965 | 49.5% | ['bulb-switcher', 'number-of-times-binary-string-is-prefix-aligned'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int flipLights(int n, int presses) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int flipLights(int n, int presses) {\n \n }\n}"}, {"value": "python", "text": "Python", "d... | 1
1 | {
"name": "flipLights",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "presses",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Bit Manipulation', 'Depth-First Search', 'Breadth-First Search'] |
673 | Number of Longest Increasing Subsequence | number-of-longest-increasing-subsequence | <p>Given an integer array <code>nums</code>, return <em>the number of longest increasing subsequences.</em></p>
<p><strong>Notice</strong> that the sequence has to be <strong>strictly</strong> increasing.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [... | Medium | 274.3K | 554.1K | 274,310 | 554,091 | 49.5% | ['longest-increasing-subsequence', 'longest-continuous-increasing-subsequence', 'longest-increasing-subsequence-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findNumberOfLIS(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findNumberOfLIS(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | [1,3,5,4,7] | {
"name": "findNumberOfLIS",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Binary Indexed Tree', 'Segment Tree'] |
674 | Longest Continuous Increasing Subsequence | longest-continuous-increasing-subsequence | <p>Given an unsorted array of integers <code>nums</code>, return <em>the length of the longest <strong>continuous increasing subsequence</strong> (i.e. subarray)</em>. The subsequence must be <strong>strictly</strong> increasing.</p>
<p>A <strong>continuous increasing subsequence</strong> is defined by two indices <co... | Easy | 302.4K | 593.3K | 302,407 | 593,273 | 51.0% | ['number-of-longest-increasing-subsequence', 'minimum-window-subsequence', 'consecutive-characters', 'longest-increasing-subsequence-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findLengthOfLCIS(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findLengthOfLCIS(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [1,3,5,4,7] | {
"name": "findLengthOfLCIS",
"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'] |
675 | Cut Off Trees for Golf Event | cut-off-trees-for-golf-event | <p>You are asked to cut off all the trees in a forest for a golf event. The forest is represented as an <code>m x n</code> matrix. In this matrix:</p>
<ul>
<li><code>0</code> means the cell cannot be walked through.</li>
<li><code>1</code> represents an empty cell that can be walked through.</li>
<li>A number great... | Hard | 76.3K | 216.9K | 76,255 | 216,928 | 35.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int cutOffTree(vector<vector<int>>& forest) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int cutOffTree(List<List<Integer>> forest) {\n \n }\n}"}, {"value": "python", "te... | [[1,2,3],[0,0,4],[7,6,5]] | {
"name": "cutOffTree",
"params": [
{
"name": "forest",
"type": "list<list<integer>>"
}
],
"return": {
"type": "integer"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Breadth-First Search', 'Heap (Priority Queue)', 'Matrix'] |
676 | Implement Magic Dictionary | implement-magic-dictionary | <p>Design a data structure that is initialized with a list of <strong>different</strong> words. Provided a string, you should determine if you can change exactly one character in this string to match any word in the data structure.</p>
<p>Implement the <code>MagicDictionary</code> class:</p>
<ul>
<li><code... | Medium | 92.2K | 158.9K | 92,243 | 158,937 | 58.0% | ['implement-trie-prefix-tree', 'longest-word-in-dictionary'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class MagicDictionary {\npublic:\n MagicDictionary() {\n \n }\n \n void buildDict(vector<string> dictionary) {\n \n }\n \n bool search(string searchWord) {\n \n }\n};\n\n/**\n * Your MagicDictionary object will be instantiated... | ["MagicDictionary", "buildDict", "search", "search", "search", "search"]
[[], [["hello","leetcode"]], ["hello"], ["hhllo"], ["hell"], ["leetcoded"]] | {
"classname": "MagicDictionary",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "string[]",
"name": "dictionary"
}
],
"return": {
"type": "void"
},
"name": "buildDict"
},
{
"params": [
... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Depth-First Search', 'Design', 'Trie'] |
677 | Map Sum Pairs | map-sum-pairs | <p>Design a map that allows you to do the following:</p>
<ul>
<li>Maps a string key to a given value.</li>
<li>Returns the sum of the values that have a key with a prefix equal to a given string.</li>
</ul>
<p>Implement the <code>MapSum</code> class:</p>
<ul>
<li><code>MapSum()</code> Initializes the <code>MapSum... | Medium | 128.5K | 225.6K | 128,474 | 225,600 | 56.9% | ['sort-the-jumbled-numbers', 'sum-of-prefix-scores-of-strings'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class MapSum {\npublic:\n MapSum() {\n \n }\n \n void insert(string key, int val) {\n \n }\n \n int sum(string prefix) {\n \n }\n};\n\n/**\n * Your MapSum object will be instantiated and called as such:\n * MapSum* obj = new M... | ["MapSum","insert","sum","insert","sum"]
[[],["apple",3],["ap"],["app",2],["ap"]] | {
"classname": "MapSum",
"constructor": {
"params": []
},
"methods": [
{
"params": [
{
"type": "string",
"name": "key"
},
{
"type": "integer",
"name": "val"
}
],
"return": {
"type": "void"
},
"n... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Design', 'Trie'] |
678 | Valid Parenthesis String | valid-parenthesis-string | <p>Given a string <code>s</code> containing only three types of characters: <code>'('</code>, <code>')'</code> and <code>'*'</code>, return <code>true</code> <em>if</em> <code>s</code> <em>is <strong>valid</strong></em>.</p>
<p>The following rules define a <strong>valid</strong> string:</p>
<u... | Medium | 458.5K | 1.2M | 458,491 | 1,184,865 | 38.7% | ['special-binary-string', 'check-if-a-parentheses-string-can-be-valid'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkValidString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkValidString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa... | "()" | {
"name": "checkValidString",
"params": [
{
"name": "s",
"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', 'Dynamic Programming', 'Stack', 'Greedy'] |
679 | 24 Game | 24-game | <p>You are given an integer array <code>cards</code> of length <code>4</code>. You have four cards, each containing a number in the range <code>[1, 9]</code>. You should arrange the numbers on these cards in a mathematical expression using the operators <code>['+', '-', '*', '/']</code> ... | Hard | 86.3K | 173.1K | 86,263 | 173,077 | 49.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool judgePoint24(vector<int>& cards) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean judgePoint24(int[] cards) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | [4,1,8,7] | {
"name": "judgePoint24",
"params": [
{
"name": "cards",
"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', 'Math', 'Backtracking'] |
680 | Valid Palindrome II | valid-palindrome-ii | <p>Given a string <code>s</code>, return <code>true</code> <em>if the </em><code>s</code><em> can be palindrome after deleting <strong>at most one</strong> character from it</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> s = "aba"
<strong>Output:</st... | Easy | 937.4K | 2.2M | 937,433 | 2,195,563 | 42.7% | ['valid-palindrome', 'valid-palindrome-iii', 'valid-palindrome-iv'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool validPalindrome(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean validPalindrome(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | "aba" | {
"name": "validPalindrome",
"params": [
{
"name": "s",
"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... | ['Two Pointers', 'String', 'Greedy'] |
681 | Next Closest Time | next-closest-time | null | Medium | 114K | 243.2K | 114,013 | 243,175 | 46.9% | [] | [] | Algorithms | null | "19:34" | {
"name": "nextClosestTime",
"params": [
{
"name": "time",
"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', 'Backtracking', 'Enumeration'] |
682 | Baseball Game | baseball-game | <p>You are keeping the scores for a baseball game with strange rules. At the beginning of the game, you start with an empty record.</p>
<p>You are given a list of strings <code>operations</code>, where <code>operations[i]</code> is the <code>i<sup>th</sup></code> operation you must apply to the record and is one of th... | Easy | 454.4K | 579.2K | 454,418 | 579,240 | 78.5% | ['crawler-log-folder'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int calPoints(vector<string>& operations) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int calPoints(String[] operations) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | ["5","2","C","D","+"] | {
"name": "calPoints",
"params": [
{
"name": "operations",
"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', 'Stack', 'Simulation'] |
683 | K Empty Slots | k-empty-slots | null | Hard | 63.2K | 169.6K | 63,171 | 169,628 | 37.2% | [] | [] | Algorithms | null | [1,3,2]
1 | {
"name": "kEmptySlots",
"params": [
{
"name": "bulbs",
"type": "integer[]"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Indexed Tree', 'Segment Tree', 'Queue', 'Sliding Window', 'Heap (Priority Queue)', 'Ordered Set', 'Monotonic Queue'] |
684 | Redundant Connection | redundant-connection | <p>In this problem, a tree is an <strong>undirected graph</strong> that is connected and has no cycles.</p>
<p>You are given a graph that started as a tree with <code>n</code> nodes labeled from <code>1</code> to <code>n</code>, with one additional edge added. The added edge has two <strong>different</strong> vertices... | Medium | 532.3K | 804.5K | 532,316 | 804,550 | 66.2% | ['redundant-connection-ii', 'accounts-merge', 'maximum-employees-to-be-invited-to-a-meeting', 'shortest-cycle-in-a-graph'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findRedundantConnection(vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findRedundantConnection(int[][] edges) {\n \n }\n}"}, {... | [[1,2],[1,3],[2,3]] | {
"name": "findRedundantConnection",
"params": [
{
"name": "edges",
"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... | ['Depth-First Search', 'Breadth-First Search', 'Union Find', 'Graph'] |
685 | Redundant Connection II | redundant-connection-ii | <p>In this problem, a rooted tree is a <b>directed</b> graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly one parent, except for the root node which has no parents.</p>
<p>The given input is a directed graph that started as a rooted... | Hard | 79.2K | 226.9K | 79,243 | 226,935 | 34.9% | ['redundant-connection'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findRedundantDirectedConnection(vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findRedundantDirectedConnection(int[][] edges) {\n ... | [[1,2],[1,3],[2,3]] | {
"name": "findRedundantDirectedConnection",
"params": [
{
"name": "edges",
"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... | ['Depth-First Search', 'Breadth-First Search', 'Union Find', 'Graph'] |
686 | Repeated String Match | repeated-string-match | <p>Given two strings <code>a</code> and <code>b</code>, return <em>the minimum number of times you should repeat string </em><code>a</code><em> so that string</em> <code>b</code> <em>is a substring of it</em>. If it is impossible for <code>b</code> to be a substring of <code>a</code> after repeating it, return <c... | Medium | 200.8K | 551.4K | 200,847 | 551,371 | 36.4% | ['repeated-substring-pattern'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int repeatedStringMatch(string a, string b) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int repeatedStringMatch(String a, String b) {\n \n }\n}"}, {"value": "python", "t... | "abcd"
"cdabcdab" | {
"name": "repeatedStringMatch",
"params": [
{
"name": "a",
"type": "string"
},
{
"name": "b",
"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', 'String Matching'] |
687 | Longest Univalue Path | longest-univalue-path | <p>Given the <code>root</code> of a binary tree, return <em>the length of the longest path, where each node in the path has the same value</em>. This path may or may not pass through the root.</p>
<p><strong>The length of the path</strong> between two nodes is represented by the number of edges between them.</p>
<p>&... | Medium | 200.3K | 472.6K | 200,339 | 472,563 | 42.4% | ['binary-tree-maximum-path-sum', 'count-univalue-subtrees', 'path-sum-iii', 'longest-path-with-different-adjacent-characters'] | [] | 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... | [5,4,5,1,1,null,5] | {
"name": "longestUnivaluePath",
"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', 'Binary Tree'] |
688 | Knight Probability in Chessboard | knight-probability-in-chessboard | <p>On an <code>n x n</code> chessboard, a knight starts at the cell <code>(row, column)</code> and attempts to make exactly <code>k</code> moves. The rows and columns are <strong>0-indexed</strong>, so the top-left cell is <code>(0, 0)</code>, and the bottom-right cell is <code>(n - 1, n - 1)</code>.</p>
<p>A chess kn... | Medium | 169.8K | 300.5K | 169,808 | 300,495 | 56.5% | ['out-of-boundary-paths', 'maximum-number-of-moves-to-kill-all-pawns'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double knightProbability(int n, int k, int row, int column) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double knightProbability(int n, int k, int row, int column) {\n \n ... | 3
2
0
0 | {
"name": "knightProbability",
"params": [
{
"name": "n",
"type": "integer"
},
{
"name": "k",
"type": "integer"
},
{
"name": "row",
"type": "integer"
},
{
"name": "column",
"type": "integer"
}
],
"return": {
"type": "double"
}... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming'] |
689 | Maximum Sum of 3 Non-Overlapping Subarrays | maximum-sum-of-3-non-overlapping-subarrays | <p>Given an integer array <code>nums</code> and an integer <code>k</code>, find three non-overlapping subarrays of length <code>k</code> with maximum sum and return them.</p>
<p>Return the result as a list of indices representing the starting position of each interval (<strong>0-indexed</strong>). If there are multipl... | Hard | 147.2K | 247.7K | 147,242 | 247,718 | 59.4% | ['best-time-to-buy-and-sell-stock-iii', 'sum-of-variable-length-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> maxSumOfThreeSubarrays(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] maxSumOfThreeSubarrays(int[] nums, int k) {\n \n }\n}"}, {... | [1,2,1,2,6,7,5,1]
2 | {
"name": "maxSumOfThreeSubarrays",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "integer[]"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Sliding Window', 'Prefix Sum'] |
690 | Employee Importance | employee-importance | <p>You have a data structure of employee information, including the employee's unique ID, importance value, and direct subordinates' IDs.</p>
<p>You are given an array of employees <code>employees</code> where:</p>
<ul>
<li><code>employees[i].id</code> is the ID of the <code>i<sup>th</sup></code> employee.</... | Medium | 230.8K | 338.7K | 230,835 | 338,677 | 68.2% | ['nested-list-weight-sum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/*\n// Definition for Employee.\nclass Employee {\npublic:\n int id;\n int importance;\n vector<int> subordinates;\n};\n*/\n\nclass Solution {\npublic:\n int getImportance(vector<Employee*> employees, int id) {\n \n }\n};"}, {"value": "java", "text"... | [[1,5,[2,3]],[2,3,[]],[3,3,[]]]
1 | {
"name": "getImportance",
"params": [
{
"name": "employees",
"type": "list<string>"
},
{
"name": "id",
"type": "integer"
}
],
"return": {
"type": "integer"
},
"languages": [
"cpp",
"java",
"python",
"ruby",
"python3",
"kotlin",
"scala"... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>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', 'Breadth-First Search'] |
691 | Stickers to Spell Word | stickers-to-spell-word | <p>We are given <code>n</code> different types of <code>stickers</code>. Each sticker has a lowercase English word on it.</p>
<p>You would like to spell out the given string <code>target</code> by cutting individual letters from your collection of stickers and rearranging them. You can use each sticker more than once ... | Hard | 88K | 176.3K | 88,010 | 176,332 | 49.9% | ['ransom-note'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minStickers(vector<string>& stickers, string target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minStickers(String[] stickers, String target) {\n \n }\n}"}, {"v... | ["with","example","science"]
"thehat" | {
"name": "minStickers",
"params": [
{
"name": "stickers",
"type": "string[]"
},
{
"name": "target",
"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', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Memoization', 'Bitmask'] |
692 | Top K Frequent Words | top-k-frequent-words | <p>Given an array of strings <code>words</code> and an integer <code>k</code>, return <em>the </em><code>k</code><em> most frequent strings</em>.</p>
<p>Return the answer <strong>sorted</strong> by <strong>the frequency</strong> from highest to lowest. Sort the words with the same frequency by their <strong>lexicograp... | Medium | 689.4K | 1.2M | 689,434 | 1,167,638 | 59.0% | ['top-k-frequent-elements', 'k-closest-points-to-origin', 'sort-features-by-popularity', 'sender-with-largest-word-count', 'maximum-number-of-pairs-in-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> topKFrequent(vector<string>& words, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> topKFrequent(String[] words, int k) {\n \n }\n}"}, {"v... | ["i","love","leetcode","i","love","coding"]
2 | {
"name": "topKFrequent",
"params": [
{
"name": "words",
"type": "string[]"
},
{
"name": "k",
"type": "integer"
}
],
"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', 'Trie', 'Sorting', 'Heap (Priority Queue)', 'Bucket Sort', 'Counting'] |
693 | Binary Number with Alternating Bits | binary-number-with-alternating-bits | <p>Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> n = 5
<strong>Output:</strong> true
<strong>Explanation:</strong> The binary representa... | Easy | 152K | 240K | 152,028 | 239,956 | 63.4% | ['number-of-1-bits'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool hasAlternatingBits(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean hasAlternatingBits(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | 5 | {
"name": "hasAlternatingBits",
"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... | ['Bit Manipulation'] |
694 | Number of Distinct Islands | number-of-distinct-islands | null | Medium | 186.9K | 301.2K | 186,886 | 301,221 | 62.0% | ['number-of-islands', 'number-of-distinct-islands-ii', 'count-sub-islands'] | [] | Algorithms | null | [[1,1,0,0,0],[1,1,0,0,0],[0,0,0,1,1],[0,0,0,1,1]] | {
"name": "numDistinctIslands",
"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... | ['Hash Table', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Hash Function'] |
695 | Max Area of Island | max-area-of-island | <p>You are given an <code>m x n</code> binary matrix <code>grid</code>. An island is a group of <code>1</code>'s (representing land) connected <strong>4-directionally</strong> (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water.</p>
<p>The <strong>area</strong> of an island ... | Medium | 1M | 1.4M | 1,035,673 | 1,418,995 | 73.0% | ['number-of-islands', 'battleships-in-a-board', 'island-perimeter', 'largest-submatrix-with-rearrangements', 'detonate-the-maximum-bombs', 'maximum-number-of-fish-in-a-grid'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxAreaOfIsland(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxAreaOfIsland(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "... | [[0,0,1,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,1,1,0,1,0,0,0,0,0,0,0,0],[0,1,0,0,1,1,0,0,1,0,1,0,0],[0,1,0,0,1,1,0,0,1,1,1,0,0],[0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,0,0,0,0,0,0,1,1,0,0,0,0]] | {
"name": "maxAreaOfIsland",
"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', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix'] |
696 | Count Binary Substrings | count-binary-substrings | <p>Given a binary string <code>s</code>, return the number of non-empty substrings that have the same number of <code>0</code>'s and <code>1</code>'s, and all the <code>0</code>'s and all the <code>1</code>'s in these substrings are grouped consecutively.</p>
<p>Substrings that occur multiple times are... | Easy | 227.9K | 346.3K | 227,861 | 346,322 | 65.8% | ['encode-and-decode-strings', 'number-of-substrings-with-fixed-ratio', 'count-the-number-of-substrings-with-dominant-ones'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countBinarySubstrings(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countBinarySubstrings(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", ... | "00110011" | {
"name": "countBinarySubstrings",
"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... | ['Two Pointers', 'String'] |
697 | Degree of an Array | degree-of-an-array | <p>Given a non-empty array of non-negative integers <code>nums</code>, the <b>degree</b> of this array is defined as the maximum frequency of any one of its elements.</p>
<p>Your task is to find the smallest possible length of a (contiguous) subarray of <code>nums</code>, that has the same degree as <code>nums</code>.... | Easy | 241.4K | 422.1K | 241,417 | 422,115 | 57.2% | ['maximum-subarray'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findShortestSubArray(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findShortestSubArray(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "... | [1,2,2,3,1] | {
"name": "findShortestSubArray",
"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'] |
698 | Partition to K Equal Sum Subsets | partition-to-k-equal-sum-subsets | <p>Given an integer array <code>nums</code> and an integer <code>k</code>, return <code>true</code> if it is possible to divide this array into <code>k</code> non-empty subsets whose sums are all equal.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [4,3,2,3,... | Medium | 301K | 790.4K | 300,987 | 790,388 | 38.1% | ['partition-equal-subset-sum', 'fair-distribution-of-cookies', 'maximum-number-of-ways-to-partition-an-array', 'maximum-rows-covered-by-columns'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canPartitionKSubsets(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canPartitionKSubsets(int[] nums, int k) {\n \n }\n}"}, {"value": ... | [4,3,2,3,5,2,1]
4 | {
"name": "canPartitionKSubsets",
"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', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Memoization', 'Bitmask'] |
699 | Falling Squares | falling-squares | <p>There are several squares being dropped onto the X-axis of a 2D plane.</p>
<p>You are given a 2D integer array <code>positions</code> where <code>positions[i] = [left<sub>i</sub>, sideLength<sub>i</sub>]</code> represents the <code>i<sup>th</sup></code> square with a side length of <code>sideLength<sub>i</sub></cod... | Hard | 30.9K | 67K | 30,854 | 67,021 | 46.0% | ['the-skyline-problem'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> fallingSquares(vector<vector<int>>& positions) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> fallingSquares(int[][] positions) {\n \n }\n}"}, {"v... | [[1,2],[2,3],[6,1]] | {
"name": "fallingSquares",
"params": [
{
"name": "positions",
"type": "integer[][]",
"dealloc": false
}
],
"return": {
"type": "list<integer>",
"dealloc": 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', 'Segment Tree', 'Ordered Set'] |
700 | Search in a Binary Search Tree | search-in-a-binary-search-tree | <p>You are given the <code>root</code> of a binary search tree (BST) and an integer <code>val</code>.</p>
<p>Find the node in the BST that the node's value equals <code>val</code> and return the subtree rooted with that node. If such a node does not exist, return <code>null</code>.</p>
<p> </p>
<p><strong cl... | Easy | 1.1M | 1.4M | 1,117,186 | 1,371,860 | 81.4% | ['closest-binary-search-tree-value', 'insert-into-a-binary-search-tree', 'closest-nodes-queries-in-a-binary-search-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for a binary tree node.\n * struct TreeNode {\n * int val;\n * TreeNode *left;\n * TreeNode *right;\n * TreeNode() : val(0), left(nullptr), right(nullptr) {}\n * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n * Tre... | [4,2,7,1,3]
2 | {
"name": "searchBST",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"name": "val",
"type": "integer"
}
],
"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... | ['Tree', 'Binary Search Tree', 'Binary Tree'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.