questionFrontendId int64 1 3.51k | questionTitle stringlengths 3 79 | TitleSlug stringlengths 3 79 | content stringlengths 431 25.4k ⌀ | difficulty stringclasses 3
values | totalAccepted stringlengths 2 6 | totalSubmission stringlengths 2 6 | totalAcceptedRaw int64 124 16.8M | totalSubmissionRaw int64 285 30.3M | acRate stringlengths 4 5 | similarQuestions stringlengths 2 714 | mysqlSchemas stringclasses 295
values | category stringclasses 6
values | codeDefinition stringlengths 122 24.9k ⌀ | sampleTestCase stringlengths 1 4.33k | metaData stringlengths 37 3.13k | envInfo stringclasses 26
values | topicTags stringlengths 2 153 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,702 | Maximum Binary String After Change | maximum-binary-string-after-change | <p>You are given a binary string <code>binary</code> consisting of only <code>0</code>'s or <code>1</code>'s. You can apply each of the following operations any number of times:</p>
<ul>
<li>Operation 1: If the number contains the substring <code>"00"</code>, you can replace it with <code>"10&q... | Medium | 15K | 32.1K | 15,040 | 32,119 | 46.8% | ['longest-binary-subsequence-less-than-or-equal-to-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string maximumBinaryString(string binary) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String maximumBinaryString(String binary) {\n \n }\n}"}, {"value": "python", "text"... | "000110" | {
"name": "maximumBinaryString",
"params": [
{
"name": "binary",
"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'] |
1,703 | Minimum Adjacent Swaps for K Consecutive Ones | minimum-adjacent-swaps-for-k-consecutive-ones | <p>You are given an integer array, <code>nums</code>, and an integer <code>k</code>. <code>nums</code> comprises of only <code>0</code>'s and <code>1</code>'s. In one move, you can choose two <strong>adjacent</strong> indices and swap their values.</p>
<p>Return <em>the <strong>minimum</strong> number of moves... | Hard | 12.4K | 29.5K | 12,409 | 29,504 | 42.1% | ['minimum-swaps-to-group-all-1s-together', 'minimum-number-of-operations-to-make-array-continuous', 'minimum-adjacent-swaps-to-make-a-valid-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minMoves(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minMoves(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | [1,0,0,1,0,1]
2 | {
"name": "minMoves",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Sliding Window', 'Prefix Sum'] |
1,704 | Determine if String Halves Are Alike | determine-if-string-halves-are-alike | <p>You are given a string <code>s</code> of even length. Split this string into two halves of equal lengths, and let <code>a</code> be the first half and <code>b</code> be the second half.</p>
<p>Two strings are <strong>alike</strong> if they have the same number of vowels (<code>'a'</code>, <code>'e'<... | Easy | 377.5K | 480.1K | 377,479 | 480,062 | 78.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool halvesAreAlike(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean halvesAreAlike(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | "book" | {
"name": "halvesAreAlike",
"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', 'Counting'] |
1,705 | Maximum Number of Eaten Apples | maximum-number-of-eaten-apples | <p>There is a special kind of apple tree that grows apples every day for <code>n</code> days. On the <code>i<sup>th</sup></code> day, the tree grows <code>apples[i]</code> apples that will rot after <code>days[i]</code> days, that is on day <code>i + days[i]</code> the apples will be rotten and cannot be eaten. On some... | Medium | 26.3K | 65.3K | 26,302 | 65,313 | 40.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int eatenApples(vector<int>& apples, vector<int>& days) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int eatenApples(int[] apples, int[] days) {\n \n }\n}"}, {"value": "p... | [1,2,3,5,2]
[3,2,1,4,2] | {
"name": "eatenApples",
"params": [
{
"name": "apples",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "days"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Heap (Priority Queue)'] |
1,706 | Where Will the Ball Fall | where-will-the-ball-fall | <p>You have a 2-D <code>grid</code> of size <code>m x n</code> representing a box, and you have <code>n</code> balls. The box is open on the top and bottom sides.</p>
<p>Each cell in the box has a diagonal board spanning two corners of the cell that can redirect a ball to the right or to the left.</p>
<ul>
<li>A boa... | Medium | 144.7K | 201.1K | 144,717 | 201,074 | 72.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findBall(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findBall(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Pyth... | [[1,1,1,-1,-1],[1,1,1,-1,-1],[-1,-1,-1,1,1],[1,1,1,1,-1],[-1,-1,-1,-1,-1]] | {
"name": "findBall",
"params": [
{
"type": "integer[][]",
"name": "grid"
}
],
"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', 'Simulation'] |
1,707 | Maximum XOR With an Element From Array | maximum-xor-with-an-element-from-array | <p>You are given an array <code>nums</code> consisting of non-negative integers. You are also given a <code>queries</code> array, where <code>queries[i] = [x<sub>i</sub>, m<sub>i</sub>]</code>.</p>
<p>The answer to the <code>i<sup>th</sup></code> query is the maximum bitwise <code>XOR</code> value of <code>x<sub>i</su... | Hard | 32.9K | 60.8K | 32,936 | 60,833 | 54.1% | ['maximum-xor-of-two-numbers-in-an-array', 'maximum-genetic-difference-query', 'minimize-xor', 'maximum-strong-pair-xor-i', 'maximum-strong-pair-xor-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> maximizeXor(vector<int>& nums, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] maximizeXor(int[] nums, int[][] queries) {\n \n ... | [0,1,2,3,4]
[[3,1],[1,3],[5,6]] | {
"name": "maximizeXor",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer[][]",
"name": "queries"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Bit Manipulation', 'Trie'] |
1,708 | Largest Subarray Length K | largest-subarray-length-k | null | Easy | 9.7K | 14.9K | 9,692 | 14,877 | 65.1% | [] | [] | Algorithms | null | [1,4,5,2,3]
3 | {
"name": "largestSubarray",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy'] |
1,709 | Biggest Window Between Visits | biggest-window-between-visits | null | Medium | 28.5K | 40.6K | 28,535 | 40,577 | 70.3% | ['users-with-two-purchases-within-seven-days'] | ['Create table If Not Exists UserVisits(user_id int, visit_date date)', 'Truncate table UserVisits', "insert into UserVisits (user_id, visit_date) values ('1', '2020-11-28')", "insert into UserVisits (user_id, visit_date) values ('1', '2020-10-20')", "insert into UserVisits (user_id, visit_date) values ('1', '2020-12-3... | Database | null | {"headers":{"UserVisits":["user_id","visit_date"]},"rows":{"UserVisits":[["1","2020-11-28"],["1","2020-10-20"],["1","2020-12-3"],["2","2020-10-5"],["2","2020-12-9"],["3","2020-11-11"]]}} | {"mysql": ["Create table If Not Exists UserVisits(user_id int, visit_date date)"], "mssql": ["Create table UserVisits(user_id int, visit_date date)"], "oraclesql": ["Create table UserVisits(user_id int, visit_date date)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD'"], "database": true, "name": "biggest_window", "py... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,710 | Maximum Units on a Truck | maximum-units-on-a-truck | <p>You are assigned to put some amount of boxes onto <strong>one truck</strong>. You are given a 2D array <code>boxTypes</code>, where <code>boxTypes[i] = [numberOfBoxes<sub>i</sub>, numberOfUnitsPerBox<sub>i</sub>]</code>:</p>
<ul>
<li><code>numberOfBoxes<sub>i</sub></code> is the number of boxes of type <code>i</co... | Easy | 343.1K | 462.8K | 343,100 | 462,847 | 74.1% | ['maximum-bags-with-full-capacity-of-rocks'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumUnits(vector<vector<int>>& boxTypes, int truckSize) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumUnits(int[][] boxTypes, int truckSize) {\n \n }\n}"... | [[1,3],[2,2],[3,1]]
4 | {
"name": "maximumUnits",
"params": [
{
"name": "boxTypes",
"type": "integer[][]"
},
{
"type": "integer",
"name": "truckSize"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Sorting'] |
1,711 | Count Good Meals | count-good-meals | <p>A <strong>good meal</strong> is a meal that contains <strong>exactly two different food items</strong> with a sum of deliciousness equal to a power of two.</p>
<p>You can pick <strong>any</strong> two different foods to make a good meal.</p>
<p>Given an array of integers <code>deliciousness</code> where <code>deli... | Medium | 45.9K | 146.4K | 45,924 | 146,389 | 31.4% | ['two-sum', 'max-number-of-k-sum-pairs', 'find-all-possible-recipes-from-given-supplies'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countPairs(vector<int>& deliciousness) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countPairs(int[] deliciousness) {\n \n }\n}"}, {"value": "python", "text": "Py... | [1,3,5,7,9] | {
"name": "countPairs",
"params": [
{
"name": "deliciousness",
"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'] |
1,712 | Ways to Split Array Into Three Subarrays | ways-to-split-array-into-three-subarrays | <p>A split of an integer array is <strong>good</strong> if:</p>
<ul>
<li>The array is split into three <strong>non-empty</strong> contiguous subarrays - named <code>left</code>, <code>mid</code>, <code>right</code> respectively from left to right.</li>
<li>The sum of the elements in <code>left</code> is less than or... | Medium | 36.6K | 109.8K | 36,565 | 109,754 | 33.3% | ['number-of-ways-to-divide-a-long-corridor', 'number-of-ways-to-split-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int waysToSplit(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int waysToSplit(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | [1,1,1] | {
"name": "waysToSplit",
"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', 'Prefix Sum'] |
1,713 | Minimum Operations to Make a Subsequence | minimum-operations-to-make-a-subsequence | <p>You are given an array <code>target</code> that consists of <strong>distinct</strong> integers and another integer array <code>arr</code> that <strong>can</strong> have duplicates.</p>
<p>In one operation, you can insert any integer at any position in <code>arr</code>. For example, if <code>arr = [1,4,1,2]</code>, ... | Hard | 14.1K | 29.2K | 14,143 | 29,225 | 48.4% | ['append-characters-to-string-to-make-subsequence'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& target, vector<int>& arr) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(int[] target, int[] arr) {\n \n }\n}"}, {"value": ... | [5,1,3]
[9,4,2,3,4] | {
"name": "minOperations",
"params": [
{
"name": "target",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "arr"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Binary Search', 'Greedy'] |
1,714 | Sum Of Special Evenly-Spaced Elements In Array | sum-of-special-evenly-spaced-elements-in-array | null | Hard | 1.6K | 3.2K | 1,567 | 3,192 | 49.1% | [] | [] | Algorithms | null | [0,1,2,3,4,5,6,7]
[[0,3],[5,1],[4,2]] | {
"name": "solve",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer[][]",
"name": "queries"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming'] |
1,715 | Count Apples and Oranges | count-apples-and-oranges | null | Medium | 17.4K | 22.9K | 17,376 | 22,898 | 75.9% | [] | ['Create table If Not Exists Boxes (box_id int, chest_id int, apple_count int, orange_count int)', 'Create table If Not Exists Chests (chest_id int, apple_count int, orange_count int)', 'Truncate table Boxes', "insert into Boxes (box_id, chest_id, apple_count, orange_count) values ('2', NULL, '6', '15')", "insert into ... | Database | null | {"headers":{"Boxes":["box_id","chest_id","apple_count","orange_count"],"Chests":["chest_id","apple_count","orange_count"]},"rows":{"Boxes":[[2,null,6,15],[18,14,4,15],[19,3,8,4],[12,2,19,20],[20,6,12,9],[8,6,9,9],[3,14,16,7]],"Chests":[[6,5,6],[14,20,10],[2,8,8],[3,19,4],[16,19,19]]}} | {"mysql": ["Create table If Not Exists Boxes (box_id int, chest_id int, apple_count int, orange_count int)", "Create table If Not Exists Chests (chest_id int, apple_count int, orange_count int)"], "mssql": ["Create table Boxes (box_id int, chest_id int, apple_count int, orange_count int)", "Create table Chests (chest_i... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,716 | Calculate Money in Leetcode Bank | calculate-money-in-leetcode-bank | <p>Hercy wants to save money for his first car. He puts money in the Leetcode bank <strong>every day</strong>.</p>
<p>He starts by putting in <code>$1</code> on Monday, the first day. Every day from Tuesday to Sunday, he will put in <code>$1</code> more than the day before. On every subsequent Monday, he will put... | Easy | 171.6K | 218.9K | 171,622 | 218,852 | 78.4% | ['distribute-money-to-maximum-children'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int totalMoney(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int totalMoney(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class Soluti... | 4 | {
"name": "totalMoney",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math'] |
1,717 | Maximum Score From Removing Substrings | maximum-score-from-removing-substrings | <p>You are given a string <code>s</code> and two integers <code>x</code> and <code>y</code>. You can perform two types of operations any number of times.</p>
<ul>
<li>Remove substring <code>"ab"</code> and gain <code>x</code> points.
<ul>
<li>For example, when removing <code>"ab"</code> from <... | Medium | 139.9K | 222.8K | 139,923 | 222,760 | 62.8% | ['count-words-obtained-after-adding-a-letter'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumGain(string s, int x, int y) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumGain(String s, int x, int y) {\n \n }\n}"}, {"value": "python", "text": "P... | "cdbcbbaaabab"
4
5 | {
"name": "maximumGain",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "integer",
"name": "x"
},
{
"type": "integer",
"name": "y"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Stack', 'Greedy'] |
1,718 | Construct the Lexicographically Largest Valid Sequence | construct-the-lexicographically-largest-valid-sequence | <p>Given an integer <code>n</code>, find a sequence with elements in the range <code>[1, n]</code> that satisfies all of the following:</p>
<ul>
<li>The integer <code>1</code> occurs once in the sequence.</li>
<li>Each integer between <code>2</code> and <code>n</code> occurs twice in the sequence.</li>
<li>For ever... | Medium | 107.5K | 146.9K | 107,516 | 146,854 | 73.2% | ['the-number-of-beautiful-subsets', 'find-the-lexicographically-largest-string-from-the-box-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> constructDistancedSequence(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] constructDistancedSequence(int n) {\n \n }\n}"}, {"value": "python", "tex... | 3 | {
"name": "constructDistancedSequence",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Backtracking'] |
1,719 | Number Of Ways To Reconstruct A Tree | number-of-ways-to-reconstruct-a-tree | <p>You are given an array <code>pairs</code>, where <code>pairs[i] = [x<sub>i</sub>, y<sub>i</sub>]</code>, and:</p>
<ul>
<li>There are no duplicates.</li>
<li><code>x<sub>i</sub> < y<sub>i</sub></code></li>
</ul>
<p>Let <code>ways</code> be the number of rooted trees that satisfy the following conditions:</p>
... | Hard | 5.4K | 12.3K | 5,412 | 12,288 | 44.0% | ['create-binary-tree-from-descriptions', 'maximum-star-sum-of-a-graph'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int checkWays(vector<vector<int>>& pairs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int checkWays(int[][] pairs) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | [[1,2],[2,3]] | {
"name": "checkWays",
"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... | ['Tree', 'Graph'] |
1,720 | Decode XORed Array | decode-xored-array | <p>There is a <strong>hidden</strong> integer array <code>arr</code> that consists of <code>n</code> non-negative integers.</p>
<p>It was encoded into another integer array <code>encoded</code> of length <code>n - 1</code>, such that <code>encoded[i] = arr[i] XOR arr[i + 1]</code>. For example, if <code>arr = [1,0,2,1... | Easy | 171.6K | 197.6K | 171,580 | 197,551 | 86.9% | ['find-the-original-array-of-prefix-xor'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> decode(vector<int>& encoded, int first) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] decode(int[] encoded, int first) {\n \n }\n}"}, {"value": "python",... | [1,2,3]
1 | {
"name": "decode",
"params": [
{
"name": "encoded",
"type": "integer[]"
},
{
"type": "integer",
"name": "first"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Bit Manipulation'] |
1,721 | Swapping Nodes in a Linked List | swapping-nodes-in-a-linked-list | <p>You are given the <code>head</code> of a linked list, and an integer <code>k</code>.</p>
<p>Return <em>the head of the linked list after <strong>swapping</strong> the values of the </em><code>k<sup>th</sup></code> <em>node from the beginning and the </em><code>k<sup>th</sup></code> <em>node from the end (the list i... | Medium | 391.7K | 573.3K | 391,725 | 573,292 | 68.3% | ['remove-nth-node-from-end-of-list', 'swap-nodes-in-pairs', 'reverse-nodes-in-k-group'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,2,3,4,5]
2 | {
"name": "swapNodes",
"params": [
{
"name": "head",
"type": "ListNode"
},
{
"name": "k",
"type": "integer"
}
],
"return": {
"type": "ListNode"
}
}
| {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Two Pointers'] |
1,722 | Minimize Hamming Distance After Swap Operations | minimize-hamming-distance-after-swap-operations | <p>You are given two integer arrays, <code>source</code> and <code>target</code>, both of length <code>n</code>. You are also given an array <code>allowedSwaps</code> where each <code>allowedSwaps[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates that you are allowed to swap the elements at index <code>a<sub>i</sub>... | Medium | 20.2K | 42.1K | 20,177 | 42,087 | 47.9% | ['smallest-string-with-swaps', 'make-lexicographically-smallest-array-by-swapping-elements'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumHammingDistance(vector<int>& source, vector<int>& target, vector<vector<int>>& allowedSwaps) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumHammingDistance(int[... | [1,2,3,4]
[2,1,4,5]
[[0,1],[2,3]] | {
"name": "minimumHammingDistance",
"params": [
{
"name": "source",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "target"
},
{
"type": "integer[][]",
"name": "allowedSwaps"
}
],
"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', 'Union Find'] |
1,723 | Find Minimum Time to Finish All Jobs | find-minimum-time-to-finish-all-jobs | <p>You are given an integer array <code>jobs</code>, where <code>jobs[i]</code> is the amount of time it takes to complete the <code>i<sup>th</sup></code> job.</p>
<p>There are <code>k</code> workers that you can assign jobs to. Each job should be assigned to <strong>exactly</strong> one worker. The <strong>working ti... | Hard | 32.5K | 75.4K | 32,456 | 75,365 | 43.1% | ['minimum-number-of-work-sessions-to-finish-the-tasks', 'find-minimum-time-to-finish-all-jobs-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumTimeRequired(vector<int>& jobs, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumTimeRequired(int[] jobs, int k) {\n \n }\n}"}, {"value": "python... | [3,2,3]
3 | {
"name": "minimumTimeRequired",
"params": [
{
"name": "jobs",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Bitmask'] |
1,724 | Checking Existence of Edge Length Limited Paths II | checking-existence-of-edge-length-limited-paths-ii | null | Hard | 3.5K | 6.8K | 3,508 | 6,832 | 51.3% | ['checking-existence-of-edge-length-limited-paths', 'number-of-good-paths', 'minimum-score-of-a-path-between-two-cities'] | [] | Algorithms | null | ["DistanceLimitedPathsExist","query","query","query","query"]
[[6,[[0,2,4],[0,3,2],[1,2,3],[2,3,1],[4,5,5]]],[2,3,2],[1,3,3],[2,0,3],[0,5,6]] | {
"classname": "DistanceLimitedPathsExist",
"constructor": {
"params": [
{
"type": "integer",
"name": "n"
},
{
"name": "edgeList",
"type": "integer[][]"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"n... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Union Find', 'Graph', 'Minimum Spanning Tree'] |
1,725 | Number Of Rectangles That Can Form The Largest Square | number-of-rectangles-that-can-form-the-largest-square | <p>You are given an array <code>rectangles</code> where <code>rectangles[i] = [l<sub>i</sub>, w<sub>i</sub>]</code> represents the <code>i<sup>th</sup></code> rectangle of length <code>l<sub>i</sub></code> and width <code>w<sub>i</sub></code>.</p>
<p>You can cut the <code>i<sup>th</sup></code> rectangle to form a squa... | Easy | 79.5K | 100.7K | 79,470 | 100,678 | 78.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countGoodRectangles(vector<vector<int>>& rectangles) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countGoodRectangles(int[][] rectangles) {\n \n }\n}"}, {"value":... | [[5,8],[3,9],[5,12],[16,5]] | {
"name": "countGoodRectangles",
"params": [
{
"name": "rectangles",
"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'] |
1,726 | Tuple with Same Product | tuple-with-same-product | <p>Given an array <code>nums</code> of <strong>distinct</strong> positive integers, return <em>the number of tuples </em><code>(a, b, c, d)</code><em> such that </em><code>a * b = c * d</code><em> where </em><code>a</code><em>, </em><code>b</code><em>, </em><code>c</code><em>, and </em><code>d</code><em> are elements o... | Medium | 189.9K | 270.5K | 189,878 | 270,457 | 70.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int tupleSameProduct(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int tupleSameProduct(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [2,3,4,6] | {
"name": "tupleSameProduct",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Counting'] |
1,727 | Largest Submatrix With Rearrangements | largest-submatrix-with-rearrangements | <p>You are given a binary matrix <code>matrix</code> of size <code>m x n</code>, and you are allowed to rearrange the <strong>columns</strong> of the <code>matrix</code> in any order.</p>
<p>Return <em>the area of the largest submatrix within </em><code>matrix</code><em> where <strong>every</strong> element of the sub... | Medium | 75.9K | 101K | 75,942 | 101,036 | 75.2% | ['max-area-of-island'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largestSubmatrix(vector<vector<int>>& matrix) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largestSubmatrix(int[][] matrix) {\n \n }\n}"}, {"value": "python", "te... | [[0,0,1],[1,1,1],[1,0,1]] | {
"name": "largestSubmatrix",
"params": [
{
"name": "matrix",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Sorting', 'Matrix'] |
1,728 | Cat and Mouse II | cat-and-mouse-ii | <p>A game is played by a cat and a mouse named Cat and Mouse.</p>
<p>The environment is represented by a <code>grid</code> of size <code>rows x cols</code>, where each element is a wall, floor, player (Cat, Mouse), or food.</p>
<ul>
<li>Players are represented by the characters <code>'C'</code>(Cat)<code>,&#... | Hard | 8.1K | 20.6K | 8,144 | 20,635 | 39.5% | ['escape-the-ghosts', 'cat-and-mouse'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canMouseWin(vector<string>& grid, int catJump, int mouseJump) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canMouseWin(String[] grid, int catJump, int mouseJump) {\n ... | ["####F","#C...","M...."]
1
2 | {
"name": "canMouseWin",
"params": [
{
"name": "grid",
"type": "string[]"
},
{
"type": "integer",
"name": "catJump"
},
{
"type": "integer",
"name": "mouseJump"
}
],
"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', 'Dynamic Programming', 'Graph', 'Topological Sort', 'Memoization', 'Matrix', 'Game Theory'] |
1,729 | Find Followers Count | find-followers-count | <p>Table: <code>Followers</code></p>
<pre>
+-------------+------+
| Column Name | Type |
+-------------+------+
| user_id | int |
| follower_id | int |
+-------------+------+
(user_id, follower_id) is the primary key (combination of columns with unique values) for this table.
This table contains the IDs of a use... | Easy | 328.2K | 472.2K | 328,173 | 472,195 | 69.5% | [] | ['Create table If Not Exists Followers(user_id int, follower_id int)', 'Truncate table Followers', "insert into Followers (user_id, follower_id) values ('0', '1')", "insert into Followers (user_id, follower_id) values ('1', '0')", "insert into Followers (user_id, follower_id) values ('2', '0')", "insert into Followers ... | 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":{"Followers":["user_id","follower_id"]},"rows":{"Followers":[["0","1"],["1","0"],["2","0"],["2","1"]]}} | {"mysql": ["Create table If Not Exists Followers(user_id int, follower_id int)"], "mssql": ["Create table Followers(user_id int, follower_id int)"], "oraclesql": ["Create table Followers(user_id int, follower_id int)"], "database": true, "name": "count_followers", "pythondata": ["Followers = pd.DataFrame([], columns=['... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,730 | Shortest Path to Get Food | shortest-path-to-get-food | null | Medium | 77.6K | 137.3K | 77,646 | 137,345 | 56.5% | ['01-matrix', 'shortest-path-in-a-grid-with-obstacles-elimination', 'amount-of-time-for-binary-tree-to-be-infected'] | [] | Algorithms | null | [["X","X","X","X","X","X"],["X","*","O","O","O","X"],["X","O","O","#","O","X"],["X","X","X","X","X","X"]] | {
"name": "getFood",
"params": [
{
"name": "grid",
"type": "character[][]"
}
],
"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', 'Matrix'] |
1,731 | The Number of Employees Which Report to Each Employee | the-number-of-employees-which-report-to-each-employee | <p>Table: <code>Employees</code></p>
<pre>
+-------------+----------+
| Column Name | Type |
+-------------+----------+
| employee_id | int |
| name | varchar |
| reports_to | int |
| age | int |
+-------------+----------+
employee_id is the column with unique values for this table.... | Easy | 252.3K | 487.3K | 252,295 | 487,269 | 51.8% | [] | ['Create table If Not Exists Employees(employee_id int, name varchar(20), reports_to int, age int)', 'Truncate table Employees', "insert into Employees (employee_id, name, reports_to, age) values ('9', 'Hercy', NULL, '43')", "insert into Employees (employee_id, name, reports_to, age) values ('6', 'Alice', '9', '41')", ... | 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":{"Employees":["employee_id","name","reports_to","age"]},"rows":{"Employees":[[9,"Hercy",null,43],[6,"Alice",9,41],[4,"Bob",9,36],[2,"Winston",null,37]]}} | {"mysql": ["Create table If Not Exists Employees(employee_id int, name varchar(20), reports_to int, age int)"], "mssql": ["Create table Employees(employee_id int, name varchar(20), reports_to int, age int)"], "oraclesql": ["Create table Employees(employee_id int, name varchar(20), reports_to int, age int)"], "database"... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,732 | Find the Highest Altitude | find-the-highest-altitude | <p>There is a biker going on a road trip. The road trip consists of <code>n + 1</code> points at different altitudes. The biker starts his trip on point <code>0</code> with altitude equal <code>0</code>.</p>
<p>You are given an integer array <code>gain</code> of length <code>n</code> where <code>gain[i]</code> is the ... | Easy | 567.9K | 677.8K | 567,939 | 677,836 | 83.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int largestAltitude(vector<int>& gain) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int largestAltitude(int[] gain) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | [-5,1,5,0,-7] | {
"name": "largestAltitude",
"params": [
{
"name": "gain",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Prefix Sum'] |
1,733 | Minimum Number of People to Teach | minimum-number-of-people-to-teach | <p>On a social network consisting of <code>m</code> users and some friendships between users, two users can communicate with each other if they know a common language.</p>
<p>You are given an integer <code>n</code>, an array <code>languages</code>, and an array <code>friendships</code> where:</p>
<ul>
<li>There are ... | Medium | 11K | 25.4K | 11,005 | 25,398 | 43.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumTeachings(int n, vector<vector<int>>& languages, vector<vector<int>>& friendships) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumTeachings(int n, int[][] langu... | 2
[[1],[2],[1,2]]
[[1,2],[1,3],[2,3]] | {
"name": "minimumTeachings",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "languages"
},
{
"type": "integer[][]",
"name": "friendships"
}
],
"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'] |
1,734 | Decode XORed Permutation | decode-xored-permutation | <p>There is an integer array <code>perm</code> that is a permutation of the first <code>n</code> positive integers, where <code>n</code> is always <strong>odd</strong>.</p>
<p>It was encoded into another integer array <code>encoded</code> of length <code>n - 1</code>, such that <code>encoded[i] = perm[i] XOR perm[i + ... | Medium | 17.8K | 27.2K | 17,805 | 27,155 | 65.6% | ['find-xor-beauty-of-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> decode(vector<int>& encoded) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] decode(int[] encoded) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [3,1] | {
"name": "decode",
"params": [
{
"name": "encoded",
"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', 'Bit Manipulation'] |
1,735 | Count Ways to Make Array With Product | count-ways-to-make-array-with-product | <p>You are given a 2D integer array, <code>queries</code>. For each <code>queries[i]</code>, where <code>queries[i] = [n<sub>i</sub>, k<sub>i</sub>]</code>, find the number of different ways you can place positive integers into an array of size <code>n<sub>i</sub></code> such that the product of the integers is <code>k... | Hard | 7.4K | 14.2K | 7,419 | 14,153 | 52.4% | ['count-the-number-of-ideal-arrays', 'smallest-value-after-replacing-with-sum-of-prime-factors', 'closest-prime-numbers-in-range'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> waysToFillArray(vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] waysToFillArray(int[][] queries) {\n \n }\n}"}, {"value": "py... | [[2,6],[5,1],[73,660]] | {
"name": "waysToFillArray",
"params": [
{
"name": "queries",
"type": "integer[][]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Dynamic Programming', 'Combinatorics', 'Number Theory'] |
1,736 | Latest Time by Replacing Hidden Digits | latest-time-by-replacing-hidden-digits | <p>You are given a string <code>time</code> in the form of <code> hh:mm</code>, where some of the digits in the string are hidden (represented by <code>?</code>).</p>
<p>The valid times are those inclusively between <code>00:00</code> and <code>23:59</code>.</p>
<p>Return <em>the latest valid time you can get from</e... | Easy | 42K | 97.8K | 41,993 | 97,764 | 43.0% | ['number-of-valid-clock-times', 'latest-time-you-can-obtain-after-replacing-characters'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string maximumTime(string time) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String maximumTime(String time) {\n \n }\n}"}, {"value": "python", "text": "Python", "default... | "2?:?0" | {
"name": "maximumTime",
"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... | ['String', 'Greedy'] |
1,737 | Change Minimum Characters to Satisfy One of Three Conditions | change-minimum-characters-to-satisfy-one-of-three-conditions | <p>You are given two strings <code>a</code> and <code>b</code> that consist of lowercase letters. In one operation, you can change any character in <code>a</code> or <code>b</code> to <strong>any lowercase letter</strong>.</p>
<p>Your goal is to satisfy <strong>one</strong> of the following three conditions:</p>
<ul>... | Medium | 15.1K | 40.9K | 15,111 | 40,855 | 37.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minCharacters(string a, string b) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minCharacters(String a, String b) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | "aba"
"caa" | {
"name": "minCharacters",
"params": [
{
"name": "a",
"type": "string"
},
{
"type": "string",
"name": "b"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Counting', 'Prefix Sum'] |
1,738 | Find Kth Largest XOR Coordinate Value | find-kth-largest-xor-coordinate-value | <p>You are given a 2D <code>matrix</code> of size <code>m x n</code>, consisting of non-negative integers. You are also given an integer <code>k</code>.</p>
<p>The <strong>value</strong> of coordinate <code>(a, b)</code> of the matrix is the XOR of all <code>matrix[i][j]</code> where <code>0 <= i <= a < m</co... | Medium | 26K | 41.6K | 26,018 | 41,581 | 62.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int kthLargestValue(vector<vector<int>>& matrix, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int kthLargestValue(int[][] matrix, int k) {\n \n }\n}"}, {"value": "... | [[5,2],[1,6]]
1 | {
"name": "kthLargestValue",
"params": [
{
"name": "matrix",
"type": "integer[][]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Divide and Conquer', 'Bit Manipulation', 'Sorting', 'Heap (Priority Queue)', 'Matrix', 'Prefix Sum', 'Quickselect'] |
1,739 | Building Boxes | building-boxes | <p>You have a cubic storeroom where the width, length, and height of the room are all equal to <code>n</code> units. You are asked to place <code>n</code> boxes in this room where each box is a cube of unit side length. There are however some rules to placing the boxes:</p>
<ul>
<li>You can place the boxes anywhere o... | Hard | 8.5K | 16.5K | 8,545 | 16,534 | 51.7% | ['block-placement-queries'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumBoxes(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumBoxes(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So... | 3 | {
"name": "minimumBoxes",
"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', 'Binary Search', 'Greedy'] |
1,740 | Find Distance in a Binary Tree | find-distance-in-a-binary-tree | null | Medium | 33.4K | 45.2K | 33,418 | 45,209 | 73.9% | ['step-by-step-directions-from-a-binary-tree-node-to-another'] | [] | Algorithms | null | [3,5,1,6,2,0,8,null,null,7,4]
5
0 | {
"name": "findDistance",
"params": [
{
"name": "root",
"type": "TreeNode"
},
{
"type": "integer",
"name": "p"
},
{
"type": "integer",
"name": "q"
}
],
"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', 'Tree', 'Depth-First Search', 'Breadth-First Search', 'Binary Tree'] |
1,741 | Find Total Time Spent by Each Employee | find-total-time-spent-by-each-employee | <p>Table: <code>Employees</code></p>
<pre>
+-------------+------+
| Column Name | Type |
+-------------+------+
| emp_id | int |
| event_day | date |
| in_time | int |
| out_time | int |
+-------------+------+
(emp_id, event_day, in_time) is the primary key (combinations of columns with unique values)... | Easy | 170.5K | 196.3K | 170,532 | 196,297 | 86.9% | [] | ['Create table If Not Exists Employees(emp_id int, event_day date, in_time int, out_time int)', 'Truncate table Employees', "insert into Employees (emp_id, event_day, in_time, out_time) values ('1', '2020-11-28', '4', '32')", "insert into Employees (emp_id, event_day, in_time, out_time) values ('1', '2020-11-28', '55',... | 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":{"Employees":["emp_id","event_day","in_time","out_time"]},"rows":{"Employees":[["1","2020-11-28","4","32"],["1","2020-11-28","55","200"],["1","2020-12-3","1","42"],["2","2020-11-28","3","33"],["2","2020-12-9","47","74"]]}} | {"mysql": ["Create table If Not Exists Employees(emp_id int, event_day date, in_time int, out_time int)"], "mssql": ["Create table Employees(emp_id int, event_day date, in_time int, out_time int)"], "oraclesql": ["Create table Employees(emp_id int, event_day date, in_time int, out_time int)", "ALTER SESSION SET nls_dat... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,742 | Maximum Number of Balls in a Box | maximum-number-of-balls-in-a-box | <p>You are working in a ball factory where you have <code>n</code> balls numbered from <code>lowLimit</code> up to <code>highLimit</code> <strong>inclusive</strong> (i.e., <code>n == highLimit - lowLimit + 1</code>), and an infinite number of boxes numbered from <code>1</code> to <code>infinity</code>.</p>
<p>Your job... | Easy | 74.9K | 101K | 74,870 | 101,015 | 74.1% | ['find-the-number-of-distinct-colors-among-the-balls'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countBalls(int lowLimit, int highLimit) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countBalls(int lowLimit, int highLimit) {\n \n }\n}"}, {"value": "python", "t... | 1
10 | {
"name": "countBalls",
"params": [
{
"name": "lowLimit",
"type": "integer"
},
{
"type": "integer",
"name": "highLimit"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'Math', 'Counting'] |
1,743 | Restore the Array From Adjacent Pairs | restore-the-array-from-adjacent-pairs | <p>There is an integer array <code>nums</code> that consists of <code>n</code> <strong>unique </strong>elements, but you have forgotten it. However, you do remember every pair of adjacent elements in <code>nums</code>.</p>
<p>You are given a 2D integer array <code>adjacentPairs</code> of size <code>n - 1</code> where ... | Medium | 113.6K | 152.1K | 113,632 | 152,130 | 74.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> restoreArray(vector<vector<int>>& adjacentPairs) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] restoreArray(int[][] adjacentPairs) {\n \n }\n}"}, {"value... | [[2,1],[3,4],[3,2]] | {
"name": "restoreArray",
"params": [
{
"name": "adjacentPairs",
"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', 'Depth-First Search'] |
1,744 | Can You Eat Your Favorite Candy on Your Favorite Day? | can-you-eat-your-favorite-candy-on-your-favorite-day | <p>You are given a <strong>(0-indexed)</strong> array of positive integers <code>candiesCount</code> where <code>candiesCount[i]</code> represents the number of candies of the <code>i<sup>th</sup></code> type you have. You are also given a 2D array <code>queries</code> where <code>queries[i] = [favoriteType<s... | Medium | 12K | 34.8K | 12,016 | 34,843 | 34.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<bool> canEat(vector<int>& candiesCount, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean[] canEat(int[] candiesCount, int[][] queries) {\n ... | [7,4,5,3,8]
[[0,2,2],[4,2,4],[2,13,1000000000]] | {
"name": "canEat",
"params": [
{
"name": "candiesCount",
"type": "integer[]"
},
{
"type": "integer[][]",
"name": "queries"
}
],
"return": {
"type": "boolean[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Prefix Sum'] |
1,745 | Palindrome Partitioning IV | palindrome-partitioning-iv | <p>Given a string <code>s</code>, return <code>true</code> <em>if it is possible to split the string</em> <code>s</code> <em>into three <strong>non-empty</strong> palindromic substrings. Otherwise, return </em><code>false</code>.</p>
<p>A string is said to be palindrome if it the same string when reversed.</p>
<... | Hard | 28.6K | 64.1K | 28,617 | 64,095 | 44.6% | ['palindrome-partitioning', 'palindrome-partitioning-ii', 'palindrome-partitioning-iii', 'maximum-number-of-non-overlapping-palindrome-substrings'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkPartitioning(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkPartitioning(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | "abcbdd" | {
"name": "checkPartitioning",
"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'] |
1,746 | Maximum Subarray Sum After One Operation | maximum-subarray-sum-after-one-operation | null | Medium | 13.2K | 20.2K | 13,151 | 20,178 | 65.2% | ['maximum-subarray'] | [] | Algorithms | null | [2,-1,-4,-3] | {
"name": "maxSumAfterOperation",
"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'] |
1,747 | Leetflex Banned Accounts | leetflex-banned-accounts | null | Medium | 26.7K | 42.9K | 26,741 | 42,854 | 62.4% | [] | ['Create table If Not Exists LogInfo (account_id int, ip_address int, login datetime, logout datetime)', 'Truncate table LogInfo', "insert into LogInfo (account_id, ip_address, login, logout) values ('1', '1', '2021-02-01 09:00:00', '2021-02-01 09:30:00')", "insert into LogInfo (account_id, ip_address, login, logout) v... | Database | null | {"headers":{"LogInfo":["account_id","ip_address","login","logout"]},"rows":{"LogInfo":[[1,1,"2021-02-01 09:00:00","2021-02-01 09:30:00"],[1,2,"2021-02-01 08:00:00","2021-02-01 11:30:00"],[2,6,"2021-02-01 20:30:00","2021-02-01 22:00:00"],[2,7,"2021-02-02 20:30:00","2021-02-02 22:00:00"],[3,9,"2021-02-01 16:00:00","2021-... | {"mysql": ["Create table If Not Exists LogInfo (account_id int, ip_address int, login datetime, logout datetime)"], "mssql": ["Create table LogInfo (account_id int, ip_address int, login datetime, logout datetime)"], "oraclesql": ["Create table LogInfo (account_id int, ip_address int, login date, logout date)", "ALTER ... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,748 | Sum of Unique Elements | sum-of-unique-elements | <p>You are given an integer array <code>nums</code>. The unique elements of an array are the elements that appear <strong>exactly once</strong> in the array.</p>
<p>Return <em>the <strong>sum</strong> of all the unique elements of </em><code>nums</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong... | Easy | 211K | 267.6K | 211,040 | 267,601 | 78.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumOfUnique(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumOfUnique(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultC... | [1,2,3,2] | {
"name": "sumOfUnique",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Counting'] |
1,749 | Maximum Absolute Sum of Any Subarray | maximum-absolute-sum-of-any-subarray | <p>You are given an integer array <code>nums</code>. The <strong>absolute sum</strong> of a subarray <code>[nums<sub>l</sub>, nums<sub>l+1</sub>, ..., nums<sub>r-1</sub>, nums<sub>r</sub>]</code> is <code>abs(nums<sub>l</sub> + nums<sub>l+1</sub> + ... + nums<sub>r-1</sub> + nums<sub>r</sub>)</code>.</p>
<p>Return <em... | Medium | 167.1K | 233.7K | 167,112 | 233,693 | 71.5% | ['maximum-subarray'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxAbsoluteSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxAbsoluteSum(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "de... | [1,-3,2,3,-4] | {
"name": "maxAbsoluteSum",
"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'] |
1,750 | Minimum Length of String After Deleting Similar Ends | minimum-length-of-string-after-deleting-similar-ends | <p>Given a string <code>s</code> consisting only of characters <code>'a'</code>, <code>'b'</code>, and <code>'c'</code>. You are asked to apply the following algorithm on the string any number of times:</p>
<ol>
<li>Pick a <strong>non-empty</strong> prefix from the string <code>s</code> where ... | Medium | 175.3K | 313.8K | 175,335 | 313,814 | 55.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumLength(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumLength(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "... | "ca" | {
"name": "minimumLength",
"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'] |
1,751 | Maximum Number of Events That Can Be Attended II | maximum-number-of-events-that-can-be-attended-ii | <p>You are given an array of <code>events</code> where <code>events[i] = [startDay<sub>i</sub>, endDay<sub>i</sub>, value<sub>i</sub>]</code>. The <code>i<sup>th</sup></code> event starts at <code>startDay<sub>i</sub></code><sub> </sub>and ends at <code>endDay<sub>i</sub></code>, and if you attend this event, you will ... | Hard | 79.9K | 131.3K | 79,947 | 131,290 | 60.9% | ['maximum-number-of-events-that-can-be-attended', 'maximum-earnings-from-taxi', 'two-best-non-overlapping-events', 'meeting-rooms-iii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxValue(vector<vector<int>>& events, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxValue(int[][] events, int k) {\n \n }\n}"}, {"value": "python", "text... | [[1,2,4],[3,4,3],[2,3,1]]
2 | {
"name": "maxValue",
"params": [
{
"name": "events",
"type": "integer[][]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Dynamic Programming', 'Sorting'] |
1,752 | Check if Array Is Sorted and Rotated | check-if-array-is-sorted-and-rotated | <p>Given an array <code>nums</code>, return <code>true</code><em> if the array was originally sorted in non-decreasing order, then rotated <strong>some</strong> number of positions (including zero)</em>. Otherwise, return <code>false</code>.</p>
<p>There may be <strong>duplicates</strong> in the original array.</p>
<... | Easy | 583.3K | 1.1M | 583,325 | 1,061,153 | 55.0% | ['check-if-all-as-appears-before-all-bs'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool check(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean check(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "... | [3,4,5,1,2] | {
"name": "check",
"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'] |
1,753 | Maximum Score From Removing Stones | maximum-score-from-removing-stones | <p>You are playing a solitaire game with <strong>three piles</strong> of stones of sizes <code>a</code>, <code>b</code>, and <code>c</code> respectively. Each turn you choose two <strong>different non-empty </strong>piles, take one stone from each, and add <code>1</code> point to your score. The game ... | Medium | 47.2K | 69.8K | 47,208 | 69,800 | 67.6% | ['minimum-amount-of-time-to-fill-cups'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumScore(int a, int b, int c) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumScore(int a, int b, int c) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | 2
4
6 | {
"name": "maximumScore",
"params": [
{
"name": "a",
"type": "integer"
},
{
"type": "integer",
"name": "b"
},
{
"type": "integer",
"name": "c"
}
],
"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', 'Heap (Priority Queue)'] |
1,754 | Largest Merge Of Two Strings | largest-merge-of-two-strings | <p>You are given two strings <code>word1</code> and <code>word2</code>. You want to construct a string <code>merge</code> in the following way: while either <code>word1</code> or <code>word2</code> are non-empty, choose <strong>one</strong> of the following options:</p>
<ul>
<li>If <code>word1</code> is non-empty, ap... | Medium | 28K | 55.3K | 27,982 | 55,263 | 50.6% | ['maximum-matching-of-players-with-trainers', 'decremental-string-concatenation'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string largestMerge(string word1, string word2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String largestMerge(String word1, String word2) {\n \n }\n}"}, {"value": "pyt... | "cabaa"
"bcaaa" | {
"name": "largestMerge",
"params": [
{
"name": "word1",
"type": "string"
},
{
"type": "string",
"name": "word2"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String', 'Greedy'] |
1,755 | Closest Subsequence Sum | closest-subsequence-sum | <p>You are given an integer array <code>nums</code> and an integer <code>goal</code>.</p>
<p>You want to choose a subsequence of <code>nums</code> such that the sum of its elements is the closest possible to <code>goal</code>. That is, if the sum of the subsequence's elements is <code>sum</code>, then you want to ... | Hard | 22.3K | 53.9K | 22,256 | 53,939 | 41.3% | ['minimize-the-difference-between-target-and-chosen-elements', 'partition-array-into-two-arrays-to-minimize-sum-difference', 'minimum-operations-to-form-subsequence-with-target-sum', 'find-the-sum-of-subsequence-powers'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minAbsDifference(vector<int>& nums, int goal) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minAbsDifference(int[] nums, int goal) {\n \n }\n}"}, {"value": "python... | [5,-7,3,5]
6 | {
"name": "minAbsDifference",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "goal"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Dynamic Programming', 'Bit Manipulation', 'Sorting', 'Bitmask'] |
1,756 | Design Most Recently Used Queue | design-most-recently-used-queue | null | Medium | 23.9K | 30.8K | 23,946 | 30,829 | 77.7% | ['lru-cache'] | [] | Algorithms | null | ["MRUQueue","fetch","fetch","fetch","fetch"]
[[8],[3],[5],[2],[8]] | {
"classname": "MRUQueue",
"constructor": {
"params": [
{
"type": "integer",
"name": "n"
}
]
},
"methods": [
{
"params": [
{
"type": "integer",
"name": "k"
}
],
"name": "fetch",
"return": {
"type": "integ... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Stack', 'Design', 'Binary Indexed Tree', 'Ordered Set'] |
1,757 | Recyclable and Low Fat Products | recyclable-and-low-fat-products | <p>Table: <code>Products</code></p>
<pre>
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| product_id | int |
| low_fats | enum |
| recyclable | enum |
+-------------+---------+
product_id is the primary key (column with unique values) for this table.
low_fats is an ENUM (... | Easy | 1.8M | 2M | 1,786,416 | 1,999,478 | 89.3% | [] | ["Create table If Not Exists Products (product_id int, low_fats ENUM('Y', 'N'), recyclable ENUM('Y','N'))", 'Truncate table Products', "insert into Products (product_id, low_fats, recyclable) values ('0', 'Y', 'N')", "insert into Products (product_id, low_fats, recyclable) values ('1', 'Y', 'Y')", "insert into Products... | Database | [{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v... | {"headers":{"Products":["product_id","low_fats","recyclable"]},"rows":{"Products":[["0","Y","N"],["1","Y","Y"],["2","N","Y"],["3","Y","Y"],["4","N","N"]]}} | {"mysql": ["Create table If Not Exists Products (product_id int, low_fats ENUM('Y', 'N'), recyclable ENUM('Y','N'))"], "mssql": ["Create table Products (product_id int, low_fats varchar(1) not null check(low_fats in ('Y', 'N')), recyclable varchar(1) not null check(recyclable in ('Y', 'N')))"], "oraclesql": ["Create ta... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,758 | Minimum Changes To Make Alternating Binary String | minimum-changes-to-make-alternating-binary-string | <p>You are given a string <code>s</code> consisting only of the characters <code>'0'</code> and <code>'1'</code>. In one operation, you can change any <code>'0'</code> to <code>'1'</code> or vice versa.</p>
<p>The string is called alternating if no two adjacent characters are equal. For... | Easy | 157.2K | 246.7K | 157,157 | 246,742 | 63.7% | ['remove-adjacent-almost-equal-characters'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "... | "0100" | {
"name": "minOperations",
"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'] |
1,759 | Count Number of Homogenous Substrings | count-number-of-homogenous-substrings | <p>Given a string <code>s</code>, return <em>the number of <strong>homogenous</strong> substrings of </em><code>s</code><em>.</em> Since the answer may be too large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
<p>A string is <strong>homogenous</strong> if all the characters of the string are... | Medium | 119K | 207.1K | 118,970 | 207,092 | 57.4% | ['consecutive-characters', 'number-of-substrings-with-only-1s', 'sum-of-subarray-ranges', 'count-the-number-of-good-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countHomogenous(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countHomogenous(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode... | "abbcccaa" | {
"name": "countHomogenous",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'String'] |
1,760 | Minimum Limit of Balls in a Bag | minimum-limit-of-balls-in-a-bag | <p>You are given an integer array <code>nums</code> where the <code>i<sup>th</sup></code> bag contains <code>nums[i]</code> balls. You are also given an integer <code>maxOperations</code>.</p>
<p>You can perform the following operation at most <code>maxOperations</code> times:</p>
<ul>
<li>Take any bag of balls and ... | Medium | 139.2K | 205.9K | 139,180 | 205,884 | 67.6% | ['maximum-candies-allocated-to-k-children', 'minimized-maximum-of-products-distributed-to-any-store'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumSize(vector<int>& nums, int maxOperations) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumSize(int[] nums, int maxOperations) {\n \n }\n}"}, {"value":... | [9]
2 | {
"name": "minimumSize",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "maxOperations"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search'] |
1,761 | Minimum Degree of a Connected Trio in a Graph | minimum-degree-of-a-connected-trio-in-a-graph | <p>You are given an undirected graph. You are given an integer <code>n</code> which is the number of nodes in the graph and an array <code>edges</code>, where each <code>edges[i] = [u<sub>i</sub>, v<sub>i</sub>]</code> indicates that there is an undirected edge between <code>u<sub>i</sub></code> and <code>v<sub>i</sub>... | Hard | 26.2K | 60.9K | 26,240 | 60,866 | 43.1% | ['add-edges-to-make-degrees-of-all-nodes-even'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minTrioDegree(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minTrioDegree(int n, int[][] edges) {\n \n }\n}"}, {"value": "python... | 6
[[1,2],[1,3],[3,2],[4,1],[5,2],[3,6]] | {
"name": "minTrioDegree",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "edges"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Graph'] |
1,762 | Buildings With an Ocean View | buildings-with-an-ocean-view | null | Medium | 292.9K | 363.3K | 292,921 | 363,288 | 80.6% | ['number-of-visible-people-in-a-queue', 'finding-the-number-of-visible-mountains'] | [] | Algorithms | null | [4,2,3,1] | {
"name": "findBuildings",
"params": [
{
"name": "heights",
"type": "integer[]"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Stack', 'Monotonic Stack'] |
1,763 | Longest Nice Substring | longest-nice-substring | <p>A string <code>s</code> is <strong>nice</strong> if, for every letter of the alphabet that <code>s</code> contains, it appears <strong>both</strong> in uppercase and lowercase. For example, <code>"abABB"</code> is nice because <code>'A'</code> and <code>'a'</code> appear, and <code>'B&#... | Easy | 72K | 116.2K | 72,042 | 116,222 | 62.0% | ['number-of-good-paths'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string longestNiceSubstring(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String longestNiceSubstring(String s) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | "YazaAay" | {
"name": "longestNiceSubstring",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Divide and Conquer', 'Bit Manipulation', 'Sliding Window'] |
1,764 | Form Array by Concatenating Subarrays of Another Array | form-array-by-concatenating-subarrays-of-another-array | <p>You are given a 2D integer array <code>groups</code> of length <code>n</code>. You are also given an integer array <code>nums</code>.</p>
<p>You are asked if you can choose <code>n</code> <strong>disjoint </strong>subarrays from the array <code>nums</code> such that the <code>i<sup>th</sup></code> subarray is equal... | Medium | 18.1K | 33.7K | 18,055 | 33,668 | 53.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canChoose(vector<vector<int>>& groups, vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canChoose(int[][] groups, int[] nums) {\n \n }\n}"}, {... | [[1,-1,-1],[3,-2,0]]
[1,-1,0,1,-1,-1,3,-2,0] | {
"name": "canChoose",
"params": [
{
"name": "groups",
"type": "integer[][]"
},
{
"type": "integer[]",
"name": "nums"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Greedy', 'String Matching'] |
1,765 | Map of Highest Peak | map-of-highest-peak | <p>You are given an integer matrix <code>isWater</code> of size <code>m x n</code> that represents a map of <strong>land</strong> and <strong>water</strong> cells.</p>
<ul>
<li>If <code>isWater[i][j] == 0</code>, cell <code>(i, j)</code> is a <strong>land</strong> cell.</li>
<li>If <code>isWater[i][j] == 1</code>, c... | Medium | 140.6K | 187.3K | 140,553 | 187,339 | 75.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> highestPeak(vector<vector<int>>& isWater) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] highestPeak(int[][] isWater) {\n \n }\n}"}, {"value": "... | [[0,1],[0,0]] | {
"name": "highestPeak",
"params": [
{
"name": "isWater",
"type": "integer[][]"
}
],
"return": {
"type": "integer[][]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Breadth-First Search', 'Matrix'] |
1,766 | Tree of Coprimes | tree-of-coprimes | <p>There is a tree (i.e., a connected, undirected graph that has no cycles) consisting of <code>n</code> nodes numbered from <code>0</code> to <code>n - 1</code> and exactly <code>n - 1</code> edges. Each node has a value associated with it, and the <strong>root</strong> of the tree is node <code>0</code>.</p>
<p... | Hard | 11.5K | 27.5K | 11,481 | 27,487 | 41.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> getCoprimes(vector<int>& nums, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] getCoprimes(int[] nums, int[][] edges) {\n \n }\... | [2,3,3,2]
[[0,1],[1,2],[1,3]] | {
"name": "getCoprimes",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer[][]",
"name": "edges"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Tree', 'Depth-First Search', 'Number Theory'] |
1,767 | Find the Subtasks That Did Not Execute | find-the-subtasks-that-did-not-execute | null | Hard | 16.5K | 21.2K | 16,521 | 21,157 | 78.1% | [] | ['Create table If Not Exists Tasks (task_id int, subtasks_count int)', 'Create table If Not Exists Executed (task_id int, subtask_id int)', 'Truncate table Tasks', "insert into Tasks (task_id, subtasks_count) values ('1', '3')", "insert into Tasks (task_id, subtasks_count) values ('2', '2')", "insert into Tasks (task_i... | Database | null | {"headers": {"Tasks": ["task_id", "subtasks_count"], "Executed": ["task_id", "subtask_id"]}, "rows": {"Tasks": [[1, 3], [2, 2], [3, 4]], "Executed": [[1, 2], [3, 1], [3, 2], [3, 3], [3, 4]]}} | {"mysql": ["Create table If Not Exists Tasks (task_id int, subtasks_count int)", "Create table If Not Exists Executed (task_id int, subtask_id int)"], "mssql": ["Create table Tasks (task_id int, subtasks_count int)", "Create table Executed (task_id int, subtask_id int)"], "oraclesql": ["Create table Tasks (task_id int,... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,768 | Merge Strings Alternately | merge-strings-alternately | <p>You are given two strings <code>word1</code> and <code>word2</code>. Merge the strings by adding letters in alternating order, starting with <code>word1</code>. If a string is longer than the other, append the additional letters onto the end of the merged string.</p>
<p>Return <em>the merged string.</em></p>
<p>&n... | Easy | 1.6M | 1.9M | 1,553,963 | 1,893,666 | 82.1% | ['zigzag-iterator', 'minimum-additions-to-make-valid-string'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string mergeAlternately(string word1, string word2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String mergeAlternately(String word1, String word2) {\n \n }\n}"}, {"valu... | "abc"
"pqr" | {
"name": "mergeAlternately",
"params": [
{
"name": "word1",
"type": "string"
},
{
"type": "string",
"name": "word2"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String'] |
1,769 | Minimum Number of Operations to Move All Balls to Each Box | minimum-number-of-operations-to-move-all-balls-to-each-box | <p>You have <code>n</code> boxes. You are given a binary string <code>boxes</code> of length <code>n</code>, where <code>boxes[i]</code> is <code>'0'</code> if the <code>i<sup>th</sup></code> box is <strong>empty</strong>, and <code>'1'</code> if it contains <strong>one</strong> ball.</p>
<p>In one ope... | Medium | 296.2K | 328.7K | 296,219 | 328,694 | 90.1% | ['minimum-cost-to-move-chips-to-the-same-position', 'minimum-moves-to-spread-stones-over-grid'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> minOperations(string boxes) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] minOperations(String boxes) {\n \n }\n}"}, {"value": "python", "text": "Python"... | "110" | {
"name": "minOperations",
"params": [
{
"name": "boxes",
"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', 'String', 'Prefix Sum'] |
1,770 | Maximum Score from Performing Multiplication Operations | maximum-score-from-performing-multiplication-operations | <p>You are given two <strong>0-indexed</strong> integer arrays <code>nums</code> and <code>multipliers</code><strong> </strong>of size <code>n</code> and <code>m</code> respectively, where <code>n >= m</code>.</p>
<p>You begin with a score of <code>0</code>. You want to perform <strong>exactly</strong> <code>m</cod... | Hard | 124.3K | 296.4K | 124,307 | 296,352 | 41.9% | ['maximum-points-you-can-obtain-from-cards', 'stone-game-vii', 'maximum-spending-after-buying-items'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumScore(vector<int>& nums, vector<int>& multipliers) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumScore(int[] nums, int[] multipliers) {\n \n }\n}"}, ... | [1,2,3]
[3,2,1] | {
"name": "maximumScore",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "multipliers"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming'] |
1,771 | Maximize Palindrome Length From Subsequences | maximize-palindrome-length-from-subsequences | <p>You are given two strings, <code>word1</code> and <code>word2</code>. You want to construct a string in the following manner:</p>
<ul>
<li>Choose some <strong>non-empty</strong> subsequence <code>subsequence1</code> from <code>word1</code>.</li>
<li>Choose some <strong>non-empty</strong> subsequence <code>subsequ... | Hard | 12.8K | 34.6K | 12,804 | 34,574 | 37.0% | ['longest-palindromic-subsequence'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestPalindrome(string word1, string word2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestPalindrome(String word1, String word2) {\n \n }\n}"}, {"value": ... | "cacb"
"cbba" | {
"name": "longestPalindrome",
"params": [
{
"name": "word1",
"type": "string"
},
{
"type": "string",
"name": "word2"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
1,772 | Sort Features by Popularity | sort-features-by-popularity | null | Medium | 6.8K | 10.4K | 6,825 | 10,378 | 65.8% | ['top-k-frequent-elements', 'top-k-frequent-words'] | [] | Algorithms | null | ["cooler","lock","touch"]
["i like cooler cooler","lock touch cool","locker like touch"] | {
"name": "sortFeatures",
"params": [
{
"type": "string[]",
"name": "features"
},
{
"type": "string[]",
"name": "responses"
}
],
"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', 'Sorting'] |
1,773 | Count Items Matching a Rule | count-items-matching-a-rule | <p>You are given an array <code>items</code>, where each <code>items[i] = [type<sub>i</sub>, color<sub>i</sub>, name<sub>i</sub>]</code> describes the type, color, and name of the <code>i<sup>th</sup></code> item. You are also given a rule represented by two strings, <code>ruleKey</code> and <code>ruleValue</code>.</p>... | Easy | 255.7K | 301.2K | 255,650 | 301,203 | 84.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countMatches(vector<vector<string>>& items, string ruleKey, string ruleValue) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countMatches(List<List<String>> items, String rul... | [["phone","blue","pixel"],["computer","silver","lenovo"],["phone","gold","iphone"]]
"color"
"silver" | {
"name": "countMatches",
"params": [
{
"name": "items",
"type": "list<list<string>>"
},
{
"type": "string",
"name": "ruleKey"
},
{
"type": "string",
"name": "ruleValue"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String'] |
1,774 | Closest Dessert Cost | closest-dessert-cost | <p>You would like to make dessert and are preparing to buy the ingredients. You have <code>n</code> ice cream base flavors and <code>m</code> types of toppings to choose from. You must follow these rules when making your dessert:</p>
<ul>
<li>There must be <strong>exactly one</strong> ice cream base.</li>
<li>You ca... | Medium | 34.5K | 72.5K | 34,469 | 72,454 | 47.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int closestCost(vector<int>& baseCosts, vector<int>& toppingCosts, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int closestCost(int[] baseCosts, int[] toppingCosts, int... | [1,7]
[3,4]
10 | {
"name": "closestCost",
"params": [
{
"name": "baseCosts",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "toppingCosts"
},
{
"type": "integer",
"name": "target"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Backtracking'] |
1,775 | Equal Sum Arrays With Minimum Number of Operations | equal-sum-arrays-with-minimum-number-of-operations | <p>You are given two arrays of integers <code>nums1</code> and <code><font face="monospace">nums2</font></code>, possibly of different lengths. The values in the arrays are between <code>1</code> and <code>6</code>, inclusive.</p>
<p>In one operation, you can change any integer's value in <strong>any </strong>of t... | Medium | 32.3K | 60.1K | 32,334 | 60,070 | 53.8% | ['number-of-dice-rolls-with-target-sum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums1, vector<int>& nums2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(int[] nums1, int[] nums2) {\n \n }\n}"}, {"value"... | [1,2,3,4,5,6]
[1,1,2,2,2,2] | {
"name": "minOperations",
"params": [
{
"name": "nums1",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "nums2"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Greedy', 'Counting'] |
1,776 | Car Fleet II | car-fleet-ii | <p>There are <code>n</code> cars traveling at different speeds in the same direction along a one-lane road. You are given an array <code>cars</code> of length <code>n</code>, where <code>cars[i] = [position<sub>i</sub>, speed<sub>i</sub>]</code> represents:</p>
<ul>
<li><code>position<sub>i</sub></code> is the distan... | Hard | 29.1K | 51.9K | 29,125 | 51,920 | 56.1% | ['car-fleet', 'count-collisions-on-a-road'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<double> getCollisionTimes(vector<vector<int>>& cars) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double[] getCollisionTimes(int[][] cars) {\n \n }\n}"}, {"value":... | [[1,2],[2,1],[4,3],[7,2]] | {
"name": "getCollisionTimes",
"params": [
{
"name": "cars",
"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', 'Math', 'Stack', 'Heap (Priority Queue)', 'Monotonic Stack'] |
1,777 | Product's Price for Each Store | products-price-for-each-store | null | Easy | 22.8K | 27.6K | 22,787 | 27,626 | 82.5% | ['rearrange-products-table', 'dynamic-pivoting-of-a-table'] | ["Create table If Not Exists Products (product_id int, store ENUM('store1', 'store2', 'store3'), price int)", 'Truncate table Products', "insert into Products (product_id, store, price) values ('0', 'store1', '95')", "insert into Products (product_id, store, price) values ('0', 'store3', '105')", "insert into Products ... | Database | null | {"headers":{"Products":["product_id","store","price"]},"rows":{"Products":[["0","store1","95"],["0","store3","105"],["0","store2","100"],["1","store1","70"],["1","store3","80"]]}} | {"mysql": ["Create table If Not Exists Products (product_id int, store ENUM('store1', 'store2', 'store3'), price int)"], "mssql": ["Create table Products (product_id int, store varchar(6) not null check(store in ('store1', 'store2', 'store3')), price int)"], "oraclesql": ["Create table Products (product_id int, store v... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,778 | Shortest Path in a Hidden Grid | shortest-path-in-a-hidden-grid | null | Medium | 15.1K | 34.4K | 15,144 | 34,402 | 44.0% | ['robot-room-cleaner', 'minimum-path-cost-in-a-hidden-grid'] | [] | Algorithms | null | [[1,2],[-1,0]] | {
"name": "foobar",
"params": [
{
"type": "integer[][]",
"name": "grid"
}
],
"return": {
"type": "integer"
},
"manual": true,
"languages": [
"cpp",
"java",
"python",
"csharp",
"javascript",
"swift",
"python3"
]
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Depth-First Search', 'Breadth-First Search', 'Graph', 'Interactive'] |
1,779 | Find Nearest Point That Has the Same X or Y Coordinate | find-nearest-point-that-has-the-same-x-or-y-coordinate | <p>You are given two integers, <code>x</code> and <code>y</code>, which represent your current location on a Cartesian grid: <code>(x, y)</code>. You are also given an array <code>points</code> where each <code>points[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> represents that a point exists at <code>(a<sub>i</sub>, b<s... | Easy | 125K | 180.5K | 124,962 | 180,469 | 69.2% | ['k-closest-points-to-origin'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int nearestValidPoint(int x, int y, vector<vector<int>>& points) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int nearestValidPoint(int x, int y, int[][] points) {\n \n }... | 3
4
[[1,2],[3,1],[2,4],[2,3],[4,4]] | {
"name": "nearestValidPoint",
"params": [
{
"name": "x",
"type": "integer"
},
{
"type": "integer",
"name": "y"
},
{
"type": "integer[][]",
"name": "points"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array'] |
1,780 | Check if Number is a Sum of Powers of Three | check-if-number-is-a-sum-of-powers-of-three | <p>Given an integer <code>n</code>, return <code>true</code> <em>if it is possible to represent </em><code>n</code><em> as the sum of distinct powers of three.</em> Otherwise, return <code>false</code>.</p>
<p>An integer <code>y</code> is a power of three if there exists an integer <code>x</code> such that <code>y == ... | Medium | 199.1K | 251.2K | 199,117 | 251,206 | 79.3% | ['power-of-three'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkPowersOfThree(int n) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkPowersOfThree(int n) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | 12 | {
"name": "checkPowersOfThree",
"params": [
{
"name": "n",
"type": "integer"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math'] |
1,781 | Sum of Beauty of All Substrings | sum-of-beauty-of-all-substrings | <p>The <strong>beauty</strong> of a string is the difference in frequencies between the most frequent and least frequent characters.</p>
<ul>
<li>For example, the beauty of <code>"abaacc"</code> is <code>3 - 1 = 2</code>.</li>
</ul>
<p>Given a string <code>s</code>, return <em>the sum of <strong>beauty</st... | Medium | 99.2K | 141.8K | 99,219 | 141,818 | 70.0% | ['substrings-that-begin-and-end-with-the-same-letter'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int beautySum(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int beautySum(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "class So... | "aabcb" | {
"name": "beautySum",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Counting'] |
1,782 | Count Pairs Of Nodes | count-pairs-of-nodes | <p>You are given an undirected graph defined by an integer <code>n</code>, the number of nodes, and a 2D integer array <code>edges</code>, the edges in the graph, where <code>edges[i] = [u<sub>i</sub>, v<sub>i</sub>]</code> indicates that there is an <strong>undirected</strong> edge between <code>u<sub>i</sub></code> a... | Hard | 8.1K | 20K | 8,090 | 19,966 | 40.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> countPairs(int n, vector<vector<int>>& edges, vector<int>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] countPairs(int n, int[][] edges, int[] queries) {... | 4
[[1,2],[2,4],[1,3],[2,3],[2,1]]
[2,3] | {
"name": "countPairs",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "edges"
},
{
"type": "integer[]",
"name": "queries"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Binary Search', 'Graph', 'Sorting'] |
1,783 | Grand Slam Titles | grand-slam-titles | null | Medium | 30.3K | 36.5K | 30,322 | 36,452 | 83.2% | [] | ['Create table If Not Exists Players (player_id int, player_name varchar(20))', 'Create table If Not Exists Championships (year int, Wimbledon int, Fr_open int, US_open int, Au_open int)', 'Truncate table Players', "insert into Players (player_id, player_name) values ('1', 'Nadal')", "insert into Players (player_id, pl... | Database | null | {"headers": {"Players": ["player_id", "player_name"], "Championships": ["year", "Wimbledon", "Fr_open", "US_open", "Au_open"]}, "rows": {"Players": [[1, "Nadal"], [2, "Federer"], [3, "Novak"]], "Championships": [[2018, 1, 1, 1, 1], [2019, 1, 1, 2, 2], [2020, 2, 1, 2, 2]]}} | {"mysql": ["Create table If Not Exists Players (player_id int, player_name varchar(20))", "Create table If Not Exists Championships (year int, Wimbledon int, Fr_open int, US_open int, Au_open int)"], "mssql": ["Create table Players (player_id int, player_name varchar(20))", "Create table Championships (year int, Wimble... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,784 | Check if Binary String Has at Most One Segment of Ones | check-if-binary-string-has-at-most-one-segment-of-ones | <p>Given a binary string <code>s</code> <strong>without leading zeros</strong>, return <code>true</code> <em>if </em><code>s</code><em> contains <strong>at most one contiguous segment of ones</strong></em>. Otherwise, return <code>false</code>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></... | Easy | 51.7K | 132.4K | 51,664 | 132,441 | 39.0% | ['longer-contiguous-segments-of-ones-than-zeros'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkOnesSegment(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkOnesSegment(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa... | "1001" | {
"name": "checkOnesSegment",
"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'] |
1,785 | Minimum Elements to Add to Form a Given Sum | minimum-elements-to-add-to-form-a-given-sum | <p>You are given an integer array <code>nums</code> and two integers <code>limit</code> and <code>goal</code>. The array <code>nums</code> has an interesting property that <code>abs(nums[i]) <= limit</code>.</p>
<p>Return <em>the minimum number of elements you need to add to make the sum of the array equal to </em>... | Medium | 24.4K | 55.3K | 24,404 | 55,251 | 44.2% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minElements(vector<int>& nums, int limit, int goal) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minElements(int[] nums, int limit, int goal) {\n \n }\n}"}, {"val... | [1,-1,1]
3
-4 | {
"name": "minElements",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "limit"
},
{
"type": "integer",
"name": "goal"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy'] |
1,786 | Number of Restricted Paths From First to Last Node | number-of-restricted-paths-from-first-to-last-node | <p>There is an undirected weighted connected graph. You are given a positive integer <code>n</code> which denotes that the graph has <code>n</code> nodes labeled from <code>1</code> to <code>n</code>, and an array <code>edges</code> where each <code>edges[i] = [u<sub>i</sub>, v<sub>i</sub>, weight<sub>i</sub>]</code> d... | Medium | 28.7K | 72.2K | 28,706 | 72,196 | 39.8% | ['all-ancestors-of-a-node-in-a-directed-acyclic-graph', 'design-graph-with-shortest-path-calculator', 'minimum-cost-of-a-path-with-special-roads'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countRestrictedPaths(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countRestrictedPaths(int n, int[][] edges) {\n \n }\n}"}, {"v... | 5
[[1,2,3],[1,3,3],[2,3,1],[1,4,2],[5,2,2],[3,5,1],[5,4,10]] | {
"name": "countRestrictedPaths",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "edges"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming', 'Graph', 'Topological Sort', 'Heap (Priority Queue)', 'Shortest Path'] |
1,787 | Make the XOR of All Segments Equal to Zero | make-the-xor-of-all-segments-equal-to-zero | <p>You are given an array <code>nums</code> and an integer <code>k</code>. The <font face="monospace">XOR</font> of a segment <code>[left, right]</code> where <code>left <= right</code> is the <code>XOR</code> of all the elements with indices between <code>left</code> and <code>right</code>, inclusive: <code... | Hard | 6K | 15.2K | 6,025 | 15,167 | 39.7% | ['maximum-xor-score-subarray-queries'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minChanges(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minChanges(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Python... | [1,2,0,3,0]
1 | {
"name": "minChanges",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Bit Manipulation'] |
1,788 | Maximize the Beauty of the Garden | maximize-the-beauty-of-the-garden | null | Hard | 2.5K | 4K | 2,534 | 3,984 | 63.6% | [] | [] | Algorithms | null | [1,2,3,1,2] | {
"name": "maximumBeauty",
"params": [
{
"name": "flowers",
"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', 'Prefix Sum'] |
1,789 | Primary Department for Each Employee | primary-department-for-each-employee | <p>Table: <code>Employee</code></p>
<pre>
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| employee_id | int |
| department_id | int |
| primary_flag | varchar |
+---------------+---------+
(employee_id, department_id) is the primary key (combination of columns with uniq... | Easy | 230.8K | 326K | 230,776 | 325,978 | 70.8% | [] | ["Create table If Not Exists Employee (employee_id int, department_id int, primary_flag ENUM('Y','N'))", 'Truncate table Employee', "insert into Employee (employee_id, department_id, primary_flag) values ('1', '1', 'N')", "insert into Employee (employee_id, department_id, primary_flag) values ('2', '1', 'Y')", "insert ... | 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":{"Employee":["employee_id","department_id","primary_flag"]},"rows":{"Employee":[["1","1","N"],["2","1","Y"],["2","2","N"],["3","3","N"],["4","2","N"],["4","3","Y"],["4","4","N"]]}} | {"mysql": ["Create table If Not Exists Employee (employee_id int, department_id int, primary_flag ENUM('Y','N'))"], "mssql": ["Create table Employee (employee_id int, department_id int, primary_flag varchar(1) not null check(primary_flag in ('Y', 'N')))"], "oraclesql": ["Create table Employee (employee_id int, departme... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,790 | Check if One String Swap Can Make Strings Equal | check-if-one-string-swap-can-make-strings-equal | <p>You are given two strings <code>s1</code> and <code>s2</code> of equal length. A <strong>string swap</strong> is an operation where you choose two indices in a string (not necessarily different) and swap the characters at these indices.</p>
<p>Return <code>true</code> <em>if it is possible to make both strings equa... | Easy | 290.5K | 587.4K | 290,454 | 587,449 | 49.4% | ['buddy-strings', 'make-number-of-distinct-characters-equal', 'count-almost-equal-pairs-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool areAlmostEqual(string s1, string s2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean areAlmostEqual(String s1, String s2) {\n \n }\n}"}, {"value": "python", "te... | "bank"
"kanb" | {
"name": "areAlmostEqual",
"params": [
{
"name": "s1",
"type": "string"
},
{
"type": "string",
"name": "s2"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Counting'] |
1,791 | Find Center of Star Graph | find-center-of-star-graph | <p>There is an undirected <strong>star</strong> graph consisting of <code>n</code> nodes labeled from <code>1</code> to <code>n</code>. A star graph is a graph where there is one <strong>center</strong> node and <strong>exactly</strong> <code>n - 1</code> edges that connect the center node with every other node.</p>
<... | Easy | 380.8K | 439.7K | 380,790 | 439,707 | 86.6% | ['maximum-star-sum-of-a-graph'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int findCenter(vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int findCenter(int[][] edges) {\n \n }\n}"}, {"value": "python", "text": "Python",... | [[1,2],[2,3],[4,2]] | {
"name": "findCenter",
"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... | ['Graph'] |
1,792 | Maximum Average Pass Ratio | maximum-average-pass-ratio | <p>There is a school that has classes of students and each class will be having a final exam. You are given a 2D integer array <code>classes</code>, where <code>classes[i] = [pass<sub>i</sub>, total<sub>i</sub>]</code>. You know beforehand that in the <code>i<sup>th</sup></code> class, there are <code>total<sub>i</sub>... | Medium | 105.2K | 147K | 105,212 | 147,028 | 71.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n double maxAverageRatio(vector<vector<int>>& classes, int extraStudents) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public double maxAverageRatio(int[][] classes, int extraStudents) {\n ... | [[1,2],[3,5],[2,2]]
2 | {
"name": "maxAverageRatio",
"params": [
{
"name": "classes",
"type": "integer[][]"
},
{
"type": "integer",
"name": "extraStudents"
}
],
"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', 'Greedy', 'Heap (Priority Queue)'] |
1,793 | Maximum Score of a Good Subarray | maximum-score-of-a-good-subarray | <p>You are given an array of integers <code>nums</code> <strong>(0-indexed)</strong> and an integer <code>k</code>.</p>
<p>The <strong>score</strong> of a subarray <code>(i, j)</code> is defined as <code>min(nums[i], nums[i+1], ..., nums[j]) * (j - i + 1)</code>. A <strong>good</strong> subarray is a subarray where <c... | Hard | 81.3K | 126.6K | 81,294 | 126,583 | 64.2% | ['largest-rectangle-in-histogram'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumScore(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumScore(int[] nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Py... | [1,4,3,7,4,5]
3 | {
"name": "maximumScore",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Binary Search', 'Stack', 'Monotonic Stack'] |
1,794 | Count Pairs of Equal Substrings With Minimum Difference | count-pairs-of-equal-substrings-with-minimum-difference | null | Medium | 2.2K | 3.5K | 2,239 | 3,519 | 63.6% | [] | [] | Algorithms | null | "abcd"
"bccda" | {
"name": "countQuadruples",
"params": [
{
"name": "firstString",
"type": "string"
},
{
"type": "string",
"name": "secondString"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String', 'Greedy'] |
1,795 | Rearrange Products Table | rearrange-products-table | <p>Table: <code>Products</code></p>
<pre>
+-------------+---------+
| Column Name | Type |
+-------------+---------+
| product_id | int |
| store1 | int |
| store2 | int |
| store3 | int |
+-------------+---------+
product_id is the primary key (column with unique values) for this ta... | Easy | 159.2K | 186.1K | 159,220 | 186,077 | 85.6% | ['products-price-for-each-store', 'dynamic-unpivoting-of-a-table'] | ['Create table If Not Exists Products (product_id int, store1 int, store2 int, store3 int)', 'Truncate table Products', "insert into Products (product_id, store1, store2, store3) values ('0', '95', '100', '105')", "insert into Products (product_id, store1, store2, store3) values ('1', '70', NULL, '80')"] | Database | [{"value": "mysql", "text": "MySQL", "defaultCode": "# Write your MySQL query statement below\n"}, {"value": "mssql", "text": "MS SQL Server", "defaultCode": "/* Write your T-SQL query statement below */\n"}, {"value": "oraclesql", "text": "Oracle", "defaultCode": "/* Write your PL/SQL query statement below */\n"}, {"v... | {"headers":{"Products":["product_id","store1","store2","store3"]},"rows":{"Products":[[0, 95, 100, 105], [1, 70, null, 80]]}} | {"mysql": ["Create table If Not Exists Products (product_id int, store1 int, store2 int, store3 int)"], "mssql": ["Create table Products (product_id int, store1 int, store2 int, store3 int)"], "oraclesql": ["Create table Products (product_id int, store1 int, store2 int, store3 int)"], "database": true, "name": "rearran... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
1,796 | Second Largest Digit in a String | second-largest-digit-in-a-string | <p>Given an alphanumeric string <code>s</code>, return <em>the <strong>second largest</strong> numerical digit that appears in </em><code>s</code><em>, or </em><code>-1</code><em> if it does not exist</em>.</p>
<p>An <strong>alphanumeric</strong><strong> </strong>string is a string consisting of lowercase English lett... | Easy | 73.2K | 141.7K | 73,190 | 141,724 | 51.6% | ['remove-digit-from-number-to-maximize-result'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int secondHighest(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int secondHighest(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "... | "dfa12321afd" | {
"name": "secondHighest",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'String'] |
1,797 | Design Authentication Manager | design-authentication-manager | <p>There is an authentication system that works with authentication tokens. For each session, the user will receive a new authentication token that will expire <code>timeToLive</code> seconds after the <code>currentTime</code>. If the token is renewed, the expiry time will be <b>extended</b> to expire <code>timeToLive<... | Medium | 38.9K | 67K | 38,877 | 67,009 | 58.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class AuthenticationManager {\npublic:\n AuthenticationManager(int timeToLive) {\n \n }\n \n void generate(string tokenId, int currentTime) {\n \n }\n \n void renew(string tokenId, int currentTime) {\n \n }\n \n int coun... | ["AuthenticationManager","renew","generate","countUnexpiredTokens","generate","renew","renew","countUnexpiredTokens"]
[[5],["aaa",1],["aaa",2],[6],["bbb",7],["aaa",8],["bbb",10],[15]] | {
"classname": "AuthenticationManager",
"constructor": {
"params": [
{
"type": "integer",
"name": "timeToLive"
}
]
},
"methods": [
{
"params": [
{
"type": "string",
"name": "tokenId"
},
{
"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', 'Linked List', 'Design', 'Doubly-Linked List'] |
1,798 | Maximum Number of Consecutive Values You Can Make | maximum-number-of-consecutive-values-you-can-make | <p>You are given an integer array <code>coins</code> of length <code>n</code> which represents the <code>n</code> coins that you own. The value of the <code>i<sup>th</sup></code> coin is <code>coins[i]</code>. You can <strong>make</strong> some value <code>x</code> if you can choose some of your <code>n</code> coins su... | Medium | 22.3K | 36.1K | 22,274 | 36,129 | 61.7% | ['patching-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getMaximumConsecutive(vector<int>& coins) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getMaximumConsecutive(int[] coins) {\n \n }\n}"}, {"value": "python", "text... | [1,3] | {
"name": "getMaximumConsecutive",
"params": [
{
"name": "coins",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Sorting'] |
1,799 | Maximize Score After N Operations | maximize-score-after-n-operations | <p>You are given <code>nums</code>, an array of positive integers of size <code>2 * n</code>. You must perform <code>n</code> operations on this array.</p>
<p>In the <code>i<sup>th</sup></code> operation <strong>(1-indexed)</strong>, you will:</p>
<ul>
<li>Choose two elements, <code>x</code> and <code>y</code>.</li>... | Hard | 65.3K | 113K | 65,324 | 113,020 | 57.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxScore(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxScore(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": ... | [1,2] | {
"name": "maxScore",
"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', 'Dynamic Programming', 'Backtracking', 'Bit Manipulation', 'Number Theory', 'Bitmask'] |
1,800 | Maximum Ascending Subarray Sum | maximum-ascending-subarray-sum | <p>Given an array of positive integers <code>nums</code>, return the <strong>maximum</strong> possible sum of an <span data-keyword="strictly-increasing-array">strictly increasing subarray</span> in<em> </em><code>nums</code>.</p>
<p>A subarray is defined as a contiguous sequence of numbers in an array.</p>
<p> ... | Easy | 224.6K | 337.5K | 224,606 | 337,495 | 66.6% | ['find-good-days-to-rob-the-bank', 'maximum-number-of-books-you-can-take', 'count-strictly-increasing-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxAscendingSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxAscendingSum(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "... | [10,20,30,5,10,50] | {
"name": "maxAscendingSum",
"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'] |
1,801 | Number of Orders in the Backlog | number-of-orders-in-the-backlog | <p>You are given a 2D integer array <code>orders</code>, where each <code>orders[i] = [price<sub>i</sub>, amount<sub>i</sub>, orderType<sub>i</sub>]</code> denotes that <code>amount<sub>i</sub></code><sub> </sub>orders have been placed of type <code>orderType<sub>i</sub></code> at the price <code>price<sub>i</sub></cod... | Medium | 26.4K | 51.4K | 26,382 | 51,396 | 51.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int getNumberOfBacklogOrders(vector<vector<int>>& orders) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int getNumberOfBacklogOrders(int[][] orders) {\n \n }\n}"}, {"value... | [[10,5,0],[15,2,1],[25,1,1],[30,4,0]] | {
"name": "getNumberOfBacklogOrders",
"params": [
{
"name": "orders",
"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', 'Heap (Priority Queue)', 'Simulation'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.