questionFrontendId int64 1 3.51k | questionTitle stringlengths 3 79 | TitleSlug stringlengths 3 79 | content stringlengths 431 25.4k ⌀ | difficulty stringclasses 3
values | totalAccepted stringlengths 2 6 | totalSubmission stringlengths 2 6 | totalAcceptedRaw int64 124 16.8M | totalSubmissionRaw int64 285 30.3M | acRate stringlengths 4 5 | similarQuestions stringlengths 2 714 | mysqlSchemas stringclasses 295
values | category stringclasses 6
values | codeDefinition stringlengths 122 24.9k ⌀ | sampleTestCase stringlengths 1 4.33k | metaData stringlengths 37 3.13k | envInfo stringclasses 26
values | topicTags stringlengths 2 153 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,810 | Faulty Keyboard | faulty-keyboard | <p>Your laptop keyboard is faulty, and whenever you type a character <code>'i'</code> on it, it reverses the string that you have written. Typing other characters works as expected.</p>
<p>You are given a <strong>0-indexed</strong> string <code>s</code>, and you type each character of <code>s</code> using your... | Easy | 98.3K | 118.9K | 98,325 | 118,910 | 82.7% | ['reverse-vowels-of-a-string', 'reverse-string-ii', 'reverse-only-letters', 'find-the-original-typed-string-i', 'find-the-original-typed-string-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string finalString(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String finalString(String s) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":... | "string" | {
"name": "finalString",
"params": [
{
"name": "s",
"type": "string"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Simulation'] |
2,811 | Check if it is Possible to Split Array | check-if-it-is-possible-to-split-array | <p>You are given an array <code>nums</code> of length <code>n</code> and an integer <code>m</code>. You need to determine if it is possible to split the array into <code>n</code> arrays of size 1 by performing a series of steps.</p>
<p>An array is called <strong>good</strong> if:</p>
<ul>
<li>The length of the array... | Medium | 31.2K | 92.4K | 31,232 | 92,393 | 33.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canSplitArray(vector<int>& nums, int m) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canSplitArray(List<Integer> nums, int m) {\n \n }\n}"}, {"value": "pytho... | [2, 2, 1]
4 | {
"name": "canSplitArray",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "m"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Greedy'] |
2,812 | Find the Safest Path in a Grid | find-the-safest-path-in-a-grid | <p>You are given a <strong>0-indexed</strong> 2D matrix <code>grid</code> of size <code>n x n</code>, where <code>(r, c)</code> represents:</p>
<ul>
<li>A cell containing a thief if <code>grid[r][c] = 1</code></li>
<li>An empty cell if <code>grid[r][c] = 0</code></li>
</ul>
<p>You are initially positioned at cell <... | Medium | 102.3K | 211.6K | 102,290 | 211,626 | 48.3% | ['path-with-minimum-effort'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximumSafenessFactor(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximumSafenessFactor(List<List<Integer>> grid) {\n \n }\n}"}, {"val... | [[1,0,0],[0,0,0],[0,0,1]] | {
"name": "maximumSafenessFactor",
"params": [
{
"name": "grid",
"type": "list<list<integer>>"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Breadth-First Search', 'Union Find', 'Heap (Priority Queue)', 'Matrix'] |
2,813 | Maximum Elegance of a K-Length Subsequence | maximum-elegance-of-a-k-length-subsequence | <p>You are given a <strong>0-indexed</strong> 2D integer array <code>items</code> of length <code>n</code> and an integer <code>k</code>.</p>
<p><code>items[i] = [profit<sub>i</sub>, category<sub>i</sub>]</code>, where <code>profit<sub>i</sub></code> and <code>category<sub>i</sub></code> denote the profit and category... | Hard | 7.4K | 25.2K | 7,409 | 25,197 | 29.4% | ['ipo'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long findMaximumElegance(vector<vector<int>>& items, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long findMaximumElegance(int[][] items, int k) {\n \n }\n}"}... | [[3,2],[5,1],[10,1]]
2 | {
"name": "findMaximumElegance",
"params": [
{
"name": "items",
"type": "integer[][]"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Stack', 'Greedy', 'Sorting', 'Heap (Priority Queue)'] |
2,814 | Minimum Time Takes to Reach Destination Without Drowning | minimum-time-takes-to-reach-destination-without-drowning | null | Hard | 1.3K | 2.3K | 1,270 | 2,300 | 55.2% | [] | [] | Algorithms | null | [["D",".","*"],[".",".","."],[".","S","."]] | {
"name": "minimumSeconds",
"params": [
{
"name": "land",
"type": "list<list<string>>"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Breadth-First Search', 'Matrix'] |
2,815 | Max Pair Sum in an Array | max-pair-sum-in-an-array | <p>You are given an integer array <code>nums</code>. You have to find the <strong>maximum</strong> sum of a pair of numbers from <code>nums</code> such that the <strong>largest digit </strong>in both numbers is equal.</p>
<p>For example, 2373 is made up of three distinct digits: 2, 3, and 7, where 7 is the largest amo... | Easy | 52.3K | 88.9K | 52,262 | 88,859 | 58.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSum(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode": "cla... | [112,131,411] | {
"name": "maxSum",
"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'] |
2,816 | Double a Number Represented as a Linked List | double-a-number-represented-as-a-linked-list | <p>You are given the <code>head</code> of a <strong>non-empty</strong> linked list representing a non-negative integer without leading zeroes.</p>
<p>Return <em>the </em><code>head</code><em> of the linked list after <strong>doubling</strong> it</em>.</p>
<p> </p>
<p><strong class="example">Example 1:</strong></... | Medium | 182.8K | 298.6K | 182,766 | 298,613 | 61.2% | ['add-two-numbers', 'plus-one-linked-list'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "/**\n * Definition for singly-linked list.\n * struct ListNode {\n * int val;\n * ListNode *next;\n * ListNode() : val(0), next(nullptr) {}\n * ListNode(int x) : val(x), next(nullptr) {}\n * ListNode(int x, ListNode *next) : val(x), next(next) {}\n * ... | [1,8,9] | {
"name": "doubleIt",
"params": [
{
"name": "head",
"type": "ListNode"
}
],
"return": {
"type": "ListNode"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Linked List', 'Math', 'Stack'] |
2,817 | Minimum Absolute Difference Between Elements With Constraint | minimum-absolute-difference-between-elements-with-constraint | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and an integer <code>x</code>.</p>
<p>Find the <strong>minimum absolute difference</strong> between two elements in the array that are at least <code>x</code> indices apart.</p>
<p>In other words, find two indices <code>i</code> and <code>j... | Medium | 30K | 89.1K | 30,024 | 89,091 | 33.7% | ['k-diff-pairs-in-an-array', 'find-all-k-distant-indices-in-an-array', 'find-indices-with-index-and-value-difference-i', 'find-indices-with-index-and-value-difference-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minAbsoluteDifference(vector<int>& nums, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minAbsoluteDifference(List<Integer> nums, int x) {\n \n }\n}"}, {"val... | [4,3,2,4]
2 | {
"name": "minAbsoluteDifference",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "x"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Ordered Set'] |
2,818 | Apply Operations to Maximize Score | apply-operations-to-maximize-score | <p>You are given an array <code>nums</code> of <code>n</code> positive integers and an integer <code>k</code>.</p>
<p>Initially, you start with a score of <code>1</code>. You have to maximize your score by applying the following operation at most <code>k</code> times:</p>
<ul>
<li>Choose any <strong>non-empty</stron... | Hard | 73.2K | 134.3K | 73,166 | 134,307 | 54.5% | ['next-greater-element-iv'] | [] | 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(List<Integer> nums, int k) {\n \n }\n}"}, {"value": "python", "te... | [8,3,9,3,8]
2 | {
"name": "maximumScore",
"params": [
{
"name": "nums",
"type": "list<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', 'Math', 'Stack', 'Greedy', 'Sorting', 'Monotonic Stack', 'Number Theory'] |
2,819 | Minimum Relative Loss After Buying Chocolates | minimum-relative-loss-after-buying-chocolates | null | Hard | 494 | 1.2K | 494 | 1,178 | 41.9% | [] | [] | Algorithms | null | [1,9,22,10,19]
[[18,4],[5,2]] | {
"name": "minimumRelativeLosses",
"params": [
{
"name": "prices",
"type": "integer[]"
},
{
"type": "integer[][]",
"name": "queries"
}
],
"return": {
"type": "long[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Sorting', 'Prefix Sum'] |
2,820 | Election Results | election-results | null | Medium | 3.2K | 4.7K | 3,241 | 4,747 | 68.3% | [] | ['Create table if not exists Votes(voter varchar(30), candidate varchar(30))', 'Truncate table Votes', "insert into Votes (voter, candidate) values ('Kathy', NULL)", "insert into Votes (voter, candidate) values ('Charles', 'Ryan')", "insert into Votes (voter, candidate) values ('Charles', 'Christine')", "insert into Vo... | Database | null | {"headers":{"Votes":["voter","candidate"]},"rows":{"Votes":[["Kathy",null],["Charles","Ryan"],["Charles","Christine"],["Charles","Kathy"],["Benjamin","Christine"],["Anthony","Ryan"],["Edward","Ryan"],["Terry",null],["Evelyn","Kathy"],["Arthur","Christine"]]}} | {"mysql": ["Create table if not exists Votes(voter varchar(30), candidate varchar(30))"], "mssql": ["Create table Votes(voter varchar(30),candidate varchar(30))"], "oraclesql": ["Create table Votes(voter varchar(30),candidate varchar(30))"], "database": true, "name": "get_election_results", "pythondata": ["Votes = pd.D... | {"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<... | [] |
2,821 | Delay the Resolution of Each Promise | delay-the-resolution-of-each-promise | null | Medium | 798 | 1.1K | 798 | 1,118 | 71.4% | [] | [] | JavaScript | null | [() => new Promise((resolve) => setTimeout(resolve, 30))]
50 | {
"name": "delayAll",
"params": [
{
"name": "functions",
"type": "string"
},
{
"type": "integer",
"name": "ms"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,822 | Inversion of Object | inversion-of-object | null | Easy | 1.1K | 1.9K | 1,101 | 1,852 | 59.4% | [] | [] | JavaScript | null | {"a": "1","b": "2","c": "3","d": "4" } | {
"name": "invertObject",
"params": [
{
"name": "obj",
"type": "string"
}
],
"return": {
"type": "integer"
},
"languages": [
"typescript",
"javascript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,823 | Deep Object Filter | deep-object-filter | null | Medium | 534 | 964 | 534 | 964 | 55.4% | [] | [] | JavaScript | null | [-5,-4,-3,-2,-1,0,1]
(x) => x > 0 | {
"name": "deepFilter",
"params": [
{
"name": "obj",
"type": "string"
},
{
"type": "string",
"name": "fn"
}
],
"return": {
"type": "integer"
},
"languages": [
"javascript",
"typescript"
],
"manual": true
} | {"javascript": ["JavaScript", "<p><code>Node.js 22.14.0</code>.</p>\r\n\r\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\"http://node.green/\" target=\"_blank\">new ES6 features</a>.</p>\r\n\r\n<p><a href=\"https://lodash.com\" target=\"_blank\">lodash.js</a> library is included by default.</p... | [] |
2,824 | Count Pairs Whose Sum is Less than Target | count-pairs-whose-sum-is-less-than-target | Given a <strong>0-indexed</strong> integer array <code>nums</code> of length <code>n</code> and an integer <code>target</code>, return <em>the number of pairs</em> <code>(i, j)</code> <em>where</em> <code>0 <= i < j < n</code> <em>and</em> <code>nums[i] + nums[j] < target</code>.
<p> </p>
<p><strong cl... | Easy | 204.9K | 234.4K | 204,855 | 234,450 | 87.4% | ['two-sum', 'count-the-number-of-fair-pairs'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countPairs(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countPairs(List<Integer> nums, int target) {\n \n }\n}"}, {"value": "python... | [-1,1,2,3,1]
2 | {
"name": "countPairs",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "target"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Binary Search', 'Sorting'] |
2,825 | Make String a Subsequence Using Cyclic Increments | make-string-a-subsequence-using-cyclic-increments | <p>You are given two <strong>0-indexed</strong> strings <code>str1</code> and <code>str2</code>.</p>
<p>In an operation, you select a <strong>set</strong> of indices in <code>str1</code>, and for each index <code>i</code> in the set, increment <code>str1[i]</code> to the next character <strong>cyclically</strong>. Tha... | Medium | 157K | 239.1K | 156,988 | 239,076 | 65.7% | ['is-subsequence'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canMakeSubsequence(string str1, string str2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canMakeSubsequence(String str1, String str2) {\n \n }\n}"}, {"value... | "abc"
"ad" | {
"name": "canMakeSubsequence",
"params": [
{
"name": "str1",
"type": "string"
},
{
"type": "string",
"name": "str2"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Two Pointers', 'String'] |
2,826 | Sorting Three Groups | sorting-three-groups | <p>You are given an integer array <code>nums</code>. Each element in <code>nums</code> is 1, 2 or 3. In each operation, you can remove an element from <code>nums</code>. Return the <strong>minimum</strong> number of operations to make <code>nums</code> <strong>non-decreasing</strong>.</p>
<p> </p>
<p><strong... | Medium | 22.7K | 54.5K | 22,694 | 54,547 | 41.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumOperations(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumOperations(List<Integer> nums) {\n \n }\n}"}, {"value": "python", "text":... | [2,1,3,2,1] | {
"name": "minimumOperations",
"params": [
{
"name": "nums",
"type": "list<integer>"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Search', 'Dynamic Programming'] |
2,827 | Number of Beautiful Integers in the Range | number-of-beautiful-integers-in-the-range | <p>You are given positive integers <code>low</code>, <code>high</code>, and <code>k</code>.</p>
<p>A number is <strong>beautiful</strong> if it meets both of the following conditions:</p>
<ul>
<li>The count of even digits in the number is equal to the count of odd digits.</li>
<li>The number is divisible by <code>k... | Hard | 10.9K | 56.7K | 10,859 | 56,736 | 19.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfBeautifulIntegers(int low, int high, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfBeautifulIntegers(int low, int high, int k) {\n \n }\n}"}... | 10
20
3 | {
"name": "numberOfBeautifulIntegers",
"params": [
{
"name": "low",
"type": "integer"
},
{
"type": "integer",
"name": "high"
},
{
"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... | ['Math', 'Dynamic Programming'] |
2,828 | Check if a String Is an Acronym of Words | check-if-a-string-is-an-acronym-of-words | <p>Given an array of strings <code>words</code> and a string <code>s</code>, determine if <code>s</code> is an <strong>acronym</strong> of words.</p>
<p>The string <code>s</code> is considered an acronym of <code>words</code> if it can be formed by concatenating the <strong>first</strong> character of each string in <... | Easy | 112.2K | 136K | 112,206 | 135,987 | 82.5% | ['word-abbreviation'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isAcronym(vector<string>& words, string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isAcronym(List<String> words, String s) {\n \n }\n}"}, {"value": "pyt... | ["alice","bob","charlie"]
"abc" | {
"name": "isAcronym",
"params": [
{
"name": "words",
"type": "list<string>"
},
{
"type": "string",
"name": "s"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String'] |
2,829 | Determine the Minimum Sum of a k-avoiding Array | determine-the-minimum-sum-of-a-k-avoiding-array | <p>You are given two integers, <code>n</code> and <code>k</code>.</p>
<p>An array of <strong>distinct</strong> positive integers is called a <b>k-avoiding</b> array if there does not exist any pair of distinct elements that sum to <code>k</code>.</p>
<p>Return <em>the <strong>minimum</strong> possible sum of a k... | Medium | 37.4K | 62.6K | 37,350 | 62,563 | 59.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumSum(int n, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumSum(int n, int k) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCode":... | 5
4 | {
"name": "minimumSum",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Greedy'] |
2,830 | Maximize the Profit as the Salesman | maximize-the-profit-as-the-salesman | <p>You are given an integer <code>n</code> representing the number of houses on a number line, numbered from <code>0</code> to <code>n - 1</code>.</p>
<p>Additionally, you are given a 2D integer array <code>offers</code> where <code>offers[i] = [start<sub>i</sub>, end<sub>i</sub>, gold<sub>i</sub>]</code>, indicating ... | Medium | 24K | 65.3K | 24,011 | 65,279 | 36.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maximizeTheProfit(int n, vector<vector<int>>& offers) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maximizeTheProfit(int n, List<List<Integer>> offers) {\n \n }\n... | 5
[[0,0,1],[0,2,2],[1,3,2]] | {
"name": "maximizeTheProfit",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "list<list<integer>>",
"name": "offers"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Dynamic Programming', 'Sorting'] |
2,831 | Find the Longest Equal Subarray | find-the-longest-equal-subarray | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and an integer <code>k</code>.</p>
<p>A subarray is called <strong>equal</strong> if all of its elements are equal. Note that the empty subarray is an <strong>equal</strong> subarray.</p>
<p>Return <em>the length of the <strong>longest</str... | Medium | 24.7K | 68.9K | 24,692 | 68,933 | 35.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int longestEqualSubarray(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int longestEqualSubarray(List<Integer> nums, int k) {\n \n }\n}"}, {"value... | [1,3,2,3,1,3]
3 | {
"name": "longestEqualSubarray",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Binary Search', 'Sliding Window'] |
2,832 | Maximal Range That Each Element Is Maximum in It | maximal-range-that-each-element-is-maximum-in-it | null | Medium | 5.9K | 7.8K | 5,903 | 7,838 | 75.3% | [] | [] | Algorithms | null | [1,5,4,3,6] | {
"name": "maximumLengthOfRanges",
"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', 'Stack', 'Monotonic Stack'] |
2,833 | Furthest Point From Origin | furthest-point-from-origin | <p>You are given a string <code>moves</code> of length <code>n</code> consisting only of characters <code>'L'</code>, <code>'R'</code>, and <code>'_'</code>. The string represents your movement on a number line starting from the origin <code>0</code>.</p>
<p>In the <code>i<sup>th</sup></code> m... | Easy | 54K | 84.2K | 54,039 | 84,210 | 64.2% | ['robot-return-to-origin'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int furthestDistanceFromOrigin(string moves) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int furthestDistanceFromOrigin(String moves) {\n \n }\n}"}, {"value": "python", ... | "L_RL__R" | {
"name": "furthestDistanceFromOrigin",
"params": [
{
"name": "moves",
"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', 'Counting'] |
2,834 | Find the Minimum Possible Sum of a Beautiful Array | find-the-minimum-possible-sum-of-a-beautiful-array | <p>You are given positive integers <code>n</code> and <code>target</code>.</p>
<p>An array <code>nums</code> is <strong>beautiful</strong> if it meets the following conditions:</p>
<ul>
<li><code>nums.length == n</code>.</li>
<li><code>nums</code> consists of pairwise <strong>distinct</strong> <strong>positive</str... | Medium | 31.3K | 86.8K | 31,326 | 86,820 | 36.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumPossibleSum(int n, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumPossibleSum(int n, int target) {\n \n }\n}"}, {"value": "python", "text"... | 2
3 | {
"name": "minimumPossibleSum",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer",
"name": "target"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Greedy'] |
2,835 | Minimum Operations to Form Subsequence With Target Sum | minimum-operations-to-form-subsequence-with-target-sum | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> consisting of <strong>non-negative</strong> powers of <code>2</code>, and an integer <code>target</code>.</p>
<p>In one operation, you must apply the following changes to the array:</p>
<ul>
<li>Choose any element of the array <code>nums[i]</code>... | Hard | 12.9K | 41.3K | 12,862 | 41,306 | 31.1% | ['number-of-subsequences-that-satisfy-the-given-sum-condition', 'closest-subsequence-sum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(List<Integer> nums, int target) {\n \n }\n}"}, {"value": "... | [1,2,8]
7 | {
"name": "minOperations",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "target"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Bit Manipulation'] |
2,836 | Maximize Value of Function in a Ball Passing Game | maximize-value-of-function-in-a-ball-passing-game | <p>You are given an integer array <code>receiver</code> of length <code>n</code> and an integer <code>k</code>. <code>n</code> players are playing a ball-passing game.</p>
<p>You choose the starting player, <code>i</code>. The game proceeds as follows: player <code>i</code> passes the ball to player <code>receiver[i]<... | Hard | 5.5K | 19.5K | 5,479 | 19,471 | 28.1% | ['jump-game-vi'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long getMaxFunctionValue(vector<int>& receiver, long long k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long getMaxFunctionValue(List<Integer> receiver, long k) {\n \... | [2,0,1]
4 | {
"name": "getMaxFunctionValue",
"params": [
{
"name": "receiver",
"type": "list<integer>"
},
{
"type": "long",
"name": "k"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Bit Manipulation'] |
2,837 | Total Traveled Distance | total-traveled-distance | null | Easy | 4.3K | 5.5K | 4,276 | 5,529 | 77.3% | [] | ['Create table if not exists Users(user_id int, name varchar(30))', 'Create table if not exists Rides(ride_id int,user_id int, distance int)', 'Truncate table Users', "insert into Users (user_id, name) values ('17', 'Addison')", "insert into Users (user_id, name) values ('14', 'Ethan')", "insert into Users (user_id, na... | Database | null | {"headers":{"Users":["user_id","name"],"Rides":["ride_id","user_id","distance"]},"rows":{"Users":[[17,"Addison"],[14,"Ethan"],[4,"Michael"],[2,"Avery"],[10,"Eleanor"]],"Rides":[[72,17,160],[42,14,161],[45,4,59],[32,2,197],[15,4,357],[56,2,196],[10,14,25]]}} | {"mysql": ["Create table if not exists Users(user_id int, name varchar(30))", "Create table if not exists Rides(ride_id int,user_id int, distance int)"], "mssql": ["Create table Users(user_id int, name varchar(30))", "Create table Rides(ride_id int,user_id int, distance int)"], "oraclesql": ["Create table Users(user_id... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
2,838 | Maximum Coins Heroes Can Collect | maximum-coins-heroes-can-collect | null | Medium | 6.6K | 9.7K | 6,631 | 9,675 | 68.5% | [] | [] | Algorithms | null | [1,4,2]
[1,1,5,2,3]
[2,3,4,5,6] | {
"name": "maximumCoins",
"params": [
{
"name": "heroes",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "monsters"
},
{
"type": "integer[]",
"name": "coins"
}
],
"return": {
"type": "long[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Two Pointers', 'Binary Search', 'Sorting', 'Prefix Sum'] |
2,839 | Check if Strings Can be Made Equal With Operations I | check-if-strings-can-be-made-equal-with-operations-i | <p>You are given two strings <code>s1</code> and <code>s2</code>, both of length <code>4</code>, consisting of <strong>lowercase</strong> English letters.</p>
<p>You can apply the following operation on any of the two strings <strong>any</strong> number of times:</p>
<ul>
<li>Choose any two indices <code>i</code> an... | Easy | 41.4K | 88.3K | 41,435 | 88,303 | 46.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool canBeEqual(string s1, string s2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean canBeEqual(String s1, String s2) {\n \n }\n}"}, {"value": "python", "text": "Py... | "abcd"
"cdab" | {
"name": "canBeEqual",
"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... | ['String'] |
2,840 | Check if Strings Can be Made Equal With Operations II | check-if-strings-can-be-made-equal-with-operations-ii | <p>You are given two strings <code>s1</code> and <code>s2</code>, both of length <code>n</code>, consisting of <strong>lowercase</strong> English letters.</p>
<p>You can apply the following operation on <strong>any</strong> of the two strings <strong>any</strong> number of times:</p>
<ul>
<li>Choose any two indices ... | Medium | 28.9K | 52.6K | 28,925 | 52,599 | 55.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool checkStrings(string s1, string s2) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean checkStrings(String s1, String s2) {\n \n }\n}"}, {"value": "python", "text":... | "abcdba"
"cabdab" | {
"name": "checkStrings",
"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', 'Sorting'] |
2,841 | Maximum Sum of Almost Unique Subarray | maximum-sum-of-almost-unique-subarray | <p>You are given an integer array <code>nums</code> and two positive integers <code>m</code> and <code>k</code>.</p>
<p>Return <em>the <strong>maximum sum</strong> out of all <strong>almost unique</strong> subarrays of length </em><code>k</code><em> of</em> <code>nums</code>. If no such subarray exists, return <code>0... | Medium | 29.2K | 74.9K | 29,170 | 74,929 | 38.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maxSum(vector<int>& nums, int m, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maxSum(List<Integer> nums, int m, int k) {\n \n }\n}"}, {"value": "pyt... | [2,6,7,3,1,7]
3
4 | {
"name": "maxSum",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "m"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sliding Window'] |
2,842 | Count K-Subsequences of a String With Maximum Beauty | count-k-subsequences-of-a-string-with-maximum-beauty | <p>You are given a string <code>s</code> and an integer <code>k</code>.</p>
<p>A <strong>k-subsequence</strong> is a <strong>subsequence</strong> of <code>s</code>, having length <code>k</code>, and all its characters are <strong>unique</strong>, <strong>i.e</strong>., every character occurs once.</p>
<p>Let <code>f(... | Hard | 13.7K | 46.4K | 13,659 | 46,443 | 29.4% | ['distinct-subsequences-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countKSubsequencesWithMaxBeauty(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countKSubsequencesWithMaxBeauty(String s, int k) {\n \n }\n}"}, {"va... | "bcca"
2 | {
"name": "countKSubsequencesWithMaxBeauty",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Hash Table', 'Math', 'String', 'Greedy', 'Combinatorics'] |
2,843 | Count Symmetric Integers | count-symmetric-integers | <p>You are given two positive integers <code>low</code> and <code>high</code>.</p>
<p>An integer <code>x</code> consisting of <code>2 * n</code> digits is <strong>symmetric</strong> if the sum of the first <code>n</code> digits of <code>x</code> is equal to the sum of the last <code>n</code> digits of <code>x</code>. ... | Easy | 167.2K | 201.4K | 167,231 | 201,432 | 83.0% | ['palindrome-number', 'sum-of-digits-in-base-k'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSymmetricIntegers(int low, int high) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSymmetricIntegers(int low, int high) {\n \n }\n}"}, {"value": "python"... | 1
100 | {
"name": "countSymmetricIntegers",
"params": [
{
"name": "low",
"type": "integer"
},
{
"type": "integer",
"name": "high"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Enumeration'] |
2,844 | Minimum Operations to Make a Special Number | minimum-operations-to-make-a-special-number | <p>You are given a <strong>0-indexed</strong> string <code>num</code> representing a non-negative integer.</p>
<p>In one operation, you can pick any digit of <code>num</code> and delete it. Note that if you delete all the digits of <code>num</code>, <code>num</code> becomes <code>0</code>.</p>
<p>Return <em>the <stro... | Medium | 27.6K | 72.8K | 27,587 | 72,750 | 37.9% | ['remove-k-digits', 'remove-digit-from-number-to-maximize-result'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumOperations(string num) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumOperations(String num) {\n \n }\n}"}, {"value": "python", "text": "Python", "def... | "2245047" | {
"name": "minimumOperations",
"params": [
{
"name": "num",
"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', 'Greedy', 'Enumeration'] |
2,845 | Count of Interesting Subarrays | count-of-interesting-subarrays | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>, an integer <code>modulo</code>, and an integer <code>k</code>.</p>
<p>Your task is to find the count of subarrays that are <strong>interesting</strong>.</p>
<p>A <strong>subarray</strong> <code>nums[l..r]</code> is <strong>interesting</str... | Medium | 15.9K | 44.8K | 15,930 | 44,847 | 35.5% | ['subarray-sums-divisible-by-k', 'count-number-of-nice-subarrays'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countInterestingSubarrays(vector<int>& nums, int modulo, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countInterestingSubarrays(List<Integer> nums, int modulo... | [3,2,4]
2
1 | {
"name": "countInterestingSubarrays",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "modulo"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Prefix Sum'] |
2,846 | Minimum Edge Weight Equilibrium Queries in a Tree | minimum-edge-weight-equilibrium-queries-in-a-tree | <p>There is an undirected tree with <code>n</code> nodes labeled from <code>0</code> to <code>n - 1</code>. You are given the integer <code>n</code> and a 2D integer array <code>edges</code> of length <code>n - 1</code>, where <code>edges[i] = [u<sub>i</sub>, v<sub>i</sub>, w<sub>i</sub>]</code> indicates that there is... | Hard | 7.2K | 17.2K | 7,204 | 17,165 | 42.0% | ['kth-ancestor-of-a-tree-node', 'minimum-runes-to-add-to-cast-spell'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> minOperationsQueries(int n, vector<vector<int>>& edges, vector<vector<int>>& queries) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] minOperationsQueries(int n, int... | 7
[[0,1,1],[1,2,1],[2,3,1],[3,4,2],[4,5,2],[5,6,2]]
[[0,3],[3,6],[2,6],[0,6]] | {
"name": "minOperationsQueries",
"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', 'Tree', 'Graph', 'Strongly Connected Component'] |
2,847 | Smallest Number With Given Digit Product | smallest-number-with-given-digit-product | null | Medium | 1.2K | 2.7K | 1,183 | 2,736 | 43.2% | ['smallest-divisible-digit-product-i', 'smallest-divisible-digit-product-ii'] | [] | Algorithms | null | 105 | {
"name": "smallestNumber",
"params": [
{
"name": "n",
"type": "long"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Greedy'] |
2,848 | Points That Intersect With Cars | points-that-intersect-with-cars | <p>You are given a <strong>0-indexed</strong> 2D integer array <code>nums</code> representing the coordinates of the cars parking on a number line. For any index <code>i</code>, <code>nums[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> where <code>start<sub>i</sub></code> is the starting point of the <code>i<sup>th</... | Easy | 62.2K | 85.5K | 62,192 | 85,537 | 72.7% | ['merge-intervals', 'meeting-rooms', 'meeting-rooms-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfPoints(vector<vector<int>>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfPoints(List<List<Integer>> nums) {\n \n }\n}"}, {"value": "python",... | [[3,6],[1,5],[4,7]] | {
"name": "numberOfPoints",
"params": [
{
"name": "nums",
"type": "list<list<integer>>"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Prefix Sum'] |
2,849 | Determine if a Cell Is Reachable at a Given Time | determine-if-a-cell-is-reachable-at-a-given-time | <p>You are given four integers <code>sx</code>, <code>sy</code>, <code>fx</code>, <code>fy</code>, and a <strong>non-negative</strong> integer <code>t</code>.</p>
<p>In an infinite 2D grid, you start at the cell <code>(sx, sy)</code>. Each second, you <strong>must</strong> move to any of its adjacent cells.</p>
<p>Re... | Medium | 101.2K | 283.3K | 101,238 | 283,263 | 35.7% | ['reaching-points'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n bool isReachableAtTime(int sx, int sy, int fx, int fy, int t) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public boolean isReachableAtTime(int sx, int sy, int fx, int fy, int t) {\n ... | 2
4
7
7
6 | {
"name": "isReachableAtTime",
"params": [
{
"name": "sx",
"type": "integer"
},
{
"type": "integer",
"name": "sy"
},
{
"type": "integer",
"name": "fx"
},
{
"type": "integer",
"name": "fy"
},
{
"type": "integer",
"name": ... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math'] |
2,850 | Minimum Moves to Spread Stones Over Grid | minimum-moves-to-spread-stones-over-grid | <p>You are given a <strong>0-indexed</strong> 2D integer matrix <code>grid</code> of size <code>3 * 3</code>, representing the number of stones in each cell. The grid contains exactly <code>9</code> stones, and there can be <strong>multiple</strong> stones in a single cell.</p>
<p>In one move, you can move a single st... | Medium | 26.4K | 59.8K | 26,356 | 59,812 | 44.1% | ['minimum-number-of-operations-to-move-all-balls-to-each-box', 'minimum-number-of-operations-to-make-x-and-y-equal'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumMoves(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumMoves(int[][] grid) {\n \n }\n}"}, {"value": "python", "text": "Python... | [[1,1,0],[1,1,1],[1,2,1]] | {
"name": "minimumMoves",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Dynamic Programming', 'Breadth-First Search', 'Matrix'] |
2,851 | String Transformation | string-transformation | <p>You are given two strings <code>s</code> and <code>t</code> of equal length <code>n</code>. You can perform the following operation on the string <code>s</code>:</p>
<ul>
<li>Remove a <strong>suffix</strong> of <code>s</code> of length <code>l</code> where <code>0 < l < n</code> and append it at the start of... | Hard | 5.6K | 19.3K | 5,553 | 19,265 | 28.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int numberOfWays(string s, string t, long long k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int numberOfWays(String s, String t, long k) {\n \n }\n}"}, {"value": "pyth... | "abcd"
"cdab"
2 | {
"name": "numberOfWays",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "string",
"name": "t"
},
{
"type": "long",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'String', 'Dynamic Programming', 'String Matching'] |
2,852 | Sum of Remoteness of All Cells | sum-of-remoteness-of-all-cells | null | Medium | 6.1K | 8.6K | 6,056 | 8,558 | 70.8% | [] | [] | Algorithms | null | [[-1,1,-1],[5,-1,4],[-1,3,-1]] | {
"name": "sumRemoteness",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Depth-First Search', 'Breadth-First Search', 'Union Find', 'Matrix'] |
2,853 | Highest Salaries Difference | highest-salaries-difference | null | Easy | 4.5K | 6.1K | 4,485 | 6,053 | 74.1% | [] | ['Create table if not exists Salaries(emp_name varchar(30), department varchar(30),salary int)', 'Truncate table Salaries', "insert into Salaries (emp_name, department, salary) values ('Kathy', 'Engineering', '50000')", "insert into Salaries (emp_name, department, salary) values ('Roy', 'Marketing', '30000')", "insert ... | Database | null | {"headers": {"Salaries": ["emp_name", "department", "salary"]},"rows": {"Salaries": [["Kathy","Engineering",50000],["Roy","Marketing",30000],["Charles","Engineering",45000],["Jack","Engineering",85000],["Benjamin","Marketing",34000],["Anthony","Marketing",42000],["Edward","Engineering",102000],["Terry","Engineering",4... | {"mysql": ["Create table if not exists Salaries(emp_name varchar(30), department varchar(30),salary int)"], "mssql": ["Create table Salaries(emp_name varchar(30), department varchar(30),salary int)"], "oraclesql": ["Create table Salaries(emp_name varchar(30), department varchar(30),salary int)"], "database": true, "nam... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"], "pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"], "postgresql": ["PostgreSQL", "<p>PostgreSQL 16<... | ['Database'] |
2,854 | Rolling Average Steps | rolling-average-steps | null | Medium | 3.6K | 5.1K | 3,598 | 5,136 | 70.1% | [] | ['Create table if not exists Steps(user_id int, steps_count int, steps_date date)', 'Truncate table Steps', "insert into Steps (user_id, steps_count, steps_date) values ('1', '687', '2021-09-02')", "insert into Steps (user_id, steps_count, steps_date) values ('1', '395', '2021-09-04')", "insert into Steps (user_id, ste... | Database | null | {"headers": {"Steps": ["user_id", "steps_count", "steps_date"]}, "rows": {"Steps": [[1,687,"2021-09-02"],[1,395,"2021-09-04"],[1,499,"2021-09-05"],[1,712,"2021-09-06"],[1,576,"2021-09-07"],[2,153,"2021-09-06"],[2,171,"2021-09-07"],[2,530,"2021-09-08"],[3,945,"2021-09-04"],[3,120,"2021-09-07"],[3,557,"2021-09-08"],[3,84... | {"mysql": ["Create table if not exists Steps(user_id int, steps_count int, steps_date date)"], "mssql": ["Create table Steps(user_id int, steps_count int, steps_date date)"], "oraclesql": ["Create table Steps(user_id int, steps_count int, steps_date date)", "ALTER SESSION SET nls_date_format='YYYY-MM-DD'"], "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'] |
2,855 | Minimum Right Shifts to Sort the Array | minimum-right-shifts-to-sort-the-array | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> of length <code>n</code> containing <strong>distinct</strong> positive integers. Return <em>the <strong>minimum</strong> number of <strong>right shifts</strong> required to sort </em><code>nums</code><em> and </em><code>-1</code><em> if this is not p... | Easy | 38.4K | 68.1K | 38,430 | 68,095 | 56.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumRightShifts(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumRightShifts(List<Integer> nums) {\n \n }\n}"}, {"value": "python", "text... | [3,4,5,1,2] | {
"name": "minimumRightShifts",
"params": [
{
"name": "nums",
"type": "list<integer>"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array'] |
2,856 | Minimum Array Length After Pair Removals | minimum-array-length-after-pair-removals | <p>Given an integer array <code>num</code> sorted in non-decreasing order.</p>
<p>You can perform the following operation any number of times:</p>
<ul>
<li>Choose <strong>two</strong> indices, <code>i</code> and <code>j</code>, where <code>nums[i] < nums[j]</code>.</li>
<li>Then, remove the elements at indices <... | Medium | 27.4K | 111.3K | 27,365 | 111,296 | 24.6% | ['find-the-maximum-number-of-marked-indices'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minLengthAfterRemovals(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minLengthAfterRemovals(List<Integer> nums) {\n \n }\n}"}, {"value": "python... | [1,2,3,4] | {
"name": "minLengthAfterRemovals",
"params": [
{
"name": "nums",
"type": "list<integer>"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Two Pointers', 'Binary Search', 'Greedy', 'Counting'] |
2,857 | Count Pairs of Points With Distance k | count-pairs-of-points-with-distance-k | <p>You are given a <strong>2D</strong> integer array <code>coordinates</code> and an integer <code>k</code>, where <code>coordinates[i] = [x<sub>i</sub>, y<sub>i</sub>]</code> are the coordinates of the <code>i<sup>th</sup></code> point in a 2D plane.</p>
<p>We define the <strong>distance</strong> between two points <... | Medium | 12.1K | 37.9K | 12,111 | 37,948 | 31.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countPairs(vector<vector<int>>& coordinates, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countPairs(List<List<Integer>> coordinates, int k) {\n \n }\n}"},... | [[1,2],[4,2],[1,3],[5,2]]
5 | {
"name": "countPairs",
"params": [
{
"name": "coordinates",
"type": "list<list<integer>>"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Bit Manipulation'] |
2,858 | Minimum Edge Reversals So Every Node Is Reachable | minimum-edge-reversals-so-every-node-is-reachable | <p>There is a <strong>simple directed graph</strong> with <code>n</code> nodes labeled from <code>0</code> to <code>n - 1</code>. The graph would form a <strong>tree</strong> if its edges were bi-directional.</p>
<p>You are given an integer <code>n</code> and a <strong>2D</strong> integer array <code>edges</code>, whe... | Hard | 10.5K | 19K | 10,526 | 19,039 | 55.3% | ['reorder-routes-to-make-all-paths-lead-to-the-city-zero'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> minEdgeReversals(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] minEdgeReversals(int n, int[][] edges) {\n \n }\n}"}, {... | 4
[[2,0],[2,1],[1,3]] | {
"name": "minEdgeReversals",
"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', 'Depth-First Search', 'Breadth-First Search', 'Graph'] |
2,859 | Sum of Values at Indices With K Set Bits | sum-of-values-at-indices-with-k-set-bits | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and an integer <code>k</code>.</p>
<p>Return <em>an integer that denotes the <strong>sum</strong> of elements in </em><code>nums</code><em> whose corresponding <strong>indices</strong> have <strong>exactly</strong> </em><code>k</code><em> se... | Easy | 83.1K | 97.1K | 83,136 | 97,113 | 85.6% | ['counting-bits', 'find-the-k-or-of-an-array'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int sumIndicesWithKSetBits(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int sumIndicesWithKSetBits(List<Integer> nums, int k) {\n \n }\n}"}, {"v... | [5,10,1,5,2]
1 | {
"name": "sumIndicesWithKSetBits",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Bit Manipulation'] |
2,860 | Happy Students | happy-students | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> of length <code>n</code> where <code>n</code> is the total number of students in the class. The class teacher tries to select a group of students so that all the students remain happy.</p>
<p>The <code>i<sup>th</sup></code> student will beco... | Medium | 23.5K | 47K | 23,508 | 46,994 | 50.0% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countWays(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countWays(List<Integer> nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa... | [1,1] | {
"name": "countWays",
"params": [
{
"name": "nums",
"type": "list<integer>"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Sorting', 'Enumeration'] |
2,861 | Maximum Number of Alloys | maximum-number-of-alloys | <p>You are the owner of a company that creates alloys using various types of metals. There are <code>n</code> different types of metals available, and you have access to <code>k</code> machines that can be used to create alloys. Each machine requires a specific amount of each metal type to create an alloy.</p>
<p>For ... | Medium | 16.2K | 41.9K | 16,158 | 41,932 | 38.5% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxNumberOfAlloys(int n, int k, int budget, vector<vector<int>>& composition, vector<int>& stock, vector<int>& cost) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxNumberO... | 3
2
15
[[1,1,1],[1,1,10]]
[0,0,0]
[1,2,3] | {
"name": "maxNumberOfAlloys",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer",
"name": "k"
},
{
"type": "integer",
"name": "budget"
},
{
"type": "list<list<integer>>",
"name": "composition"
},
{
"type": "l... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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'] |
2,862 | Maximum Element-Sum of a Complete Subset of Indices | maximum-element-sum-of-a-complete-subset-of-indices | <p>You are given a <strong>1</strong><strong>-indexed</strong> array <code>nums</code>. Your task is to select a <strong>complete subset</strong> from <code>nums</code> where every pair of selected indices multiplied is a <span data-keyword="perfect-square">perfect square,</span>. i. e. if you select <code>a<sub>i</sub... | Hard | 8.5K | 20.6K | 8,487 | 20,563 | 41.3% | ['constrained-subsequence-sum', 'maximum-alternating-subsequence-sum'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumSum(List<Integer> nums) {\n \n }\n}"}, {"value": "python", "text": "Pytho... | [8,7,3,5,7,2,4,9] | {
"name": "maximumSum",
"params": [
{
"name": "nums",
"type": "list<integer>"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Number Theory'] |
2,863 | Maximum Length of Semi-Decreasing Subarrays | maximum-length-of-semi-decreasing-subarrays | null | Medium | 13.7K | 19.6K | 13,726 | 19,587 | 70.1% | [] | [] | Algorithms | null | [7,6,5,4,3,2,1,6,10,11] | {
"name": "maxSubarrayLength",
"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', 'Stack', 'Sorting', 'Monotonic Stack'] |
2,864 | Maximum Odd Binary Number | maximum-odd-binary-number | <p>You are given a <strong>binary</strong> string <code>s</code> that contains at least one <code>'1'</code>.</p>
<p>You have to <strong>rearrange</strong> the bits in such a way that the resulting binary number is the <strong>maximum odd binary number</strong> that can be created from this combination.</p>
<... | Easy | 216.7K | 262.2K | 216,735 | 262,248 | 82.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string maximumOddBinaryNumber(string s) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String maximumOddBinaryNumber(String s) {\n \n }\n}"}, {"value": "python", "text": "P... | "010" | {
"name": "maximumOddBinaryNumber",
"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... | ['Math', 'String', 'Greedy'] |
2,865 | Beautiful Towers I | beautiful-towers-i | <p>You are given an array <code>heights</code> of <code>n</code> integers representing the number of bricks in <code>n</code> consecutive towers. Your task is to remove some bricks to form a <strong>mountain-shaped</strong> tower arrangement. In this arrangement, the tower heights are non-decreasing, reaching a maximum... | Medium | 28.8K | 66.8K | 28,797 | 66,771 | 43.1% | ['valid-mountain-array', 'minimum-number-of-removals-to-make-mountain-array', 'maximum-number-of-books-you-can-take'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumSumOfHeights(vector<int>& heights) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumSumOfHeights(int[] heights) {\n \n }\n}"}, {"value": "python"... | [5,3,4,1,1] | {
"name": "maximumSumOfHeights",
"params": [
{
"name": "heights",
"type": "integer[]"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Stack', 'Monotonic Stack'] |
2,866 | Beautiful Towers II | beautiful-towers-ii | <p>You are given a <strong>0-indexed</strong> array <code>maxHeights</code> of <code>n</code> integers.</p>
<p>You are tasked with building <code>n</code> towers in the coordinate line. The <code>i<sup>th</sup></code> tower is built at coordinate <code>i</code> and has a height of <code>heights[i]</code>.</p>
<p>A co... | Medium | 15.3K | 44.7K | 15,262 | 44,701 | 34.1% | ['minimum-number-of-removals-to-make-mountain-array', 'maximum-number-of-books-you-can-take'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumSumOfHeights(vector<int>& maxHeights) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumSumOfHeights(List<Integer> maxHeights) {\n \n }\n}"}, {"va... | [5,3,4,1,1] | {
"name": "maximumSumOfHeights",
"params": [
{
"name": "maxHeights",
"type": "list<integer>"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Stack', 'Monotonic Stack'] |
2,867 | Count Valid Paths in a Tree | count-valid-paths-in-a-tree | <p>There is an undirected tree with <code>n</code> nodes labeled from <code>1</code> to <code>n</code>. You are given the integer <code>n</code> and a 2D integer array <code>edges</code> of length <code>n - 1</code>, where <code>edges[i] = [u<sub>i</sub>, v<sub>i</sub>]</code> indicates that there is an edge between no... | Hard | 8K | 23.3K | 7,987 | 23,318 | 34.3% | ['count-paths-that-can-form-a-palindrome-in-a-tree'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long countPaths(int n, vector<vector<int>>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long countPaths(int n, int[][] edges) {\n \n }\n}"}, {"value": "pytho... | 5
[[1,2],[1,3],[2,4],[2,5]] | {
"name": "countPaths",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "edges"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Math', 'Dynamic Programming', 'Tree', 'Depth-First Search', 'Number Theory'] |
2,868 | The Wording Game | the-wording-game | null | Hard | 567 | 1.1K | 567 | 1,059 | 53.5% | [] | [] | Algorithms | null | ["avokado","dabar"]
["brazil"] | {
"name": "canAliceWin",
"params": [
{
"name": "a",
"type": "string[]"
},
{
"type": "string[]",
"name": "b"
}
],
"return": {
"type": "boolean"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Math', 'Two Pointers', 'String', 'Greedy', 'Game Theory'] |
2,869 | Minimum Operations to Collect Elements | minimum-operations-to-collect-elements | <p>You are given an array <code>nums</code> of positive integers and an integer <code>k</code>.</p>
<p>In one operation, you can remove the last element of the array and add it to your collection.</p>
<p>Return <em>the <strong>minimum number of operations</strong> needed to collect elements</em> <code>1, 2, ..., k</c... | Easy | 41.6K | 68.7K | 41,595 | 68,715 | 60.5% | ['build-an-array-with-stack-operations'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(List<Integer> nums, int k) {\n \n }\n}"}, {"value": "python", "... | [3,1,5,4,2]
2 | {
"name": "minOperations",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Bit Manipulation'] |
2,870 | Minimum Number of Operations to Make Array Empty | minimum-number-of-operations-to-make-array-empty | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> consisting of positive integers.</p>
<p>There are two types of operations that you can apply on the array <strong>any</strong> number of times:</p>
<ul>
<li>Choose <strong>two</strong> elements with <strong>equal</strong> values and <strong>delete... | Medium | 189.8K | 307.2K | 189,796 | 307,160 | 61.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defa... | [2,3,3,2,2,4,2,3,4] | {
"name": "minOperations",
"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', 'Greedy', 'Counting'] |
2,871 | Split Array Into Maximum Number of Subarrays | split-array-into-maximum-number-of-subarrays | <p>You are given an array <code>nums</code> consisting of <strong>non-negative</strong> integers.</p>
<p>We define the score of subarray <code>nums[l..r]</code> such that <code>l <= r</code> as <code>nums[l] AND nums[l + 1] AND ... AND nums[r]</code> where <strong>AND</strong> is the bitwise <code>AND</code> operat... | Medium | 17.5K | 42.3K | 17,510 | 42,319 | 41.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSubarrays(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSubarrays(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaul... | [1,0,2,0,1,2] | {
"name": "maxSubarrays",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Bit Manipulation'] |
2,872 | Maximum Number of K-Divisible Components | maximum-number-of-k-divisible-components | <p>There is an undirected tree with <code>n</code> nodes labeled from <code>0</code> to <code>n - 1</code>. You are given the integer <code>n</code> and a 2D integer array <code>edges</code> of length <code>n - 1</code>, where <code>edges[i] = [a<sub>i</sub>, b<sub>i</sub>]</code> indicates that there is an edge betwee... | Hard | 81.7K | 117.1K | 81,736 | 117,123 | 69.8% | ['create-components-with-same-value'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxKDivisibleComponents(int n, vector<vector<int>>& edges, vector<int>& values, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxKDivisibleComponents(int n, int[][] e... | 5
[[0,2],[1,2],[1,3],[2,4]]
[1,8,1,4,4]
6 | {
"name": "maxKDivisibleComponents",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer[][]",
"name": "edges"
},
{
"type": "integer[]",
"name": "values"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type"... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Tree', 'Depth-First Search'] |
2,873 | Maximum Value of an Ordered Triplet I | maximum-value-of-an-ordered-triplet-i | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>.</p>
<p>Return <em><strong>the maximum value over all triplets of indices</strong></em> <code>(i, j, k)</code> <em>such that</em> <code>i < j < k</code>. If all such triplets have a negative value, return <code>0</code>.</p>
<p>The <s... | Easy | 188.9K | 323.9K | 188,890 | 323,885 | 58.3% | ['number-of-arithmetic-triplets', 'minimum-sum-of-mountain-triplets-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumTripletValue(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumTripletValue(int[] nums) {\n \n }\n}"}, {"value": "python", "tex... | [12,6,1,2,7] | {
"name": "maximumTripletValue",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array'] |
2,874 | Maximum Value of an Ordered Triplet II | maximum-value-of-an-ordered-triplet-ii | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code>.</p>
<p>Return <em><strong>the maximum value over all triplets of indices</strong></em> <code>(i, j, k)</code> <em>such that</em> <code>i < j < k</code><em>. </em>If all such triplets have a negative value, return <code>0</code>.</p>
... | Medium | 148.4K | 261.2K | 148,439 | 261,186 | 56.8% | ['trapping-rain-water', 'sum-of-beauty-in-the-array', 'minimum-sum-of-mountain-triplets-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n long long maximumTripletValue(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public long maximumTripletValue(int[] nums) {\n \n }\n}"}, {"value": "python", "tex... | [12,6,1,2,7] | {
"name": "maximumTripletValue",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array'] |
2,875 | Minimum Size Subarray in Infinite Array | minimum-size-subarray-in-infinite-array | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> and an integer <code>target</code>.</p>
<p>A <strong>0-indexed</strong> array <code>infinite_nums</code> is generated by infinitely appending the elements of <code>nums</code> to itself.</p>
<p>Return <em>the length of the <strong>shortest</strong>... | Medium | 21.9K | 70.6K | 21,850 | 70,601 | 30.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minSizeSubarray(vector<int>& nums, int target) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minSizeSubarray(int[] nums, int target) {\n \n }\n}"}, {"value": "pyth... | [1,2,3]
5 | {
"name": "minSizeSubarray",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "target"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Sliding Window', 'Prefix Sum'] |
2,876 | Count Visited Nodes in a Directed Graph | count-visited-nodes-in-a-directed-graph | <p>There is a <strong>directed</strong> graph consisting of <code>n</code> nodes numbered from <code>0</code> to <code>n - 1</code> and <code>n</code> directed edges.</p>
<p>You are given a <strong>0-indexed</strong> array <code>edges</code> where <code>edges[i]</code> indicates that there is an edge from node <code>i... | Hard | 12K | 38K | 12,005 | 38,036 | 31.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> countVisitedNodes(vector<int>& edges) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] countVisitedNodes(List<Integer> edges) {\n \n }\n}"}, {"value": "pyth... | [1,2,0,0] | {
"name": "countVisitedNodes",
"params": [
{
"name": "edges",
"type": "list<integer>"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Dynamic Programming', 'Graph', 'Memoization'] |
2,877 | Create a DataFrame from List | create-a-dataframe-from-list | <p>Write a solution to <strong>create</strong> a DataFrame from a 2D list called <code>student_data</code>. This 2D list contains the IDs and ages of some students.</p>
<p>The DataFrame should have two columns, <code>student_id</code> and <code>age</code>, and be in the same order as the original 2D list.</p>
<p>The ... | Easy | 203.7K | 250.1K | 203,745 | 250,053 | 81.5% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef createDataframe(student_data: List[List[int]]) -> pd.DataFrame:\n "}] | [[1,15],[2,11],[3,11],[4,20]] | {
"name": "create_a_dataframe",
"params": [
{
"name": "student_data",
"type": "list<list<integer>>"
}
],
"return": {
"type": "DataFrame"
},
"data": true,
"manual": true
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,878 | Get the Size of a DataFrame | get-the-size-of-a-dataframe | <pre>
DataFrame <code>players:</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| player_id | int |
| name | object |
| age | int |
| position | object |
| ... | ... |
+-------------+--------+
</pre>
<p>Write a solution to calculate and display the ... | Easy | 158.5K | 186.1K | 158,505 | 186,090 | 85.2% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef getDataframeSize(players: pd.DataFrame) -> List[int]:\n "}] | {"headers":{"players":["player_id","name","age","position","team"]},"rows":{"players":[[846,"Mason",21,"Forward","RealMadrid"],[749,"Riley",30,"Winger","Barcelona"],[155,"Bob",28,"Striker","ManchesterUnited"],[583,"Isabella",32,"Goalkeeper","Liverpool"],[388,"Zachary",24,"Midfielder","BayernMunich"],[883,"Ava",23,"Defe... | {
"pythondata": [
"players = pd.DataFrame([], columns=['player_id', 'name', 'age', 'position', 'team']).astype({'player_id':'Int64', 'name':'object', 'age':'Int64', 'position':'object', 'team':'object'})"
],
"database": true,
"name": "get_size",
"languages": [
"pythondata"
],
"manual": true
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,879 | Display the First Three Rows | display-the-first-three-rows | <pre>
DataFrame: <code>employees</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| employee_id | int |
| name | object |
| department | object |
| salary | int |
+-------------+--------+
</pre>
<p>Write a solution to display the <strong>first <code>3</code> </strong... | Easy | 165.4K | 177.7K | 165,400 | 177,695 | 93.1% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef selectFirstRows(employees: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"employees":["employee_id","name","department","salary"]},"rows":{"employees":[[3,"Bob","Operations",48675],[90,"Alice","Sales",11096],[9,"Tatiana","Engineering",33805],[60,"Annabelle","InformationTechnology",37678],[49,"Jonathan","HumanResources",23793],[43,"Khaled","Administration",40454]]}} | {
"pythondata": [
"employees = pd.DataFrame([], columns=['employee_id', 'name', 'department', 'salary']).astype({'employee_id':'Int64', 'name':'object', 'department':'object', 'salary':'Int64'})"
],
"database": true,
"name": "selectFirstRows",
"languages": [
"pythondata"
]
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,880 | Select Data | select-data | <pre>
DataFrame students
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| student_id | int |
| name | object |
| age | int |
+-------------+--------+
</pre>
<p>Write a solution to select the name and age of the student with <code>student_id = 101</code>.</p>
<p>The r... | Easy | 132.2K | 166.8K | 132,248 | 166,821 | 79.3% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef selectData(students: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"students":["student_id","name","age"]},"rows":{"students":[[101,"Ulysses",13],[53,"William",10],[128,"Henry",6],[3,"Henry",11]]}} | {
"pythondata": [
"students = pd.DataFrame([], columns=['student_id', 'name', 'age']).astype({'student_id':'Int64', 'name':'object', 'age':'Int64'})"
],
"database": true,
"name": "selectData",
"languages": [
"pythondata"
]
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,881 | Create a New Column | create-a-new-column | <pre>
DataFrame <code>employees</code>
+-------------+--------+
| Column Name | Type. |
+-------------+--------+
| name | object |
| salary | int. |
+-------------+--------+
</pre>
<p>A company plans to provide its employees with a bonus.</p>
<p>Write a solution to create a new column name <code>b... | Easy | 123.5K | 136.8K | 123,459 | 136,764 | 90.3% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef createBonusColumn(employees: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"employees":["name","salary"]},"rows":{"employees":[["Piper",4548],["Grace",28150],["Georgia",1103],["Willow",6593],["Finn",74576],["Thomas",24433]]}} | {
"pythondata": [
"employees = pd.DataFrame([], columns=['name', 'salary']).astype({'name':'object', 'salary':'Int64'})"
],
"database": true,
"name": "createBonusColumn",
"languages": [
"pythondata"
]
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,882 | Drop Duplicate Rows | drop-duplicate-rows | <pre>
DataFrame customers
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| customer_id | int |
| name | object |
| email | object |
+-------------+--------+
</pre>
<p>There are some duplicate rows in the DataFrame based on the <code>email</code> column.</p>
<p>Write a solut... | Easy | 111.4K | 130.2K | 111,425 | 130,193 | 85.6% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef dropDuplicateEmails(customers: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"customers":["customer_id","name","email"]},"rows":{"customers":[[1,"Ella","emily@example.com"],[2,"David","michael@example.com"],[3,"Zachary","sarah@example.com"],[4,"Alice","john@example.com"],[5,"Finn","john@example.com"],[6,"Violet","alice@example.com"]]}} | {
"pythondata": [
"customers = pd.DataFrame([], columns=['customer_id', 'name', 'email']).astype({'customer_id':'Int64', 'name':'object', 'email':'object'})"
],
"database": true,
"name": "dropDuplicateEmails",
"languages": [
"pythondata"
]
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,883 | Drop Missing Data | drop-missing-data | <pre>
DataFrame students
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| student_id | int |
| name | object |
| age | int |
+-------------+--------+
</pre>
<p>There are some rows having missing values in the <code>name</code> column.</p>
<p>Write a solution to remove... | Easy | 103.7K | 161.2K | 103,695 | 161,220 | 64.3% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef dropMissingData(students: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"students":["student_id","name","age"]},"rows":{"students":[[32,"Piper",5],[217,null,19],[779,"Georgia",20],[849,"Willow",14]]}} | {
"pythondata": [
"students = pd.DataFrame([], columns=['student_id', 'name', 'age']).astype({'student_id':'Int64', 'name':'object', 'age':'Int64'})"
],
"database": true,
"name": "dropMissingData",
"languages": [
"pythondata"
]
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,884 | Modify Columns | modify-columns | <pre>
DataFrame <code>employees</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| name | object |
| salary | int |
+-------------+--------+
</pre>
<p>A company intends to give its employees a pay rise.</p>
<p>Write a solution to <strong>modify</strong> the <code>salary... | Easy | 112.7K | 121.8K | 112,722 | 121,838 | 92.5% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef modifySalaryColumn(employees: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"employees":["name","salary"]},"rows":{"employees":[["Jack",19666],["Piper",74754],["Mia",62509],["Ulysses",54866]]}} | {
"pythondata": [
"employees = pd.DataFrame([], columns=['name', 'salary']).astype({'name':'object', 'salary':'Int64'})"
],
"database": true,
"name": "modifySalaryColumn",
"languages": [
"pythondata"
]
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,885 | Rename Columns | rename-columns | <pre>
DataFrame <code>students</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| id | int |
| first | object |
| last | object |
| age | int |
+-------------+--------+
</pre>
<p>Write a solution to rename the columns as follows:</p>
<ul>
<li><code... | Easy | 98K | 114.6K | 98,039 | 114,553 | 85.6% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef renameColumns(students: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"students":["id","first","last","age"]},"rows":{"employees":[],"students":[[1,"Mason","King",6],[2,"Ava","Wright",7],[3,"Taylor","Hall",16],[4,"Georgia","Thompson",18],[5,"Thomas","Moore",10]]}} | {
"pythondata": [
"students = pd.DataFrame([], columns=['id', 'first', 'last', 'age']).astype({'id':'Int64', 'first':'object', 'last':'object', 'age':'Int64'})\n"
],
"database": true,
"name": "renameColumns",
"languages": [
"pythondata"
]
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,886 | Change Data Type | change-data-type | <pre>
DataFrame <code>students</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| student_id | int |
| name | object |
| age | int |
| grade | float |
+-------------+--------+
</pre>
<p>Write a solution to correct the errors:</p>
<p>The <code>grade</code> ... | Easy | 95.8K | 109.5K | 95,751 | 109,453 | 87.5% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef changeDatatype(students: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"students":["student_id","name","age","grade"]},"rows":{"students":[[1,"Ava",6,73.0],[2,"Kate",15,87.0]]}} | {
"pythondata": [
"students = pd.DataFrame([], columns=['student_id', 'name', 'age', 'grade']).astype({'student_id':'Int64', 'name':'object', 'age':'Int64', 'grade':'Float64'})"
],
"database": true,
"name": "changeDatatype",
"languages": [
"pythondata"
]
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,887 | Fill Missing Data | fill-missing-data | <pre>
DataFrame <code>products</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| name | object |
| quantity | int |
| price | int |
+-------------+--------+
</pre>
<p>Write a solution to fill in the missing value as <code><strong>0</strong></code> in the <code>qu... | Easy | 91.8K | 127K | 91,807 | 127,030 | 72.3% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef fillMissingValues(products: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"products":["name","quantity","price"]},"rows":{"products":[["Wristwatch",null,135],["WirelessEarbuds",null,821],["GolfClubs",779,9319],["Printer",849,3051]]}} | {
"pythondata": [
"products = pd.DataFrame([], columns=['name', 'quantity', 'price']).astype({'name':'object', 'quantity':'Int64', 'price':'Int64'})"
],
"database": true,
"name": "fillMissingValues",
"languages": [
"pythondata"
]
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,888 | Reshape Data: Concatenate | reshape-data-concatenate | <pre>
DataFrame <code>df1</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| student_id | int |
| name | object |
| age | int |
+-------------+--------+
DataFrame <code>df2</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| student... | Easy | 95.9K | 105.7K | 95,939 | 105,729 | 90.7% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef concatenateTables(df1: pd.DataFrame, df2: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"df1":["student_id","name","age"],"df2":["student_id","name","age"]},"rows":{"df1":[[1,"Mason",8],[2,"Ava",6],[3,"Taylor",15],[4,"Georgia",17]],"df2":[[5,"Leo",7],[6,"Alex",7]]}} | {
"pythondata": [
"df1 = pd.DataFrame([], columns=['student_id', 'name', 'age']).astype({'student_id':'Int64', 'name':'object', 'age':'Int64'})",
"df2 = pd.DataFrame([], columns=['student_id', 'name', 'age']).astype({'student_id':'Int64', 'name':'object', 'age':'Int64'})"
],
"database": true,
"name": "c... | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,889 | Reshape Data: Pivot | reshape-data-pivot | <pre>
DataFrame <code>weather</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| city | object |
| month | object |
| temperature | int |
+-------------+--------+
</pre>
<p>Write a solution to <strong>pivot</strong> the data so that each row represents temperatures for ... | Easy | 81.2K | 97.2K | 81,235 | 97,236 | 83.5% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef pivotTable(weather: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"weather":["city","month","temperature"]},"rows":{"weather":[["Jacksonville","January",13],["Jacksonville","February",23],["Jacksonville","March",38],["Jacksonville","April",5],["Jacksonville","May",34],["ElPaso","January",20],["ElPaso","February",6],["ElPaso","March",26],["ElPaso","April",2],["ElPaso","May... | {
"pythondata": [
"weather = pd.DataFrame([], columns=['city', 'month', 'temperature']).astype({'city':'object', 'month':'object', 'temperature':'Int64'})"
],
"database": true,
"name": "pivot_table",
"languages": [
"pythondata"
],
"manual": true
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,890 | Reshape Data: Melt | reshape-data-melt | <pre>
DataFrame <code>report</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| product | object |
| quarter_1 | int |
| quarter_2 | int |
| quarter_3 | int |
| quarter_4 | int |
+-------------+--------+
</pre>
<p>Write a solution to <strong>reshape</strong> the... | Easy | 76.6K | 88.9K | 76,591 | 88,895 | 86.2% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef meltTable(report: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"report":["product","quarter_1","quarter_2","quarter_3","quarter_4"]},"rows":{"report":[["Umbrella",417,224,379,611],["SleepingBag",800,936,93,875]]}} | {
"pythondata": [
"report = pd.DataFrame([], columns=['product', 'quarter_1', 'quarter_2', 'quarter_3', 'quarter_4']).astype({'product':'object', 'quarter_1':'Int64', 'quarter_2':'Int64', 'quarter_3':'Int64', 'quarter_4':'Int64'})"
],
"database": true,
"name": "meltTable",
"languages": [
"pythondata"
... | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,891 | Method Chaining | method-chaining | <pre>
DataFrame <code>animals</code>
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| name | object |
| species | object |
| age | int |
| weight | int |
+-------------+--------+
</pre>
<p>Write a solution to list the names of animals that weigh <strong>strictl... | Easy | 79.4K | 103.6K | 79,414 | 103,639 | 76.6% | [] | [] | pandas | [{"value": "pythondata", "text": "Pandas", "defaultCode": "import pandas as pd\n\ndef findHeavyAnimals(animals: pd.DataFrame) -> pd.DataFrame:\n "}] | {"headers":{"animals":["name","species","age","weight"]},"rows":{"animals":[["Tatiana","Snake",98,464],["Khaled","Giraffe",50,41],["Alex","Leopard",6,328],["Jonathan","Monkey",45,463],["Stefan","Bear",100,50],["Tommy","Panda",26,349]]}} | {
"pythondata": [
"animals = pd.DataFrame([], columns=['name', 'species', 'age', 'weight']).astype({'name':'object', 'species':'object', 'age':'Int64', 'weight':'Int64'})"
],
"database": true,
"name": "findHeavyAnimals",
"languages": [
"pythondata"
]
} | {"pythondata": ["Pandas", "<p>Python 3.10 with Pandas 2.2.2 and NumPy 1.26.4</p>"]} | [] |
2,892 | Minimizing Array After Replacing Pairs With Their Product | minimizing-array-after-replacing-pairs-with-their-product | null | Medium | 1.4K | 3.5K | 1,366 | 3,480 | 39.3% | [] | [] | Algorithms | null | [2,3,3,7,3,5]
20 | {
"name": "minArrayLength",
"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', 'Greedy'] |
2,893 | Calculate Orders Within Each Interval | calculate-orders-within-each-interval | null | Medium | 3.1K | 4.6K | 3,123 | 4,584 | 68.1% | [] | ['Create table if not exists Orders(minute int, order_count int)', 'Truncate table Orders', "insert into Orders (minute, order_count) values ('1', '0')", "insert into Orders (minute, order_count) values ('2', '2')", "insert into Orders (minute, order_count) values ('3', '4')", "insert into Orders (minute, order_count) ... | Database | null | {"headers": {"Orders": ["minute", "order_count"]}, "rows": {"Orders":[[1,0],[2,2],[3,4],[4,6],[5,1],[6,4],[7,1],[8,2],[9,4],[10,1],[11,4],[12,6]]}} | {"mysql": ["Create table if not exists Orders(minute int, order_count int)"], "mssql": ["Create table Orders(minute int, order_count int)"], "oraclesql": ["Create table Orders(minute int, order_count int)"], "database": true, "name": "calculate_runs", "languages": ["mysql", "mssql", "oraclesql"], "database_schema": {"O... | {"mysql": ["MySQL", "<p><code>MySQL 8.0</code>.</p>"], "mssql": ["MS SQL Server", "<p><code>mssql server 2019</code>.</p>"], "oraclesql": ["Oracle", "<p><code>Oracle Sql 11.2</code>.</p>"]} | ['Database'] |
2,894 | Divisible and Non-divisible Sums Difference | divisible-and-non-divisible-sums-difference | <p>You are given positive integers <code>n</code> and <code>m</code>.</p>
<p>Define two integers as follows:</p>
<ul>
<li><code>num1</code>: The sum of all integers in the range <code>[1, n]</code> (both <strong>inclusive</strong>) that are <strong>not divisible</strong> by <code>m</code>.</li>
<li><code>num2</code... | Easy | 118.3K | 134K | 118,339 | 134,032 | 88.3% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int differenceOfSums(int n, int m) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int differenceOfSums(int n, int m) {\n \n }\n}"}, {"value": "python", "text": "Python", "d... | 10
3 | {
"name": "differenceOfSums",
"params": [
{
"name": "n",
"type": "integer"
},
{
"type": "integer",
"name": "m"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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'] |
2,895 | Minimum Processing Time | minimum-processing-time | <p>You have a certain number of processors, each having 4 cores. The number of tasks to be executed is four times the number of processors. Each task must be assigned to a unique core, and each core can only be used once.</p>
<p>You are given an array <code>processorTime</code> representing the time each processor bec... | Medium | 39K | 56.7K | 39,041 | 56,691 | 68.9% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minProcessingTime(vector<int>& processorTime, vector<int>& tasks) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minProcessingTime(List<Integer> processorTime, List<Integer> ... | [8,10]
[2,2,3,1,8,7,4,5] | {
"name": "minProcessingTime",
"params": [
{
"name": "processorTime",
"type": "list<integer>"
},
{
"type": "list<integer>",
"name": "tasks"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Greedy', 'Sorting'] |
2,896 | Apply Operations to Make Two Strings Equal | apply-operations-to-make-two-strings-equal | <p>You are given two <strong>0-indexed</strong> binary strings <code>s1</code> and <code>s2</code>, both of length <code>n</code>, and a positive integer <code>x</code>.</p>
<p>You can perform any of the following operations on the string <code>s1</code> <strong>any</strong> number of times:</p>
<ul>
<li>Choose two ... | Medium | 13.9K | 51.5K | 13,919 | 51,456 | 27.1% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minOperations(string s1, string s2, int x) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minOperations(String s1, String s2, int x) {\n \n }\n}"}, {"value": "pytho... | "1100011000"
"0101001010"
2 | {
"name": "minOperations",
"params": [
{
"name": "s1",
"type": "string"
},
{
"type": "string",
"name": "s2"
},
{
"type": "integer",
"name": "x"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Dynamic Programming'] |
2,897 | Apply Operations on Array to Maximize Sum of Squares | apply-operations-on-array-to-maximize-sum-of-squares | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and a <strong>positive</strong> integer <code>k</code>.</p>
<p>You can do the following operation on the array <strong>any</strong> number of times:</p>
<ul>
<li>Choose any two distinct indices <code>i</code> and <code>j</code> and <strong... | Hard | 7.6K | 17.6K | 7,552 | 17,562 | 43.0% | ['minimize-or-of-remaining-elements-using-operations'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int maxSum(vector<int>& nums, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int maxSum(List<Integer> nums, int k) {\n \n }\n}"}, {"value": "python", "text": "Python... | [2,6,5,8]
2 | {
"name": "maxSum",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table', 'Greedy', 'Bit Manipulation'] |
2,898 | Maximum Linear Stock Score | maximum-linear-stock-score | null | Medium | 1K | 1.8K | 1,046 | 1,784 | 58.6% | [] | [] | Algorithms | null | [1,5,3,7,8] | {
"name": "maxScore",
"params": [
{
"name": "prices",
"type": "integer[]"
}
],
"return": {
"type": "long"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Hash Table'] |
2,899 | Last Visited Integers | last-visited-integers | <p>Given an integer array <code>nums</code> where <code>nums[i]</code> is either a positive integer or <code>-1</code>. We need to find for each <code>-1</code> the respective positive integer, which we call the last visited integer.</p>
<p>To achieve this goal, let's define two empty arrays: <code>seen</code> and... | Easy | 29.8K | 46.9K | 29,756 | 46,947 | 63.4% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> lastVisitedIntegers(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<Integer> lastVisitedIntegers(int[] nums) {\n \n }\n}"}, {"value": "py... | [1,2,-1,-1,-1] | {
"name": "lastVisitedIntegers",
"params": [
{
"name": "nums",
"type": "integer[]"
}
],
"return": {
"type": "list<integer>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Simulation'] |
2,900 | Longest Unequal Adjacent Groups Subsequence I | longest-unequal-adjacent-groups-subsequence-i | <p>You are given a string array <code>words</code> and a <strong>binary</strong> array <code>groups</code> both of length <code>n</code>, where <code>words[i]</code> is associated with <code>groups[i]</code>.</p>
<p>Your task is to select the <strong>longest alternating</strong> <span data-keyword="subsequence-array">... | Easy | 37.8K | 63.4K | 37,799 | 63,351 | 59.7% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> getLongestSubsequence(vector<string>& words, vector<int>& groups) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> getLongestSubsequence(String[] words, int... | ["c"]
[0] | {
"name": "getLongestSubsequence",
"params": [
{
"type": "string[]",
"name": "words"
},
{
"type": "integer[]",
"name": "groups"
}
],
"return": {
"type": "list<string>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Dynamic Programming', 'Greedy'] |
2,901 | Longest Unequal Adjacent Groups Subsequence II | longest-unequal-adjacent-groups-subsequence-ii | <p>You are given a string array <code>words</code>, and an array <code>groups</code>, both arrays having length <code>n</code>.</p>
<p>The <strong>hamming distance</strong> between two strings of equal length is the number of positions at which the corresponding characters are <strong>different</strong>.</p>
<p>You n... | Medium | 11.8K | 42.6K | 11,827 | 42,587 | 27.8% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<string> getWordsInLongestSubsequence(vector<string>& words, vector<int>& groups) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public List<String> getWordsInLongestSubsequence(Strin... | ["bab","dab","cab"]
[1,2,2] | {
"name": "getWordsInLongestSubsequence",
"params": [
{
"type": "string[]",
"name": "words"
},
{
"type": "integer[]",
"name": "groups"
}
],
"return": {
"type": "list<string>"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'String', 'Dynamic Programming'] |
2,902 | Count of Sub-Multisets With Bounded Sum | count-of-sub-multisets-with-bounded-sum | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> of non-negative integers, and two integers <code>l</code> and <code>r</code>.</p>
<p>Return <em>the <strong>count of sub-multisets</strong> within</em> <code>nums</code> <em>where the sum of elements in each subset falls within the inclusive range o... | Hard | 4.9K | 24.3K | 4,920 | 24,307 | 20.2% | ['coin-change', 'coin-change-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int countSubMultisets(vector<int>& nums, int l, int r) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int countSubMultisets(List<Integer> nums, int l, int r) {\n \n }\n}"},... | [1,2,2,3]
6
6 | {
"name": "countSubMultisets",
"params": [
{
"name": "nums",
"type": "list<integer>"
},
{
"type": "integer",
"name": "l"
},
{
"type": "integer",
"name": "r"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Dynamic Programming', 'Sliding Window'] |
2,903 | Find Indices With Index and Value Difference I | find-indices-with-index-and-value-difference-i | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> having length <code>n</code>, an integer <code>indexDifference</code>, and an integer <code>valueDifference</code>.</p>
<p>Your task is to find <strong>two</strong> indices <code>i</code> and <code>j</code>, both in the range <code>[0, n - 1... | Easy | 46.4K | 76.9K | 46,364 | 76,866 | 60.3% | ['minimum-absolute-difference-between-elements-with-constraint', 'find-indices-with-index-and-value-difference-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findIndices(vector<int>& nums, int indexDifference, int valueDifference) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findIndices(int[] nums, int indexDifference,... | [5,1,4,1]
2
4 | {
"name": "findIndices",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "indexDifference"
},
{
"type": "integer",
"name": "valueDifference"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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'] |
2,904 | Shortest and Lexicographically Smallest Beautiful String | shortest-and-lexicographically-smallest-beautiful-string | <p>You are given a binary string <code>s</code> and a positive integer <code>k</code>.</p>
<p>A substring of <code>s</code> is <strong>beautiful</strong> if the number of <code>1</code>'s in it is exactly <code>k</code>.</p>
<p>Let <code>len</code> be the length of the <strong>shortest</strong> beautiful substrin... | Medium | 28.8K | 72.6K | 28,750 | 72,618 | 39.6% | [] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n string shortestBeautifulSubstring(string s, int k) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public String shortestBeautifulSubstring(String s, int k) {\n \n }\n}"}, {"value"... | "100011001"
3 | {
"name": "shortestBeautifulSubstring",
"params": [
{
"name": "s",
"type": "string"
},
{
"type": "integer",
"name": "k"
}
],
"return": {
"type": "string"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['String', 'Sliding Window'] |
2,905 | Find Indices With Index and Value Difference II | find-indices-with-index-and-value-difference-ii | <p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> having length <code>n</code>, an integer <code>indexDifference</code>, and an integer <code>valueDifference</code>.</p>
<p>Your task is to find <strong>two</strong> indices <code>i</code> and <code>j</code>, both in the range <code>[0, n - 1... | Medium | 20K | 63.4K | 20,025 | 63,352 | 31.6% | ['minimum-absolute-difference-between-elements-with-constraint', 'find-indices-with-index-and-value-difference-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<int> findIndices(vector<int>& nums, int indexDifference, int valueDifference) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[] findIndices(int[] nums, int indexDifference,... | [5,1,4,1]
2
4 | {
"name": "findIndices",
"params": [
{
"name": "nums",
"type": "integer[]"
},
{
"type": "integer",
"name": "indexDifference"
},
{
"type": "integer",
"name": "valueDifference"
}
],
"return": {
"type": "integer[]"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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'] |
2,906 | Construct Product Matrix | construct-product-matrix | <p>Given a <strong>0-indexed</strong> 2D integer matrix <code><font face="monospace">grid</font></code><font face="monospace"> </font>of size <code>n * m</code>, we define a <strong>0-indexed</strong> 2D matrix <code>p</code> of size <code>n * m</code> as the <strong>product</strong> matrix of <code>grid</code> if the ... | Medium | 14.1K | 46K | 14,128 | 46,025 | 30.7% | ['product-of-array-except-self'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n vector<vector<int>> constructProductMatrix(vector<vector<int>>& grid) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int[][] constructProductMatrix(int[][] grid) {\n \n }\n... | [[1,2],[3,4]] | {
"name": "constructProductMatrix",
"params": [
{
"name": "grid",
"type": "integer[][]"
}
],
"return": {
"type": "integer[][]"
},
"languages": [
"cpp",
"java",
"python",
"c",
"csharp",
"javascript",
"ruby",
"swift",
"golang",
"python3",
"sc... | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<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', 'Prefix Sum'] |
2,907 | Maximum Profitable Triplets With Increasing Prices I | maximum-profitable-triplets-with-increasing-prices-i | null | Medium | 1.6K | 2.9K | 1,556 | 2,851 | 54.6% | [] | [] | Algorithms | null | [10,2,3,4]
[100,2,7,10] | {
"name": "maxProfit",
"params": [
{
"name": "prices",
"type": "integer[]"
},
{
"type": "integer[]",
"name": "profits"
}
],
"return": {
"type": "integer"
}
} | {"cpp": ["C++", "<p>Compiled with <code> clang 19 </code> using the latest C++ 23 standard, and <code>libstdc++</code> provided by GCC 14.</p>\r\n\r\n<p>Your code is compiled with level two optimization (<code>-O2</code>). <a href=\"https://github.com/google/sanitizers/wiki/AddressSanitizer\" target=\"_blank\">AddressS... | ['Array', 'Binary Indexed Tree', 'Segment Tree'] |
2,908 | Minimum Sum of Mountain Triplets I | minimum-sum-of-mountain-triplets-i | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> of integers.</p>
<p>A triplet of indices <code>(i, j, k)</code> is a <strong>mountain</strong> if:</p>
<ul>
<li><code>i < j < k</code></li>
<li><code>nums[i] < nums[j]</code> and <code>nums[k] < nums[j]</code></li>
</ul>
<p>Return <e... | Easy | 41.3K | 62.9K | 41,301 | 62,935 | 65.6% | ['3sum', 'number-of-arithmetic-triplets', 'maximum-value-of-an-ordered-triplet-i'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumSum(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod... | [8,6,1,5,3] | {
"name": "minimumSum",
"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'] |
2,909 | Minimum Sum of Mountain Triplets II | minimum-sum-of-mountain-triplets-ii | <p>You are given a <strong>0-indexed</strong> array <code>nums</code> of integers.</p>
<p>A triplet of indices <code>(i, j, k)</code> is a <strong>mountain</strong> if:</p>
<ul>
<li><code>i < j < k</code></li>
<li><code>nums[i] < nums[j]</code> and <code>nums[k] < nums[j]</code></li>
</ul>
<p>Return <e... | Medium | 28.2K | 52.7K | 28,173 | 52,742 | 53.4% | ['3sum', 'maximum-value-of-an-ordered-triplet-ii'] | [] | Algorithms | [{"value": "cpp", "text": "C++", "defaultCode": "class Solution {\npublic:\n int minimumSum(vector<int>& nums) {\n \n }\n};"}, {"value": "java", "text": "Java", "defaultCode": "class Solution {\n public int minimumSum(int[] nums) {\n \n }\n}"}, {"value": "python", "text": "Python", "defaultCod... | [8,6,1,5,3] | {
"name": "minimumSum",
"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'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.