question_id int64 1 3.24k | task_id stringlengths 3 77 | difficulty stringclasses 3
values | problem_description stringlengths 193 3.69k | canonical_tests dict | public_tests listlengths 1 5 | hints listlengths 0 8 | metadata dict | language stringclasses 9
values | interface dict |
|---|---|---|---|---|---|---|---|---|---|
396 | rotate-function | Medium | You are given an integer array nums of length n.
Assume arr_k to be an array obtained by rotating nums by k positions clock-wise. We define the rotation function F on nums as follow:
- F(k) = 0 * arr_k[0] + 1 * arr_k[1] + ... + (n - 1) * arr_k[n - 1].
Return the maximum value of F(0), F(1), ..., F(n-1).
The test ca... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [1, -1, 1, -1, 1]) == 6\n assert candidate(nums = [1, 0, 0, 0, 1]) == 7\n assert candidate(nums = [10, -10, 20, -20]) == 50\n assert candidate(nums = [1, 2... | [
"[4,3,2,6]",
"[100]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().maxRotateFunction",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:47:54",
"tests_total": 89,
"test... | cpp | {
"raw_signature": "int maxRotateFunction(vector<int>& nums) {",
"container": "Solution",
"callable": "maxRotateFunction",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSni... |
397 | integer-replacement | Medium | Given a positive integer n, you can apply one of the following operations:
1. If n is even, replace n with n / 2.
2. If n is odd, replace n with either n + 1 or n - 1.
Return the minimum number of operations needed for n to become 1.
Example 1:
Input: n = 8
Output: 3
Explanation: 8 -> 4 -> 2 -> 1
Example 2:
Input... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 8) == 3\n assert candidate(n = 15) == 5\n assert candidate(n = 4) == 2\n assert candidate(n = 2147483647) == 32\n assert candidate(n = 1) == 0\n assert candidate(n = 1000000000) == 38\n assert candidate(n = 7) == 4\... | [
"8",
"7",
"4"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().integerReplacement",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:47:57",
"tests_total": 37,
"tests_... | cpp | {
"raw_signature": "int integerReplacement(int n) {",
"container": "Solution",
"callable": "integerReplacement",
"parameters": [
{
"name": "n",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
399 | evaluate-division | Medium | You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [A_i, B_i] and values[i] represent the equation A_i / B_i = values[i]. Each A_i or B_i is a string that represents a single variable.
You are also given some queries, where queries[j] = [C_j, D_j] represents th... | {
"language": "python",
"source": "def answers_match(result, expected):\n \"\"\"Decimal answers are accepted within 1e-5 (absolute or relative), as on LeetCode.\"\"\"\n import math\n if isinstance(result, list) and isinstance(expected, list):\n return len(result) == len(expected) and all(answers_mat... | [
"[[\"a\",\"b\"],[\"b\",\"c\"]]\n[2.0,3.0]\n[[\"a\",\"c\"],[\"b\",\"a\"],[\"a\",\"e\"],[\"a\",\"a\"],[\"x\",\"x\"]]",
"[[\"a\",\"b\"],[\"b\",\"c\"],[\"bc\",\"cd\"]]\n[1.5,2.5,5.0]\n[[\"a\",\"c\"],[\"c\",\"b\"],[\"bc\",\"cd\"],[\"cd\",\"bc\"]]",
"[[\"a\",\"b\"]]\n[0.5]\n[[\"a\",\"b\"],[\"b\",\"a\"],[\"a\",\"c\"],... | [
"Do you recognize this as a graph problem?"
] | {
"canonical_parameter_names": [
"equations",
"values",
"queries"
],
"leetcode_dataset_entry_point": "Solution().calcEquation",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:47:59",... | cpp | {
"raw_signature": "vector<double> calcEquation(vector<vector<string>>& equations, vector<double>& values, vector<vector<string>>& queries) {",
"container": "Solution",
"callable": "calcEquation",
"parameters": [
{
"name": "equations",
"type": "vector<vector<string>>&"
},
{
"name":... |
400 | nth-digit | Medium | Given an integer n, return the n^th digit of the infinite integer sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...].
Example 1:
Input: n = 3
Output: 3
Example 2:
Input: n = 11
Output: 0
Explanation: The 11^th digit of the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... is a 0, which is part of the number 10.
Const... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 3) == 3\n assert candidate(n = 11) == 0\n assert candidate(n = 231) == 3\n assert candidate(n = 15) == 2\n assert candidate(n = 2147483647) == 2\n assert candidate(n = 1000000) == 1\n assert candidate(n = 123456789)... | [
"3",
"11"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().findNthDigit",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:01",
"tests_total": 50,
"tests_droppe... | cpp | {
"raw_signature": "int findNthDigit(int n) {",
"container": "Solution",
"callable": "findNthDigit",
"parameters": [
{
"name": "n",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
401 | binary-watch | Easy | A binary watch has 4 LEDs on the top to represent the hours (0-11), and 6 LEDs on the bottom to represent the minutes (0-59). Each LED represents a zero or one, with the least significant bit on the right.
- For example, the below binary watch reads "4:51".
Given an integer turnedOn which represents the number of LED... | {
"language": "python",
"source": "def answers_match(result, expected):\n \"\"\"The answer may list its items in any order (only the top-level order is free).\"\"\"\n if isinstance(result, list) and isinstance(expected, list):\n return sorted(result, key=repr) == sorted(expected, key=repr)\n return ... | [
"1",
"9"
] | [
"Simplify by seeking for solutions that involve comparing set bit counts.",
"Consider precomputing all possible times for comparison."
] | {
"canonical_parameter_names": [
"turnedOn"
],
"leetcode_dataset_entry_point": "Solution().readBinaryWatch",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:03",
"tests_total": 12,
"te... | cpp | {
"raw_signature": "vector<string> readBinaryWatch(int turnedOn) {",
"container": "Solution",
"callable": "readBinaryWatch",
"parameters": [
{
"name": "turnedOn",
"type": "int"
}
],
"return_type": "vector<string>",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode... |
402 | remove-k-digits | Medium | Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num.
Example 1:
Input: num = "1432219", k = 3
Output: "1219"
Explanation: Remove the three digits 4, 3, and 2 to form the new number 1219 which is the smallest.
Example 2:
In... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(num = \"100\",k = 1) == \"0\"\n assert candidate(num = \"999\",k = 2) == \"9\"\n assert candidate(num = \"1234567890\",k = 9) == \"0\"\n assert candidate(num = \"111111\",k = 2) == \"1111\"\n assert candidate(num = \"98765432... | [
"\"1432219\"\n3",
"\"10200\"\n1",
"\"10\"\n2"
] | [] | {
"canonical_parameter_names": [
"num",
"k"
],
"leetcode_dataset_entry_point": "Solution().removeKdigits",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:06",
"tests_total": 111,
... | cpp | {
"raw_signature": "string removeKdigits(string num, int k) {",
"container": "Solution",
"callable": "removeKdigits",
"parameters": [
{
"name": "num",
"type": "string"
},
{
"name": "k",
"type": "int"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSn... |
403 | frog-jump | Hard | A frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exist a stone. The frog can jump on a stone, but it must not jump into the water.
Given a list of stones positions (in units) in sorted ascending order, determine if the frog can cross the river by landin... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(stones = [0, 1, 3, 8, 14, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]) == False\n assert candidate(stones = [0, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == False\n ... | [
"[0,1,3,5,6,8,12,17]",
"[0,1,2,3,4,8,9,11]"
] | [] | {
"canonical_parameter_names": [
"stones"
],
"leetcode_dataset_entry_point": "Solution().canCross",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:08",
"tests_total": 82,
"tests_dropp... | cpp | {
"raw_signature": "bool canCross(vector<int>& stones) {",
"container": "Solution",
"callable": "canCross",
"parameters": [
{
"name": "stones",
"type": "vector<int>&"
}
],
"return_type": "bool",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
405 | convert-a-number-to-hexadecimal | Easy | Given a 32-bit integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement method is used.
All the letters in the answer string should be lowercase characters, and there should not be any leading zeros in the answer except for the zero itself.
Note: You are not al... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(num = 31) == \"1f\"\n assert candidate(num = 10) == \"a\"\n assert candidate(num = 16777215) == \"ffffff\"\n assert candidate(num = -16777215) == \"ff000001\"\n assert candidate(num = -1) == \"ffffffff\"\n assert candidate... | [
"26",
"-1"
] | [] | {
"canonical_parameter_names": [
"num"
],
"leetcode_dataset_entry_point": "Solution().toHex",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:12",
"tests_total": 60,
"tests_dropped": 8... | cpp | {
"raw_signature": "string toHex(int num) {",
"container": "Solution",
"callable": "toHex",
"parameters": [
{
"name": "num",
"type": "int"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
406 | queue-reconstruction-by-height | Medium | You are given an array of people, people, which are the attributes of some people in a queue (not necessarily in order). Each people[i] = [h_i, k_i] represents the i^th person of height h_i with exactly k_i other people in front who have a height greater than or equal to h_i.
Reconstruct and return the queue that is r... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(people = [[9, 0], [7, 0], [5, 0], [6, 1], [3, 2], [2, 2], [1, 4], [8, 1]]) == [[5, 0], [7, 0], [2, 2], [3, 2], [1, 4], [6, 1], [9, 0], [8, 1]]\n assert candidate(people = [[5, 5], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0]]) == [[5, 0], [... | [
"[[7,0],[4,4],[7,1],[5,0],[6,1],[5,2]]",
"[[6,0],[5,0],[4,0],[3,2],[2,2],[1,4]]"
] | [
"What can you say about the position of the shortest person? If the position of the shortest person is i, how many people would be in front of the shortest person?",
"Once you fix the position of the shortest person, what can you say about the position of the second shortest person?"
] | {
"canonical_parameter_names": [
"people"
],
"leetcode_dataset_entry_point": "Solution().reconstructQueue",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:15",
"tests_total": 101,
"te... | cpp | {
"raw_signature": "vector<vector<int>> reconstructQueue(vector<vector<int>>& people) {",
"container": "Solution",
"callable": "reconstructQueue",
"parameters": [
{
"name": "people",
"type": "vector<vector<int>>&"
}
],
"return_type": "vector<vector<int>>",
"signature_source": "leetcode... |
407 | trapping-rain-water-ii | Hard | Given an m x n integer matrix heightMap representing the height of each unit cell in a 2D elevation map, return the volume of water it can trap after raining.
Example 1:
Input: heightMap = [[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]]
Output: 4
Explanation: After the rain, water is trapped between the blocks.
We have t... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(heightMap = [[5, 5, 5, 5, 5], [5, 1, 2, 1, 5], [5, 2, 3, 2, 5], [5, 1, 2, 1, 5], [5, 5, 5, 5, 5]]) == 30\n assert candidate(heightMap = [[1, 2], [2, 1]]) == 0\n assert candidate(heightMap = [[1, 2, 3], [0, 1, 0], [1, 2, 1]]) == 0\n... | [
"[[1,4,3,1,3,2],[3,2,1,3,2,4],[2,3,3,2,3,1]]",
"[[3,3,3,3,3],[3,2,2,2,3],[3,2,1,2,3],[3,2,2,2,3],[3,3,3,3,3]]"
] | [] | {
"canonical_parameter_names": [
"heightMap"
],
"leetcode_dataset_entry_point": "Solution().trapRainWater",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:17",
"tests_total": 78,
"tes... | cpp | {
"raw_signature": "int trapRainWater(vector<vector<int>>& heightMap) {",
"container": "Solution",
"callable": "trapRainWater",
"parameters": [
{
"name": "heightMap",
"type": "vector<vector<int>>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source":... |
409 | longest-palindrome | Easy | Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.
Letters are case sensitive, for example, "Aa" is not considered a palindrome.
Example 1:
Input: s = "abccccdd"
Output: 7
Explanation: One longest palindrome that can be... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"aabbccc\") == 7\n assert candidate(s = \"abccccdd\") == 7\n assert candidate(s = \"zyyzzzzz\") == 8\n assert candidate(s = \"abcdedcba\") == 9\n assert candidate(s = \"aabbbb\") == 6\n assert candidate(s = \"aaaaa\")... | [
"\"abccccdd\"",
"\"a\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().longestPalindrome",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:21",
"tests_total": 68,
"tests_d... | cpp | {
"raw_signature": "int longestPalindrome(string s) {",
"container": "Solution",
"callable": "longestPalindrome",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
410 | split-array-largest-sum | Hard | Given an integer array nums and an integer k, split nums into k non-empty subarrays such that the largest sum of any subarray is minimized.
Return the minimized largest sum of the split.
A subarray is a contiguous part of the array.
Example 1:
Input: nums = [7,2,5,10,8], k = 2
Output: 18
Explanation: There are four... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [7, 2, 5, 10, 8],k = 2) == 18\n assert candidate(nums = [5, 5, 5, 5, 5],k = 5) == 5\n assert candidate(nums = [10, 10, 10, 10],k = 2) == 20\n assert candidate(nums = [10, 5, 13, 4, 8, 4, 5, 11, 14, 9, 15],k = 6) == 23\n ... | [
"[7,2,5,10,8]\n2",
"[1,2,3,4,5]\n2"
] | [] | {
"canonical_parameter_names": [
"nums",
"k"
],
"leetcode_dataset_entry_point": "Solution().splitArray",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:24",
"tests_total": 83,
"te... | cpp | {
"raw_signature": "int splitArray(vector<int>& nums, int k) {",
"container": "Solution",
"callable": "splitArray",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
},
{
"name": "k",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/code... |
412 | fizz-buzz | Easy | Given an integer n, return a string array answer (1-indexed) where:
- answer[i] == "FizzBuzz" if i is divisible by 3 and 5.
- answer[i] == "Fizz" if i is divisible by 3.
- answer[i] == "Buzz" if i is divisible by 5.
- answer[i] == i (as a string) if none of the above conditions are true.
Example 1:
Input: n = 3
Outp... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 3) == ['1', '2', 'Fizz']\n assert candidate(n = 100) == ['1', '2', 'Fizz', '4', 'Buzz', 'Fizz', '7', '8', 'Fizz', 'Buzz', '11', 'Fizz', '13', '14', 'FizzBuzz', '16', '17', 'Fizz', '19', 'Buzz', 'Fizz', '22', '23', 'Fizz', 'Buzz', ... | [
"3",
"5",
"15"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().fizzBuzz",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:28",
"tests_total": 44,
"tests_dropped": ... | cpp | {
"raw_signature": "vector<string> fizzBuzz(int n) {",
"container": "Solution",
"callable": "fizzBuzz",
"parameters": [
{
"name": "n",
"type": "int"
}
],
"return_type": "vector<string>",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
413 | arithmetic-slices | Medium | An integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.
- For example, [1,3,5,7,9], [7,7,7,7], and [3,-1,-5,-9] are arithmetic sequences.
Given an integer array nums, return the number of arithmetic subarrays of nums.
A s... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 36\n assert candidate(nums = [1, 2, 4, 5, 6, 7]) == 3\n assert candidate(nums = [3, -1, -5, -9]) == 3\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 36\n assert candida... | [
"[1,2,3,4]",
"[1]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().numberOfArithmeticSlices",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:31",
"tests_total": 171,... | cpp | {
"raw_signature": "int numberOfArithmeticSlices(vector<int>& nums) {",
"container": "Solution",
"callable": "numberOfArithmeticSlices",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "le... |
414 | third-maximum-number | Easy | You are given an integer array nums.
Return the third distinct maximum number in this array. If the third maximum does not exist, return the maximum number.
Example 1:
Input: nums = [3,2,1]
Output: 1
Explanation:
The first distinct maximum is 3.
The second distinct maximum is 2.
The third distinct maximum is 1.
Exa... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [10, 10, 10, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 8\n assert candidate(nums = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]) == 3\n assert candidate(nums = [1, 2, -2147483648]) == -2147483648\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7,... | [
"[3,2,1]",
"[1,2]",
"[2,2,3,1]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().thirdMax",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:33",
"tests_total": 127,
"tests_droppe... | cpp | {
"raw_signature": "int thirdMax(vector<int>& nums) {",
"container": "Solution",
"callable": "thirdMax",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
415 | add-strings | Easy | Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string.
You must solve the problem without using any built-in library for handling large integers (such as BigInteger). You must also not convert the inputs to integers directly.
Example 1:
Input: num1 = "11", ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(num1 = \"500\",num2 = \"500\") == \"1000\"\n assert candidate(num1 = \"11\",num2 = \"123\") == \"134\"\n assert candidate(num1 = \"1000\",num2 = \"2000\") == \"3000\"\n assert candidate(num1 = \"10000\",num2 = \"20000\") == \"30... | [
"\"11\"\n\"123\"",
"\"456\"\n\"77\"",
"\"0\"\n\"0\""
] | [] | {
"canonical_parameter_names": [
"num1",
"num2"
],
"leetcode_dataset_entry_point": "Solution().addStrings",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:35",
"tests_total": 92,
... | cpp | {
"raw_signature": "string addStrings(string num1, string num2) {",
"container": "Solution",
"callable": "addStrings",
"parameters": [
{
"name": "num1",
"type": "string"
},
{
"name": "num2",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcod... |
416 | partition-equal-subset-sum | Medium | Given an integer array nums, return true if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or false otherwise.
Example 1:
Input: nums = [1,5,11,5]
Output: true
Explanation: The array can be partitioned as [1, 5, 5] and [11].
Example 2:
Input: nums = [1,2,3,5]... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5]) == False\n assert candidate(nums = [1, 5, 11, 5]) == True\n assert candidate(nums = [1, 2, 2, 3]) == True\n assert candidate(nums = [1, 2, 3, 4]) == True\n assert candidate(nums = [2, 2, 3, 3]) =... | [
"[1,5,11,5]",
"[1,2,3,5]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().canPartition",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:38",
"tests_total": 86,
"tests_dro... | cpp | {
"raw_signature": "bool canPartition(vector<int>& nums) {",
"container": "Solution",
"callable": "canPartition",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "bool",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
417 | pacific-atlantic-water-flow | Medium | There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches the island's right and bottom edges.
The island is partitioned into a grid of square cells. You are given an m x n integer matrix height... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(heights = [[1, 2, 3, 4, 5], [2, 2, 2, 2, 2], [1, 2, 3, 4, 5], [5, 4, 3, 2, 1], [1, 2, 3, 4, 5]]) == [(0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (2, 1), (2, 2), (2, 3), (2, 4), (3, 0), (3, 1), (3, 2), (4, 0), ... | [
"[[1,2,2,3,5],[3,2,3,4,4],[2,4,5,3,1],[6,7,1,4,5],[5,1,1,2,4]]",
"[[1]]"
] | [] | {
"canonical_parameter_names": [
"heights"
],
"leetcode_dataset_entry_point": "Solution().pacificAtlantic",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:40",
"tests_total": 62,
"tes... | cpp | {
"raw_signature": "vector<vector<int>> pacificAtlantic(vector<vector<int>>& heights) {",
"container": "Solution",
"callable": "pacificAtlantic",
"parameters": [
{
"name": "heights",
"type": "vector<vector<int>>&"
}
],
"return_type": "vector<vector<int>>",
"signature_source": "leetcode... |
419 | battleships-in-a-board | Medium | You are given an m x n matrix board where each cell is part of a battleship 'X' or empty '.', return the number of the battleships on board.
Battleships can only be placed horizontally or vertically on board. In other words, they can only be made of the shape 1 x k (1 row, k columns) or k x 1 (k rows, 1 column), where... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(board = [['X', '.', '.', 'X'], ['.', '.', '.', 'X'], ['.', '.', '.', 'X']]) == 2\n assert candidate(board = [['X', 'X', 'X'], ['.', '.', '.'], ['X', 'X', 'X']]) == 2\n assert candidate(board = [['.']]) == 0\n assert candidate(bo... | [
"[[\"X\",\".\",\".\",\"X\"],[\".\",\".\",\".\",\"X\"],[\".\",\".\",\".\",\"X\"]]",
"[[\".\"]]"
] | [] | {
"canonical_parameter_names": [
"board"
],
"leetcode_dataset_entry_point": "Solution().countBattleships",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:44",
"tests_total": 101,
"tes... | cpp | {
"raw_signature": "int countBattleships(vector<vector<char>>& board) {",
"container": "Solution",
"callable": "countBattleships",
"parameters": [
{
"name": "board",
"type": "vector<vector<char>>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source":... |
420 | strong-password-checker | Hard | A password is considered strong if the below conditions are all met:
- It has at least 6 characters and at most 20 characters.
- It contains at least one lowercase letter, at least one uppercase letter, and at least one digit.
- It does not contain three repeating characters in a row (i.e., "Baaabb0" is weak, but "Baa... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(password = \"AAAbbb\") == 2\n assert candidate(password = \"aA1\") == 3\n assert candidate(password = \"Aa1234567890\") == 0\n assert candidate(password = \"Aaaaaa1A\") == 1\n assert candidate(password = \"Passwo0rd!!\") == 0... | [
"\"a\"",
"\"aA1\"",
"\"1337C0d3\""
] | [] | {
"canonical_parameter_names": [
"password"
],
"leetcode_dataset_entry_point": "Solution().strongPasswordChecker",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:47",
"tests_total": 174... | cpp | {
"raw_signature": "int strongPasswordChecker(string password) {",
"container": "Solution",
"callable": "strongPasswordChecker",
"parameters": [
{
"name": "password",
"type": "string"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/cod... |
421 | maximum-xor-of-two-numbers-in-an-array | Medium | Given an integer array nums, return the maximum result of nums[i] XOR nums[j], where 0 <= i <= j < n.
Example 1:
Input: nums = [3,10,5,25,2,8]
Output: 28
Explanation: The maximum result is 5 XOR 25 = 28.
Example 2:
Input: nums = [14,70,53,83,49,91,36,80,92,51,66,70]
Output: 127
Constraints:
- 1 <= nums.length <= ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [3, 10, 5, 25, 2, 8]) == 28\n assert candidate(nums = [14, 70, 53, 83, 49, 91, 36, 80, 92, 51, 66, 70]) == 127\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]) == 15\n assert candidate(nums = [1000000000, 2147483647... | [
"[3,10,5,25,2,8]",
"[14,70,53,83,49,91,36,80,92,51,66,70]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().findMaximumXOR",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:49",
"tests_total": 102,
"tests_... | cpp | {
"raw_signature": "int findMaximumXOR(vector<int>& nums) {",
"container": "Solution",
"callable": "findMaximumXOR",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"... |
423 | reconstruct-original-digits-from-english | Medium | Given a string s containing an out-of-order English representation of digits 0-9, return the digits in ascending order.
Example 1:
Input: s = "owoztneoer"
Output: "012"
Example 2:
Input: s = "fviefuro"
Output: "45"
Constraints:
- 1 <= s.length <= 10^5
- s[i] is one of the characters ["e","g","f","i","h","o","n","... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"sevensixfivefourthree\") == \"34567\"\n assert candidate(s = \"fivefivethree\") == \"355\"\n assert candidate(s = \"oneonetwothreefourfivesixseveneightnine\") == \"1123456789\"\n assert candidate(s = \"fivefivesixsix\") ==... | [
"\"owoztneoer\"",
"\"fviefuro\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().originalDigits",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:54",
"tests_total": 185,
"tests_dro... | cpp | {
"raw_signature": "string originalDigits(string s) {",
"container": "Solution",
"callable": "originalDigits",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
424 | longest-repeating-character-replacement | Medium | You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform this operation at most k times.
Return the length of the longest substring containing the same letter you can get after performing the above operations.
Example... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"ABABABAB\",k = 3) == 7\n assert candidate(s = \"AAAAAAAAAAAAABBBAABBCCDDEE\",k = 5) == 20\n assert candidate(s = \"AABBCCDD\",k = 2) == 4\n assert candidate(s = \"A\",k = 1) == 1\n assert candidate(s = \"AABAABBBCCCC\",... | [
"\"ABAB\"\n2",
"\"AABABBA\"\n1"
] | [] | {
"canonical_parameter_names": [
"s",
"k"
],
"leetcode_dataset_entry_point": "Solution().characterReplacement",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:48:56",
"tests_total": 10... | cpp | {
"raw_signature": "int characterReplacement(string s, int k) {",
"container": "Solution",
"callable": "characterReplacement",
"parameters": [
{
"name": "s",
"type": "string"
},
{
"name": "k",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/co... |
433 | minimum-genetic-mutation | Medium | A gene string can be represented by an 8-character long string, with choices from 'A', 'C', 'G', and 'T'.
Suppose we need to investigate a mutation from a gene string startGene to a gene string endGene where one mutation is defined as one single character changed in the gene string.
- For example, "AACCGGTT" --> "AAC... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(startGene = \"AACCGGTT\",endGene = \"AAACGGTA\",bank = ['AACCGGTA', 'AACCGCTA', 'AAACGGTA']) == 2\n assert candidate(startGene = \"AACCGGTT\",endGene = \"AACCGGTA\",bank = ['AACCGGTA']) == 1\n assert candidate(startGene = \"AACCGGT... | [
"\"AACCGGTT\"\n\"AACCGGTA\"\n[\"AACCGGTA\"]",
"\"AACCGGTT\"\n\"AAACGGTA\"\n[\"AACCGGTA\",\"AACCGCTA\",\"AAACGGTA\"]"
] | [] | {
"canonical_parameter_names": [
"startGene",
"endGene",
"bank"
],
"leetcode_dataset_entry_point": "Solution().minMutation",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:01",
... | cpp | {
"raw_signature": "int minMutation(string startGene, string endGene, vector<string>& bank) {",
"container": "Solution",
"callable": "minMutation",
"parameters": [
{
"name": "startGene",
"type": "string"
},
{
"name": "endGene",
"type": "string"
},
{
"name": "ban... |
435 | non-overlapping-intervals | Medium | Given an array of intervals intervals where intervals[i] = [start_i, end_i], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.
Note that intervals which only touch at a point are non-overlapping. For example, [1, 2] and [2, 3] are non-overlapping.
Example 1:
... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(intervals = [[1, 2], [2, 3], [3, 4], [1, 3]]) == 1\n assert candidate(intervals = [[-2, -1], [1, 2], [-1, 1], [2, 3]]) == 0\n assert candidate(intervals = [[1, 5], [2, 3], [4, 6], [7, 8]]) == 1\n assert candidate(intervals = [[1... | [
"[[1,2],[2,3],[3,4],[1,3]]",
"[[1,2],[1,2],[1,2]]",
"[[1,2],[2,3]]"
] | [] | {
"canonical_parameter_names": [
"intervals"
],
"leetcode_dataset_entry_point": "Solution().eraseOverlapIntervals",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:05",
"tests_total": 10... | cpp | {
"raw_signature": "int eraseOverlapIntervals(vector<vector<int>>& intervals) {",
"container": "Solution",
"callable": "eraseOverlapIntervals",
"parameters": [
{
"name": "intervals",
"type": "vector<vector<int>>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
... |
436 | find-right-interval | Medium | You are given an array of intervals, where intervals[i] = [start_i, end_i] and each start_i is unique.
The right interval for an interval i is an interval j such that start_j >= end_i and start_j is minimized. Note that i may equal j.
Return an array of right interval indices for each interval i. If no right interval... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(intervals = [[-1, 1], [0, 2], [1, 3], [2, 4], [3, 5]]) == [2, 3, 4, -1, -1]\n assert candidate(intervals = [[5, 10], [2, 3], [1, 5], [8, 12]]) == [-1, 0, 0, -1]\n assert candidate(intervals = [[10, 20], [20, 30], [5, 15], [30, 40]]... | [
"[[1,2]]",
"[[3,4],[2,3],[1,2]]",
"[[1,4],[2,3],[3,4]]"
] | [] | {
"canonical_parameter_names": [
"intervals"
],
"leetcode_dataset_entry_point": "Solution().findRightInterval",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:08",
"tests_total": 113,
... | cpp | {
"raw_signature": "vector<int> findRightInterval(vector<vector<int>>& intervals) {",
"container": "Solution",
"callable": "findRightInterval",
"parameters": [
{
"name": "intervals",
"type": "vector<vector<int>>&"
}
],
"return_type": "vector<int>",
"signature_source": "leetcode/codeSni... |
438 | find-all-anagrams-in-a-string | Medium | Given two strings s and p, return an array of all the start indices of p's anagrams in s. You may return the answer in any order.
Example 1:
Input: s = "cbaebabacd", p = "abc"
Output: [0,6]
Explanation:
The substring with start index = 0 is "cba", which is an anagram of "abc".
The substring with start index = 6 is "b... | {
"language": "python",
"source": "def answers_match(result, expected):\n \"\"\"The answer may list its items in any order (only the top-level order is free).\"\"\"\n if isinstance(result, list) and isinstance(expected, list):\n return sorted(result, key=repr) == sorted(expected, key=repr)\n return ... | [
"\"cbaebabacd\"\n\"abc\"",
"\"abab\"\n\"ab\""
] | [] | {
"canonical_parameter_names": [
"s",
"p"
],
"leetcode_dataset_entry_point": "Solution().findAnagrams",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:12",
"tests_total": 102,
"te... | cpp | {
"raw_signature": "vector<int> findAnagrams(string s, string p) {",
"container": "Solution",
"callable": "findAnagrams",
"parameters": [
{
"name": "s",
"type": "string"
},
{
"name": "p",
"type": "string"
}
],
"return_type": "vector<int>",
"signature_source": "leetc... |
440 | k-th-smallest-in-lexicographical-order | Hard | Given two integers n and k, return the k^th lexicographically smallest integer in the range [1, n].
Example 1:
Input: n = 13, k = 2
Output: 10
Explanation: The lexicographical order is [1, 10, 11, 12, 13, 2, 3, 4, 5, 6, 7, 8, 9], so the second smallest number is 10.
Example 2:
Input: n = 1, k = 1
Output: 1
Constra... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 13,k = 2) == 10\n assert candidate(n = 1,k = 1) == 1\n assert candidate(n = 100000,k = 50000) == 54998\n assert candidate(n = 10,k = 10) == 9\n assert candidate(n = 1000000,k = 100000) == 189998\n assert candidate(n = ... | [
"13\n2",
"1\n1"
] | [] | {
"canonical_parameter_names": [
"n",
"k"
],
"leetcode_dataset_entry_point": "Solution().findKthNumber",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:17",
"tests_total": 94,
"te... | cpp | {
"raw_signature": "int findKthNumber(int n, int k) {",
"container": "Solution",
"callable": "findKthNumber",
"parameters": [
{
"name": "n",
"type": "int"
},
{
"name": "k",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type... |
441 | arranging-coins | Easy | You have n coins and you want to build a staircase with these coins. The staircase consists of k rows where the i^th row has exactly i coins. The last row of the staircase may be incomplete.
Given the integer n, return the number of complete rows of the staircase you will build.
Example 1:
Input: n = 5
Output: 2
Exp... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 8) == 3\n assert candidate(n = 100) == 13\n assert candidate(n = 30) == 7\n assert candidate(n = 15) == 5\n assert candidate(n = 22) == 6\n assert candidate(n = 21) == 6\n assert candidate(n = 2147483647) == 65535\n... | [
"5",
"8"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().arrangeCoins",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:19",
"tests_total": 54,
"tests_droppe... | cpp | {
"raw_signature": "int arrangeCoins(int n) {",
"container": "Solution",
"callable": "arrangeCoins",
"parameters": [
{
"name": "n",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
442 | find-all-duplicates-in-an-array | Medium | Given an integer array nums of length n where all the integers of nums are in the range [1, n] and each integer appears at most twice, return an array of all the integers that appears twice.
You must write an algorithm that runs in O(n) time and uses only constant auxiliary space, excluding the space needed to store t... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 1, 2]) == [1]\n assert candidate(nums = [5, 3, 2, 3, 5, 1]) == [3, 5]\n assert candidate(nums = [1]) == []\n assert candidate(nums = [5, 3, 1, 2, 4, 3, 5]) == [3, 5]\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4,... | [
"[4,3,2,7,8,2,3,1]",
"[1,1,2]",
"[1]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().findDuplicates",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:21",
"tests_total": 61,
"tests_d... | cpp | {
"raw_signature": "vector<int> findDuplicates(vector<int>& nums) {",
"container": "Solution",
"callable": "findDuplicates",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "vector<int>",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetco... |
446 | arithmetic-slices-ii-subsequence | Hard | Given an integer array nums, return the number of all the arithmetic subsequences of nums.
A sequence of numbers is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.
- For example, [1, 3, 5, 7, 9], [7, 7, 7, 7], and [3, -1, -5, -9] are ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 29\n assert candidate(nums = [1, 2, 3, 8, 9]) == 1\n assert candidate(nums = [2, 4, 6, 8, 10]) == 7\n assert candidate(nums = [1, 3, 5, 7, 9]) == 7\n assert candidate(nums = [1, 2, 3, 4,... | [
"[2,4,6,8,10]",
"[7,7,7,7,7]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().numberOfArithmeticSlices",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:31",
"tests_total": 164,... | cpp | {
"raw_signature": "int numberOfArithmeticSlices(vector<int>& nums) {",
"container": "Solution",
"callable": "numberOfArithmeticSlices",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "le... |
447 | number-of-boomerangs | Medium | You are given n points in the plane that are all distinct, where points[i] = [x_i, y_i]. A boomerang is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the order of the tuple matters).
Return the number of boomerangs.
Example 1:
Input: points = [[0,0],[1,0],[2,... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(points = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]) == 8\n assert candidate(points = [[1, 0], [0, 0], [0, 1]]) == 2\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5]]) == 4\n assert candidate(points = [[0, 0], [1, 0], [... | [
"[[0,0],[1,0],[2,0]]",
"[[1,1],[2,2],[3,3]]",
"[[1,1]]"
] | [] | {
"canonical_parameter_names": [
"points"
],
"leetcode_dataset_entry_point": "Solution().numberOfBoomerangs",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:33",
"tests_total": 105,
"... | cpp | {
"raw_signature": "int numberOfBoomerangs(vector<vector<int>>& points) {",
"container": "Solution",
"callable": "numberOfBoomerangs",
"parameters": [
{
"name": "points",
"type": "vector<vector<int>>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_sour... |
448 | find-all-numbers-disappeared-in-an-array | Easy | Given an array nums of n integers where nums[i] is in the range [1, n], return an array of all the integers in the range [1, n] that do not appear in nums.
Example 1:
Input: nums = [4,3,2,7,8,2,3,1]
Output: [5,6]
Example 2:
Input: nums = [1,1]
Output: [2]
Constraints:
- n == nums.length
- 1 <= n <= 10^5
- 1 <= nu... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [5, 4, 3, 2, 1]) == []\n assert candidate(nums = [10, 2, 3, 4, 5, 6, 7, 8, 9, 1]) == []\n assert candidate(nums = [1, 1]) == [2]\n assert candidate(nums = [4, 3, 2, 7, 8, 2, 3, 1]) == [5, 6]\n assert candidate(nums = [... | [
"[4,3,2,7,8,2,3,1]",
"[1,1]"
] | [
"This is a really easy problem if you decide to use additional memory. For those trying to write an initial solution using additional memory, think counters!",
"However, the trick really is to not use any additional space than what is already available to use. Sometimes, multiple passes over the input array help ... | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().findDisappearedNumbers",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:35",
"tests_total": 68,
... | cpp | {
"raw_signature": "vector<int> findDisappearedNumbers(vector<int>& nums) {",
"container": "Solution",
"callable": "findDisappearedNumbers",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "vector<int>",
"signature_source": "leetcode/codeSnippets",
"type_... |
451 | sort-characters-by-frequency | Medium | Given a string s, sort it in decreasing order based on the frequency of the characters. The frequency of a character is the number of times it appears in the string.
Return the sorted string. If there are multiple answers, return any of them.
Example 1:
Input: s = "tree"
Output: "eert"
Explanation: 'e' appears twice... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"aA\") == \"aA\"\n assert candidate(s = \"2a554442f544asf\") == \"4444455522aaffs\"\n assert candidate(s = \"2a554442f544asfasss\") == \"44444ssssaaa55522ff\"\n assert candidate(s = \"zzzzZZZZ\") == \"zzzzZZZZ\"\n assert... | [
"\"tree\"",
"\"cccaaa\"",
"\"Aabb\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().frequencySort",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:40",
"tests_total": 54,
"tests_dropp... | cpp | {
"raw_signature": "string frequencySort(string s) {",
"container": "Solution",
"callable": "frequencySort",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
452 | minimum-number-of-arrows-to-burst-balloons | Medium | There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [x_start, x_end] denotes a balloon whose horizontal diameter stretches between x_start and x_end. You do not know the exact y-coordinates of the balloons.
A... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(points = [[1, 2], [2, 3], [3, 4], [4, 5]]) == 2\n assert candidate(points = [[10, 16], [2, 8], [1, 6], [7, 12]]) == 2\n assert candidate(points = [[1, 100], [2, 99], [3, 98]]) == 1\n assert candidate(points = [[3, 9], [7, 12], [... | [
"[[10,16],[2,8],[1,6],[7,12]]",
"[[1,2],[3,4],[5,6],[7,8]]",
"[[1,2],[2,3],[3,4],[4,5]]"
] | [] | {
"canonical_parameter_names": [
"points"
],
"leetcode_dataset_entry_point": "Solution().findMinArrowShots",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:42",
"tests_total": 110,
"t... | cpp | {
"raw_signature": "int findMinArrowShots(vector<vector<int>>& points) {",
"container": "Solution",
"callable": "findMinArrowShots",
"parameters": [
{
"name": "points",
"type": "vector<vector<int>>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source... |
453 | minimum-moves-to-equal-array-elements | Medium | Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal.
In one move, you can increment n - 1 elements of the array by 1.
Example 1:
Input: nums = [1,2,3]
Output: 3
Explanation: Only three moves are needed (remember each move increments two elements):
[1,2,... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1000000000, -1000000000]) == 2000000000\n assert candidate(nums = [1, 2, 100]) == 100\n assert candidate(nums = [10, 15, 20]) == 15\n assert candidate(nums = [1, 1, 1]) == 0\n assert candidate(nums = [10, 9, 8, 7, 6, ... | [
"[1,2,3]",
"[1,1,1]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().minMoves",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:44",
"tests_total": 77,
"tests_dropped... | cpp | {
"raw_signature": "int minMoves(vector<int>& nums) {",
"container": "Solution",
"callable": "minMoves",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
454 | 4sum-ii | Medium | Given four integer arrays nums1, nums2, nums3, and nums4 all of length n, return the number of tuples (i, j, k, l) such that:
- 0 <= i, j, k, l < n
- nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0
Example 1:
Input: nums1 = [1,2], nums2 = [-2,-1], nums3 = [-1,2], nums4 = [0,2]
Output: 2
Explanation:
The two tuples ar... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums1 = [1, 2, 3],nums2 = [-1, -2, -3],nums3 = [1, -1, 0],nums4 = [0, 2, -2]) == 13\n assert candidate(nums1 = [1, 2, 3],nums2 = [-1, -2, -3],nums3 = [1, 2, 3],nums4 = [-1, -2, -3]) == 19\n assert candidate(nums1 = [-1, -2, -3],num... | [
"[1,2]\n[-2,-1]\n[-1,2]\n[0,2]",
"[0]\n[0]\n[0]\n[0]"
] | [] | {
"canonical_parameter_names": [
"nums1",
"nums2",
"nums3",
"nums4"
],
"leetcode_dataset_entry_point": "Solution().fourSumCount",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:4... | cpp | {
"raw_signature": "int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) {",
"container": "Solution",
"callable": "fourSumCount",
"parameters": [
{
"name": "nums1",
"type": "vector<int>&"
},
{
"name": "nums2",
"type": "vector<int>&"... |
455 | assign-cookies | Easy | Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie.
Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and each cookie j has a size s[j]. If s[j] >= g[i], we can assign the cookie... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(g = [1, 2, 3, 4, 5],s = [5, 4, 3, 2, 1]) == 5\n assert candidate(g = [1, 3, 5],s = [2, 4, 6]) == 3\n assert candidate(g = [3, 3, 3, 3],s = [1, 1, 1, 1]) == 0\n assert candidate(g = [1, 1, 1, 1],s = [1, 1, 1, 1]) == 4\n assert... | [
"[1,2,3]\n[1,1]",
"[1,2]\n[1,2,3]"
] | [] | {
"canonical_parameter_names": [
"g",
"s"
],
"leetcode_dataset_entry_point": "Solution().findContentChildren",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:49",
"tests_total": 129... | cpp | {
"raw_signature": "int findContentChildren(vector<int>& g, vector<int>& s) {",
"container": "Solution",
"callable": "findContentChildren",
"parameters": [
{
"name": "g",
"type": "vector<int>&"
},
{
"name": "s",
"type": "vector<int>&"
}
],
"return_type": "int",
"sig... |
456 | 132-pattern | Medium | Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j].
Return true if there is a 132 pattern in nums, otherwise, return false.
Example 1:
Input: nums = [1,2,3,4]
Output: false
Explanation: There is no 132 p... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [-1, 3, 2, 0]) == True\n assert candidate(nums = [1, 3, 2, 4, 5]) == True\n assert candidate(nums = [3, 5, 0, 2, 3]) == False\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == False\n assert candidate(nums ... | [
"[1,2,3,4]",
"[3,1,4,2]",
"[-1,3,2,0]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().find132pattern",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:51",
"tests_total": 143,
"tests_... | cpp | {
"raw_signature": "bool find132pattern(vector<int>& nums) {",
"container": "Solution",
"callable": "find132pattern",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "bool",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippet... |
457 | circular-array-loop | Medium | You are playing a game involving a circular array of non-zero integers nums. Each nums[i] denotes the number of indices forward/backward you must move if you are located at index i:
- If nums[i] is positive, move nums[i] steps forward, and
- If nums[i] is negative, move abs(nums[i]) steps backward.
Since the array is... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [-5, 1, 1, 4, 2]) == True\n assert candidate(nums = [-1, 2, -1, 2, -1]) == False\n assert candidate(nums = [-1, -2, -3, -4, -5, 6]) == False\n assert candidate(nums = [-2, -3, -4, -5, -6]) == False\n assert candidate(n... | [
"[2,-1,1,2,2]",
"[-1,-2,-3,-4,-5,6]",
"[1,-1,5,1,4]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().circularArrayLoop",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:53",
"tests_total": 116,
"tes... | cpp | {
"raw_signature": "bool circularArrayLoop(vector<int>& nums) {",
"container": "Solution",
"callable": "circularArrayLoop",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "bool",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeS... |
458 | poor-pigs | Hard | There are buckets buckets of liquid, where exactly one of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poor) pigs the liquid to see whether they will die or not. Unfortunately, you only have minutesToTest minutes to determine which bucket is poisonous.
You can feed the pigs ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(buckets = 4,minutesToDie = 15,minutesToTest = 15) == 2\n assert candidate(buckets = 1,minutesToDie = 1,minutesToTest = 1) == 0\n assert candidate(buckets = 1000,minutesToDie = 1,minutesToTest = 100) == 2\n assert candidate(bucke... | [
"4\n15\n15",
"4\n15\n30"
] | [
"What if you only have one shot? Eg. 4 buckets, 15 mins to die, and 15 mins to test.",
"How many states can we generate with x pigs and T tests?",
"Find minimum x such that (T+1)^x >= N"
] | {
"canonical_parameter_names": [
"buckets",
"minutesToDie",
"minutesToTest"
],
"leetcode_dataset_entry_point": "Solution().poorPigs",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:4... | cpp | {
"raw_signature": "int poorPigs(int buckets, int minutesToDie, int minutesToTest) {",
"container": "Solution",
"callable": "poorPigs",
"parameters": [
{
"name": "buckets",
"type": "int"
},
{
"name": "minutesToDie",
"type": "int"
},
{
"name": "minutesToTest",
... |
459 | repeated-substring-pattern | Easy | Given a string s, check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.
Example 1:
Input: s = "abab"
Output: true
Explanation: It is the substring "ab" twice.
Example 2:
Input: s = "aba"
Output: false
Example 3:
Input: s = "abcabcabcabc"
Output: true
E... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"abac\") == False\n assert candidate(s = \"abcdef\") == False\n assert candidate(s = \"abababab\") == True\n assert candidate(s = \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa... | [
"\"abab\"",
"\"aba\"",
"\"abcabcabcabc\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().repeatedSubstringPattern",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:49:58",
"tests_total": 87,
"... | cpp | {
"raw_signature": "bool repeatedSubstringPattern(string s) {",
"container": "Solution",
"callable": "repeatedSubstringPattern",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "bool",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnipp... |
461 | hamming-distance | Easy | The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
Given two integers x and y, return the Hamming distance between them.
Example 1:
Input: x = 1, y = 4
Output: 2
Explanation:
1 (0 0 0 1)
4 (0 1 0 0)
↑ ↑
The above arrows point to positions ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(x = 3,y = 1) == 1\n assert candidate(x = 7,y = 15) == 1\n assert candidate(x = 1073741823,y = 2147483647) == 1\n assert candidate(x = 1023,y = 512) == 9\n assert candidate(x = 2147483647,y = 0) == 31\n assert candidate(x =... | [
"1\n4",
"3\n1"
] | [] | {
"canonical_parameter_names": [
"x",
"y"
],
"leetcode_dataset_entry_point": "Solution().hammingDistance",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:00",
"tests_total": 88,
"... | cpp | {
"raw_signature": "int hammingDistance(int x, int y) {",
"container": "Solution",
"callable": "hammingDistance",
"parameters": [
{
"name": "x",
"type": "int"
},
{
"name": "y",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"... |
462 | minimum-moves-to-equal-array-elements-ii | Medium | Given an integer array nums of size n, return the minimum number of moves required to make all array elements equal.
In one move, you can increment or decrement an element of the array by 1.
Test cases are designed so that the answer will fit in a 32-bit integer.
Example 1:
Input: nums = [1,2,3]
Output: 2
Explanati... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 1, 1]) == 0\n assert candidate(nums = [1, 1, 1, 1]) == 0\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(nums = [1, 3, 5, 7, 9]) == 12\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7,... | [
"[1,2,3]",
"[1,10,2,9]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().minMoves2",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:03",
"tests_total": 79,
"tests_droppe... | cpp | {
"raw_signature": "int minMoves2(vector<int>& nums) {",
"container": "Solution",
"callable": "minMoves2",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
463 | island-perimeter | Easy | You are given row x col grid representing a map where grid[i][j] = 1 represents land and grid[i][j] = 0 represents water.
Grid cells are connected horizontally/vertically (not diagonally). The grid is completely surrounded by water, and there is exactly one island (i.e., one or more connected land cells).
The island ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(grid = [[0, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]) == 12\n assert candidate(grid = [[1]]) == 4\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 16\n assert candidate(grid = [[0, 1, 0, 1, ... | [
"[[0,1,0,0],[1,1,1,0],[0,1,0,0],[1,1,0,0]]",
"[[1]]",
"[[1,0]]"
] | [] | {
"canonical_parameter_names": [
"grid"
],
"leetcode_dataset_entry_point": "Solution().islandPerimeter",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:05",
"tests_total": 72,
"tests_... | cpp | {
"raw_signature": "int islandPerimeter(vector<vector<int>>& grid) {",
"container": "Solution",
"callable": "islandPerimeter",
"parameters": [
{
"name": "grid",
"type": "vector<vector<int>>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leet... |
464 | can-i-win | Medium | In the "100 game" two players take turns adding, to a running total, any integer from 1 to 10. The player who first causes the running total to reach or exceed 100 wins.
What if we change the game so that players cannot re-use integers?
For example, two players might take turns drawing from a common pool of numbers f... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(maxChoosableInteger = 15,desiredTotal = 50) == True\n assert candidate(maxChoosableInteger = 10,desiredTotal = 0) == True\n assert candidate(maxChoosableInteger = 10,desiredTotal = 15) == True\n assert candidate(maxChoosableInte... | [
"10\n11",
"10\n0",
"10\n1"
] | [] | {
"canonical_parameter_names": [
"maxChoosableInteger",
"desiredTotal"
],
"leetcode_dataset_entry_point": "Solution().canIWin",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:07",
"... | cpp | {
"raw_signature": "bool canIWin(int maxChoosableInteger, int desiredTotal) {",
"container": "Solution",
"callable": "canIWin",
"parameters": [
{
"name": "maxChoosableInteger",
"type": "int"
},
{
"name": "desiredTotal",
"type": "int"
}
],
"return_type": "bool",
"sig... |
466 | count-the-repetitions | Hard | We define str = [s, n] as the string str which consists of the string s concatenated n times.
- For example, str == ["abc", 3] =="abcabcabc".
We define that string s1 can be obtained from string s2 if we can remove some characters from s2 such that it becomes s1.
- For example, s1 = "abc" can be obtained from s2 = "... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s1 = \"acb\",n1 = 1,s2 = \"acb\",n2 = 1) == 1\n assert candidate(s1 = \"aaa\",n1 = 3,s2 = \"a\",n2 = 1) == 9\n assert candidate(s1 = \"aabaacaabaab\",n1 = 8,s2 = \"aab\",n2 = 1) == 24\n assert candidate(s1 = \"acb\",n1 = 4,s2 = ... | [
"\"acb\"\n4\n\"ab\"\n2",
"\"acb\"\n1\n\"acb\"\n1"
] | [] | {
"canonical_parameter_names": [
"s1",
"n1",
"s2",
"n2"
],
"leetcode_dataset_entry_point": "Solution().getMaxRepetitions",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:12",
... | cpp | {
"raw_signature": "int getMaxRepetitions(string s1, int n1, string s2, int n2) {",
"container": "Solution",
"callable": "getMaxRepetitions",
"parameters": [
{
"name": "s1",
"type": "string"
},
{
"name": "n1",
"type": "int"
},
{
"name": "s2",
"type": "stri... |
467 | unique-substrings-in-wraparound-string | Medium | We define the string base to be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", so base will look like this:
- "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".
Given a string s, return the number of unique non-empty substrings of s are present in base.
Example 1:
Input: s = "a"
Ou... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"qpqprstuvwxyzqpqprstuvwxyzqpqprstuvwxyz\") == 48\n assert candidate(s = \"abczabczabcz\") == 10\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == 351\n assert candidate(s = \"azza\") == 3\n assert candidate(s = ... | [
"\"a\"",
"\"cac\"",
"\"zab\""
] | [
"One possible solution might be to consider allocating an array size of 26 for each character in the alphabet. (Credits to @r2ysxu)"
] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().findSubstringInWraproundString",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:14",
"tests_total": 6... | cpp | {
"raw_signature": "int findSubstringInWraproundString(string s) {",
"container": "Solution",
"callable": "findSubstringInWraproundString",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode... |
468 | validate-ip-address | Medium | Given a string queryIP, return "IPv4" if IP is a valid IPv4 address, "IPv6" if IP is a valid IPv6 address or "Neither" if IP is not a correct IP of any type.
A valid IPv4 address is an IP in the form "x_1.x_2.x_3.x_4" where 0 <= x_i <= 255 and x_i cannot contain leading zeros. For example, "192.168.1.1" and "192.168.1... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(queryIP = \"192.168.1.1.1\") == \"Neither\"\n assert candidate(queryIP = \"2001:DB8:85A3:0:0:8A2E:370:7334\") == \"IPv6\"\n assert candidate(queryIP = \"2001:0db8:85a3:0000:0000:8A2E:0370:7334\") == \"IPv6\"\n assert candidate(q... | [
"\"172.16.254.1\"",
"\"2001:0db8:85a3:0:0:8A2E:0370:7334\"",
"\"256.256.256.256\""
] | [] | {
"canonical_parameter_names": [
"queryIP"
],
"leetcode_dataset_entry_point": "Solution().validIPAddress",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:17",
"tests_total": 243,
"tes... | cpp | {
"raw_signature": "string validIPAddress(string queryIP) {",
"container": "Solution",
"callable": "validIPAddress",
"parameters": [
{
"name": "queryIP",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"... |
472 | concatenated-words | Hard | Given an array of strings words (without duplicates), return all the concatenated words in the given list of words.
A concatenated word is defined as a string that is comprised entirely of at least two shorter words (not necessarily distinct) in the given array.
Example 1:
Input: words = ["cat","cats","catsdogcats",... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(words = ['hello', 'world', 'helloworld', 'worldhello']) == ['helloworld', 'worldhello']\n assert candidate(words = ['apple', 'banana', 'appbanana', 'banapple', 'app', 'ban']) == ['banapple', 'appbanana']\n assert candidate(words = ... | [
"[\"cat\",\"cats\",\"catsdogcats\",\"dog\",\"dogcatsdog\",\"hippopotamuses\",\"rat\",\"ratcatdogcat\"]",
"[\"cat\",\"dog\",\"catdog\"]"
] | [] | {
"canonical_parameter_names": [
"words"
],
"leetcode_dataset_entry_point": "Solution().findAllConcatenatedWordsInADict",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:24",
"tests_tota... | cpp | {
"raw_signature": "vector<string> findAllConcatenatedWordsInADict(vector<string>& words) {",
"container": "Solution",
"callable": "findAllConcatenatedWordsInADict",
"parameters": [
{
"name": "words",
"type": "vector<string>&"
}
],
"return_type": "vector<string>",
"signature_source": "... |
473 | matchsticks-to-square | Medium | You are given an integer array matchsticks where matchsticks[i] is the length of the i^th matchstick. You want to use all the matchsticks to make one square. You should not break any stick, but you can link them up, and each matchstick must be used exactly one time.
Return true if you can make this square and false ot... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(matchsticks = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == False\n assert candidate(matchsticks = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]) == True\n assert candidate(matchsticks = [10, 10, 10, 10]) == True\n assert candidate(m... | [
"[1,1,2,2,2]",
"[3,3,3,3,4]"
] | [
"Treat the matchsticks as an array. Can we split the array into 4 equal parts?",
"Every matchstick can belong to either of the 4 sides. We don't know which one. Maybe try out all options!",
"For every matchstick, we have to try out each of the 4 options i.e. which side it can belong to. We can make use of recur... | {
"canonical_parameter_names": [
"matchsticks"
],
"leetcode_dataset_entry_point": "Solution().makesquare",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:26",
"tests_total": 85,
"test... | cpp | {
"raw_signature": "bool makesquare(vector<int>& matchsticks) {",
"container": "Solution",
"callable": "makesquare",
"parameters": [
{
"name": "matchsticks",
"type": "vector<int>&"
}
],
"return_type": "bool",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeS... |
474 | ones-and-zeroes | Medium | You are given an array of binary strings strs and two integers m and n.
Return the size of the largest subset of strs such that there are at most m 0's and n 1's in the subset.
A set x is a subset of a set y if all elements of x are also elements of y.
Example 1:
Input: strs = ["10","0001","111001","1","0"], m = 5,... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(strs = ['0', '0', '1', '1'],m = 2,n = 2) == 4\n assert candidate(strs = ['111', '000', '101010'],m = 3,n = 3) == 2\n assert candidate(strs = ['10', '0', '1'],m = 1,n = 1) == 2\n assert candidate(strs = ['111', '000', '1010', '01... | [
"[\"10\",\"0001\",\"111001\",\"1\",\"0\"]\n5\n3",
"[\"10\",\"0\",\"1\"]\n1\n1"
] | [] | {
"canonical_parameter_names": [
"strs",
"m",
"n"
],
"leetcode_dataset_entry_point": "Solution().findMaxForm",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:28",
"tests_total":... | cpp | {
"raw_signature": "int findMaxForm(vector<string>& strs, int m, int n) {",
"container": "Solution",
"callable": "findMaxForm",
"parameters": [
{
"name": "strs",
"type": "vector<string>&"
},
{
"name": "m",
"type": "int"
},
{
"name": "n",
"type": "int"
... |
475 | heaters | Medium | Winter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm all the houses.
Every house can be warmed, as long as the house is within the heater's warm radius range.
Given the positions of houses and heaters on a horizontal line, return the minimum radius stand... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(houses = [1, 5],heaters = [2]) == 3\n assert candidate(houses = [1],heaters = [1]) == 0\n assert candidate(houses = [10, 20, 30, 40, 50],heaters = [15, 45]) == 15\n assert candidate(houses = [10, 20, 30, 40, 50],heaters = [5, 15... | [
"[1,2,3]\n[2]",
"[1,2,3,4]\n[1,4]",
"[1,5]\n[2]"
] | [] | {
"canonical_parameter_names": [
"houses",
"heaters"
],
"leetcode_dataset_entry_point": "Solution().findRadius",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:30",
"tests_total": 1... | cpp | {
"raw_signature": "int findRadius(vector<int>& houses, vector<int>& heaters) {",
"container": "Solution",
"callable": "findRadius",
"parameters": [
{
"name": "houses",
"type": "vector<int>&"
},
{
"name": "heaters",
"type": "vector<int>&"
}
],
"return_type": "int",
... |
476 | number-complement | Easy | The complement of an integer is the integer you get when you flip all the 0's to 1's and all the 1's to 0's in its binary representation.
- For example, The integer 5 is "101" in binary and its complement is "010" which is the integer 2.
Given an integer num, return its complement.
Example 1:
Input: num = 5
Output:... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(num = 31) == 0\n assert candidate(num = 10) == 5\n assert candidate(num = 32) == 31\n assert candidate(num = 5) == 2\n assert candidate(num = 1023) == 0\n assert candidate(num = 1) == 0\n assert candidate(num = 100) == ... | [
"5",
"1"
] | [] | {
"canonical_parameter_names": [
"num"
],
"leetcode_dataset_entry_point": "Solution().findComplement",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:33",
"tests_total": 44,
"tests_dr... | cpp | {
"raw_signature": "int findComplement(int num) {",
"container": "Solution",
"callable": "findComplement",
"parameters": [
{
"name": "num",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
477 | total-hamming-distance | Medium | The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
Given an integer array nums, return the sum of Hamming distances between all the pairs of the integers in nums.
Example 1:
Input: nums = [4,14,2]
Output: 6
Explanation: In binary representation, the 4 ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 48\n assert candidate(nums = [4, 14, 4]) == 4\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 112\n assert candidate(nums = [31, 14, 7, 3, 1]) == 24\n assert candidate(n... | [
"[4,14,2]",
"[4,14,4]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().totalHammingDistance",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:35",
"tests_total": 98,
"t... | cpp | {
"raw_signature": "int totalHammingDistance(vector<int>& nums) {",
"container": "Solution",
"callable": "totalHammingDistance",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/c... |
480 | sliding-window-median | Hard | The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle values.
- For examples, if arr = [2,3,4], the median is 3.
- For examples, if arr = [1,2,3,4], the median is (2 + 3) / 2 = 2.5.
You are given an integer arr... | {
"language": "python",
"source": "def answers_match(result, expected):\n \"\"\"Decimal answers are accepted within 1e-5 (absolute or relative), as on LeetCode.\"\"\"\n import math\n if isinstance(result, list) and isinstance(expected, list):\n return len(result) == len(expected) and all(answers_mat... | [
"[1,3,-1,-3,5,3,6,7]\n3",
"[1,2,3,4,2,3,1,4,2]\n3"
] | [
"The simplest of solutions comes from the basic idea of finding the median given a set of numbers. We know that by definition, a median is the center element (or an average of the two center elements). Given an unsorted list of numbers, how do we find the median element? If you know the answer to this question, can... | {
"canonical_parameter_names": [
"nums",
"k"
],
"leetcode_dataset_entry_point": "Solution().medianSlidingWindow",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:40",
"tests_total": ... | cpp | {
"raw_signature": "vector<double> medianSlidingWindow(vector<int>& nums, int k) {",
"container": "Solution",
"callable": "medianSlidingWindow",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
},
{
"name": "k",
"type": "int"
}
],
"return_type": "vector<double... |
481 | magical-string | Medium | A magical string s consists of only '1' and '2' and obeys the following rule:
- Concatenating the sequence of lengths of its consecutive groups of identical characters '1' and '2' generates the string s itself.
The first few elements of s is s = "1221121221221121122……". If we group the consecutive 1's and 2's in s, i... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 100000) == 49972\n assert candidate(n = 100) == 49\n assert candidate(n = 15) == 7\n assert candidate(n = 10000) == 4996\n assert candidate(n = 6) == 3\n assert candidate(n = 20) == 10\n assert candidate(n = 1) == 1... | [
"6",
"1"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().magicalString",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:42",
"tests_total": 41,
"tests_dropp... | cpp | {
"raw_signature": "int magicalString(int n) {",
"container": "Solution",
"callable": "magicalString",
"parameters": [
{
"name": "n",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
482 | license-key-formatting | Easy | You are given a license key represented as a string s that consists of only alphanumeric characters and dashes. The string is separated into n + 1 groups by n dashes. You are also given an integer k.
We want to reformat the string s such that each group contains exactly k characters, except for the first group, which ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"AB-CD-EF-GH-IJ\",k = 2) == \"AB-CD-EF-GH-IJ\"\n assert candidate(s = \"abcdefg-hijkl-mnopqr-stuv-wxyz\",k = 5) == \"A-BCDEF-GHIJK-LMNOP-QRSTU-VWXYZ\"\n assert candidate(s = \"1234567890\",k = 3) == \"1-234-567-890\"\n asse... | [
"\"5F3Z-2e-9-w\"\n4",
"\"2-5g-3-J\"\n2"
] | [] | {
"canonical_parameter_names": [
"s",
"k"
],
"leetcode_dataset_entry_point": "Solution().licenseKeyFormatting",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:44",
"tests_total": 10... | cpp | {
"raw_signature": "string licenseKeyFormatting(string s, int k) {",
"container": "Solution",
"callable": "licenseKeyFormatting",
"parameters": [
{
"name": "s",
"type": "string"
},
{
"name": "k",
"type": "int"
}
],
"return_type": "string",
"signature_source": "leetc... |
483 | smallest-good-base | Hard | Given an integer n represented as a string, return the smallest good base of n.
We call k >= 2 a good base of n, if all digits of n base k are 1's.
Example 1:
Input: n = "13"
Output: "3"
Explanation: 13 base 3 is 111.
Example 2:
Input: n = "4681"
Output: "8"
Explanation: 4681 base 8 is 11111.
Example 3:
Input: n... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = \"4681\") == \"8\"\n assert candidate(n = \"9\") == \"8\"\n assert candidate(n = \"104729\") == \"104728\"\n assert candidate(n = \"15\") == \"2\"\n assert candidate(n = \"218\") == \"217\"\n assert candidate(n = \"13\... | [
"\"13\"",
"\"4681\"",
"\"1000000000000000000\""
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().smallestGoodBase",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:46",
"tests_total": 104,
"tests_d... | cpp | {
"raw_signature": "string smallestGoodBase(string n) {",
"container": "Solution",
"callable": "smallestGoodBase",
"parameters": [
{
"name": "n",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
485 | max-consecutive-ones | Easy | Given a binary array nums, return the maximum number of consecutive 1's in the array.
Example 1:
Input: nums = [1,1,0,1,1,1]
Output: 3
Explanation: The first two digits or the last three digits are consecutive 1s. The maximum number of consecutive 1s is 3.
Example 2:
Input: nums = [1,0,1,1,0,1]
Output: 2
Constrain... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 0\n assert candidate(nums = [1, 0, 0, 0, 1, 0, 0, 1, 1, 0]) == 2\n assert candidate(nums = [1, 0, 1, 1, 0, 1]) == 2\n assert candidate(nums = [1]) == 1\n assert candidate(nums = [1, 0... | [
"[1,1,0,1,1,1]",
"[1,0,1,1,0,1]"
] | [
"You need to think about two things as far as any window is concerned. One is the starting point for the window. How do you detect that a new window of 1s has started? The next part is detecting the ending point for this window. How do you detect the ending point for an existing window? If you figure these two thin... | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().findMaxConsecutiveOnes",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:51",
"tests_total": 97,
... | cpp | {
"raw_signature": "int findMaxConsecutiveOnes(vector<int>& nums) {",
"container": "Solution",
"callable": "findMaxConsecutiveOnes",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetco... |
486 | predict-the-winner | Medium | You are given an integer array nums.
Two players are playing a game with this array: Player 1 and Player 2.
Player 1 and Player 2 take turns, with Player 1 starting first. Both players start the game with a score of 0.
At each turn, the current player takes the number at either end of the array (i.e., nums[0] or num... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [10, 10, 10, 10]) == True\n assert candidate(nums = [1, 5, 2]) == False\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == True\n assert can... | [
"[1,5,2]",
"[1,5,233,7]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().predictTheWinner",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:50:53",
"tests_total": 109,
"test... | cpp | {
"raw_signature": "bool predictTheWinner(vector<int>& nums) {",
"container": "Solution",
"callable": "predictTheWinner",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "bool",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSni... |
491 | non-decreasing-subsequences | Medium | Given an integer array nums, return all the different possible non-decreasing subsequences of the given array with at least two elements. You may return the answer in any order.
Example 1:
Input: nums = [4,6,7,7]
Output: [[4,6],[4,6,7],[4,6,7,7],[4,7],[4,7,7],[6,7],[6,7,7],[7,7]]
Example 2:
Input: nums = [4,4,3,2,1... | {
"language": "python",
"source": "def answers_match(result, expected):\n \"\"\"The answer may list its items in any order (only the top-level order is free).\"\"\"\n if isinstance(result, list) and isinstance(expected, list):\n return sorted(result, key=repr) == sorted(expected, key=repr)\n return ... | [
"[4,6,7,7]",
"[4,4,3,2,1]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().findSubsequences",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:03",
"tests_total": 103,
"test... | cpp | {
"raw_signature": "vector<vector<int>> findSubsequences(vector<int>& nums) {",
"container": "Solution",
"callable": "findSubsequences",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "vector<vector<int>>",
"signature_source": "leetcode/codeSnippets",
"t... |
492 | construct-the-rectangle | Easy | A web developer needs to know how to design a web page's size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:
1. The area of the rectangular web page you designed must equal to the given target area.
... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(area = 81) == [9, 9]\n assert candidate(area = 122122) == [427, 286]\n assert candidate(area = 37) == [37, 1]\n assert candidate(area = 10000000) == [3200, 3125]\n assert candidate(area = 1) == [1, 1]\n assert candidate(ar... | [
"4",
"37",
"122122"
] | [
"The W is always less than or equal to the square root of the area, so we start searching at sqrt(area) till we find the result."
] | {
"canonical_parameter_names": [
"area"
],
"leetcode_dataset_entry_point": "Solution().constructRectangle",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:05",
"tests_total": 74,
"tes... | cpp | {
"raw_signature": "vector<int> constructRectangle(int area) {",
"container": "Solution",
"callable": "constructRectangle",
"parameters": [
{
"name": "area",
"type": "int"
}
],
"return_type": "vector<int>",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSni... |
493 | reverse-pairs | Hard | Given an integer array nums, return the number of reverse pairs in the array.
A reverse pair is a pair (i, j) where:
- 0 <= i < j < nums.length and
- nums[i] > 2 * nums[j].
Example 1:
Input: nums = [1,3,2,3,1]
Output: 2
Explanation: The reverse pairs are:
(1, 4) --> nums[1] = 3, nums[4] = 1, 3 > 2 * 1
(3, 4) --> nu... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [8, 6, 4, 2, 1, 3, 5, 7, 9]) == 6\n assert candidate(nums = [2147483647, -2147483648, 0, 1, -1]) == 6\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 20\n assert candidate(nums = [1, 5, 3, 4, 2]) == 1\n a... | [
"[1,3,2,3,1]",
"[2,4,3,5,1]"
] | [
"Use the merge-sort technique.",
"Divide the array into two parts and sort them.",
"For each integer in the first part, count the number of integers that satisfy the condition from the second part. Use the pointer to help you in the counting process."
] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().reversePairs",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:08",
"tests_total": 126,
"tests_dr... | cpp | {
"raw_signature": "int reversePairs(vector<int>& nums) {",
"container": "Solution",
"callable": "reversePairs",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
494 | target-sum | Medium | You are given an integer array nums and an integer target.
You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all the integers.
- For example, if nums = [2, 1], you can add a '+' before 2 and a '-' before 1 and concatenate them to buil... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [10, 20, 30],target = 60) == 1\n assert candidate(nums = [1, 2, 3, 4, 5],target = 3) == 3\n assert candidate(nums = [0, 0, 0, 0, 0],target = 0) == 32\n assert candidate(nums = [1000],target = 1000) == 1\n assert candid... | [
"[1,1,1,1,1]\n3",
"[1]\n1"
] | [] | {
"canonical_parameter_names": [
"nums",
"target"
],
"leetcode_dataset_entry_point": "Solution().findTargetSumWays",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:10",
"tests_total... | cpp | {
"raw_signature": "int findTargetSumWays(vector<int>& nums, int target) {",
"container": "Solution",
"callable": "findTargetSumWays",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
},
{
"name": "target",
"type": "int"
}
],
"return_type": "int",
"signature... |
495 | teemo-attacking | Easy | Our hero Teemo is attacking an enemy Ashe with poison attacks! When Teemo attacks Ashe, Ashe gets poisoned for a exactly duration seconds. More formally, an attack at second t will mean Ashe is poisoned during the inclusive time interval [t, t + duration - 1]. If Teemo attacks again before the poison effect ends, the t... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(timeSeries = [0, 1, 2, 3, 4, 5],duration = 1) == 6\n assert candidate(timeSeries = [1, 5, 9],duration = 4) == 12\n assert candidate(timeSeries = [1],duration = 5) == 5\n assert candidate(timeSeries = [10, 14, 15],duration = 5) =... | [
"[1,4]\n2",
"[1,2]\n2"
] | [] | {
"canonical_parameter_names": [
"timeSeries",
"duration"
],
"leetcode_dataset_entry_point": "Solution().findPoisonedDuration",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:12",
"... | cpp | {
"raw_signature": "int findPoisonedDuration(vector<int>& timeSeries, int duration) {",
"container": "Solution",
"callable": "findPoisonedDuration",
"parameters": [
{
"name": "timeSeries",
"type": "vector<int>&"
},
{
"name": "duration",
"type": "int"
}
],
"return_type... |
496 | next-greater-element-i | Easy | The next greater element of some element x in an array is the first greater element that is to the right of x in the same array.
You are given two distinct 0-indexed integer arrays nums1 and nums2, where nums1 is a subset of nums2.
For each 0 <= i < nums1.length, find the index j such that nums1[i] == nums2[j] and de... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums1 = [2, 3, 5, 6],nums2 = [5, 6, 2, 3, 8, 9]) == [3, 8, 6, 8]\n assert candidate(nums1 = [1, 2],nums2 = [2, 1]) == [-1, -1]\n assert candidate(nums1 = [1, 2, 3, 4],nums2 = [4, 3, 2, 1]) == [-1, -1, -1, -1]\n assert candidate(... | [
"[4,1,2]\n[1,3,4,2]",
"[2,4]\n[1,2,3,4]"
] | [] | {
"canonical_parameter_names": [
"nums1",
"nums2"
],
"leetcode_dataset_entry_point": "Solution().nextGreaterElement",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:15",
"tests_tota... | cpp | {
"raw_signature": "vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {",
"container": "Solution",
"callable": "nextGreaterElement",
"parameters": [
{
"name": "nums1",
"type": "vector<int>&"
},
{
"name": "nums2",
"type": "vector<int>&"
}
],
"retur... |
498 | diagonal-traverse | Medium | Given an m x n matrix mat, return an array of all the elements of the array in a diagonal order.
Example 1:
Input: mat = [[1,2,3],[4,5,6],[7,8,9]]
Output: [1,2,4,7,5,3,6,8,9]
Example 2:
Input: mat = [[1,2],[3,4]]
Output: [1,2,3,4]
Constraints:
- m == mat.length
- n == mat[i].length
- 1 <= m, n <= 10^4
- 1 <= m * ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(mat = [[1, 2], [3, 4]]) == [1, 2, 3, 4]\n assert candidate(mat = [[1]]) == [1]\n assert candidate(mat = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]) == [1, 2, 5, 9, 6, 3, 4, 7, 10, 11, 8, 12]\n assert candidate(mat = [[1, 2, 3... | [
"[[1,2,3],[4,5,6],[7,8,9]]",
"[[1,2],[3,4]]"
] | [] | {
"canonical_parameter_names": [
"mat"
],
"leetcode_dataset_entry_point": "Solution().findDiagonalOrder",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:17",
"tests_total": 62,
"tests... | cpp | {
"raw_signature": "vector<int> findDiagonalOrder(vector<vector<int>>& mat) {",
"container": "Solution",
"callable": "findDiagonalOrder",
"parameters": [
{
"name": "mat",
"type": "vector<vector<int>>&"
}
],
"return_type": "vector<int>",
"signature_source": "leetcode/codeSnippets",
"t... |
500 | keyboard-row | Easy | Given an array of strings words, return the words that can be typed using letters of the alphabet on only one row of American keyboard like the image below.
Note that the strings are case-insensitive, both lowercased and uppercased of the same letter are treated as if they are at the same row.
In the American keyboar... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(words = ['Hello', 'Alaska', 'Dad', 'Peace']) == ['Alaska', 'Dad']\n assert candidate(words = ['qwerty', 'ASDFGH', 'zxcvbN']) == ['qwerty', 'ASDFGH', 'zxcvbN']\n assert candidate(words = ['QwErTy', 'aSdF', 'zXcV']) == ['QwErTy', 'aS... | [
"[\"Hello\",\"Alaska\",\"Dad\",\"Peace\"]",
"[\"omk\"]",
"[\"adsdf\",\"sfd\"]"
] | [] | {
"canonical_parameter_names": [
"words"
],
"leetcode_dataset_entry_point": "Solution().findWords",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:22",
"tests_total": 81,
"tests_dropp... | cpp | {
"raw_signature": "vector<string> findWords(vector<string>& words) {",
"container": "Solution",
"callable": "findWords",
"parameters": [
{
"name": "words",
"type": "vector<string>&"
}
],
"return_type": "vector<string>",
"signature_source": "leetcode/codeSnippets",
"type_source": "le... |
502 | ipo | Hard | Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the IPO. Since it has limited resources, it can only finish at most k distinct projects before the IPO. Help LeetCode design the best way ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(k = 1,w = 10,profits = [5, 6],capital = [4, 0]) == 16\n assert candidate(k = 5,w = 10,profits = [5, 4, 3, 2, 1],capital = [1, 2, 3, 4, 5]) == 25\n assert candidate(k = 2,w = 3,profits = [8, 10, 6],capital = [2, 5, 0]) == 21\n as... | [
"2\n0\n[1,2,3]\n[0,1,1]",
"3\n0\n[1,2,3]\n[0,1,2]"
] | [] | {
"canonical_parameter_names": [
"k",
"w",
"profits",
"capital"
],
"leetcode_dataset_entry_point": "Solution().findMaximizedCapital",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T... | cpp | {
"raw_signature": "int findMaximizedCapital(int k, int w, vector<int>& profits, vector<int>& capital) {",
"container": "Solution",
"callable": "findMaximizedCapital",
"parameters": [
{
"name": "k",
"type": "int"
},
{
"name": "w",
"type": "int"
},
{
"name": "pro... |
503 | next-greater-element-ii | Medium | Given a circular integer array nums (i.e., the next element of nums[nums.length - 1] is nums[0]), return the next greater number for every element in nums.
The next greater number of a number x is the first greater number to its traversing-order next in the array, which means you could search circularly to find its ne... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [5, 4, 3, 2, 1]) == [-1, 5, 5, 5, 5]\n assert candidate(nums = [1]) == [-1]\n assert candidate(nums = [3, 10, 4, 3, 2, 1, 5]) == [10, -1, 5, 5, 5, 5, 10]\n assert candidate(nums = [10, 5, 7, 3, 6, 2]) == [-1, 7, 10, 6, 10... | [
"[1,2,1]",
"[1,2,3,4,3]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().nextGreaterElements",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:29",
"tests_total": 122,
"t... | cpp | {
"raw_signature": "vector<int> nextGreaterElements(vector<int>& nums) {",
"container": "Solution",
"callable": "nextGreaterElements",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "vector<int>",
"signature_source": "leetcode/codeSnippets",
"type_source... |
504 | base-7 | Easy | Given an integer num, return a string of its base 7 representation.
Example 1:
Input: num = 100
Output: "202"
Example 2:
Input: num = -7
Output: "-10"
Constraints:
- -10^7 <= num <= 10^7
| {
"language": "python",
"source": "def check(candidate):\n assert candidate(num = -1000000) == \"-11333311\"\n assert candidate(num = 49) == \"100\"\n assert candidate(num = 165) == \"324\"\n assert candidate(num = -10000000) == \"-150666343\"\n assert candidate(num = 0) == \"0\"\n assert candidat... | [
"100",
"-7"
] | [] | {
"canonical_parameter_names": [
"num"
],
"leetcode_dataset_entry_point": "Solution().convertToBase7",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:31",
"tests_total": 47,
"tests_dr... | cpp | {
"raw_signature": "string convertToBase7(int num) {",
"container": "Solution",
"callable": "convertToBase7",
"parameters": [
{
"name": "num",
"type": "int"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
506 | relative-ranks | Easy | You are given an integer array score of size n, where score[i] is the score of the i^th athlete in a competition. All the scores are guaranteed to be unique.
The athletes are placed based on their scores, where the 1^st place athlete has the highest score, the 2^nd place athlete has the 2^nd highest score, and so on. ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(score = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]) == ['Gold Medal', 'Silver Medal', 'Bronze Medal', '4', '5', '6', '7', '8', '9', '10']\n assert candidate(score = [5, 4, 3, 2, 1]) == ['Gold Medal', 'Silver Medal', 'Bronze Medal', '4'... | [
"[5,4,3,2,1]",
"[10,3,8,9,4]"
] | [] | {
"canonical_parameter_names": [
"score"
],
"leetcode_dataset_entry_point": "Solution().findRelativeRanks",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:36",
"tests_total": 89,
"tes... | cpp | {
"raw_signature": "vector<string> findRelativeRanks(vector<int>& score) {",
"container": "Solution",
"callable": "findRelativeRanks",
"parameters": [
{
"name": "score",
"type": "vector<int>&"
}
],
"return_type": "vector<string>",
"signature_source": "leetcode/codeSnippets",
"type_so... |
507 | perfect-number | Easy | A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. A divisor of an integer x is an integer that can divide x evenly.
Given an integer n, return true if n is a perfect number, otherwise return false.
Example 1:
Input: num = 28
Output: true
Explanatio... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(num = 8128) == True\n assert candidate(num = 10) == False\n assert candidate(num = 100000000) == False\n assert candidate(num = 28) == True\n assert candidate(num = 12) == False\n assert candidate(num = 7) == False\n as... | [
"28",
"7"
] | [] | {
"canonical_parameter_names": [
"num"
],
"leetcode_dataset_entry_point": "Solution().checkPerfectNumber",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:38",
"tests_total": 49,
"test... | cpp | {
"raw_signature": "bool checkPerfectNumber(int num) {",
"container": "Solution",
"callable": "checkPerfectNumber",
"parameters": [
{
"name": "num",
"type": "int"
}
],
"return_type": "bool",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
509 | fibonacci-number | Easy | The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is,
F(0) = 0, F(1) = 1
F(n) = F(n - 1) + F(n - 2), for n > 1.
Given n, calculate F(n).
Example 1:
Input: n = 2
Output: 1
Explanation: F... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 0) == 0\n assert candidate(n = 3) == 2\n assert candidate(n = 30) == 832040\n assert candidate(n = 4) == 3\n assert candidate(n = 2) == 1\n assert candidate(n = 20) == 6765\n assert candidate(n = 1) == 1\n assert... | [
"2",
"3",
"4"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().fib",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:43",
"tests_total": 17,
"tests_dropped": 0,
... | cpp | {
"raw_signature": "int fib(int n) {",
"container": "Solution",
"callable": "fib",
"parameters": [
{
"name": "n",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
514 | freedom-trail | Hard | In the video game Fallout 4, the quest "Road to Freedom" requires players to reach a metal dial called the "Freedom Trail Ring" and use the dial to spell a specific keyword to open the door.
Given a string ring that represents the code engraved on the outer ring and another string key that represents the keyword that ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(ring = \"caotmcaataijjxi\",key = \"oatjiioijjjxxxcx\") == 42\n assert candidate(ring = \"godding\",key = \"gd\") == 4\n assert candidate(ring = \"pqwcx\",key = \"cpqwx\") == 13\n assert candidate(ring = \"edcba\",key = \"abc\") ... | [
"\"godding\"\n\"gd\"",
"\"godding\"\n\"godding\""
] | [] | {
"canonical_parameter_names": [
"ring",
"key"
],
"leetcode_dataset_entry_point": "Solution().findRotateSteps",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:48",
"tests_total": 70... | cpp | {
"raw_signature": "int findRotateSteps(string ring, string key) {",
"container": "Solution",
"callable": "findRotateSteps",
"parameters": [
{
"name": "ring",
"type": "string"
},
{
"name": "key",
"type": "string"
}
],
"return_type": "int",
"signature_source": "leetc... |
516 | longest-palindromic-subsequence | Medium | Given a string s, find the longest palindromic subsequence's length in s.
A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
Example 1:
Input: s = "bbbab"
Output: 4
Explanation: One possible longest palindromic s... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"abcba\") == 5\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == 1\n assert candidate(s = \"abcdcba\") == 7\n assert candidate(s = \"abcdedcba\") == 9\n assert candidate(s = \"noonhighnoon\") == 11\n assert ca... | [
"\"bbbab\"",
"\"cbbd\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().longestPalindromeSubseq",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:52",
"tests_total": 100,
"... | cpp | {
"raw_signature": "int longestPalindromeSubseq(string s) {",
"container": "Solution",
"callable": "longestPalindromeSubseq",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"... |
517 | super-washing-machines | Hard | You have n super washing machines on a line. Initially, each washing machine has some dresses or is empty.
For each move, you could choose any m (1 <= m <= n) washing machines, and pass one dress of each washing machine to one of its adjacent washing machines at the same time.
Given an integer array machines represen... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(machines = [0, 2, 0]) == -1\n assert candidate(machines = [9, 1, 8, 8, 9]) == 4\n assert candidate(machines = [0, 0, 18]) == 12\n assert candidate(machines = [1, 0, 0, 3, 0, 2, 0]) == -1\n assert candidate(machines = [100000]... | [
"[1,0,5]",
"[0,3,0]",
"[0,2,0]"
] | [] | {
"canonical_parameter_names": [
"machines"
],
"leetcode_dataset_entry_point": "Solution().findMinMoves",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:54",
"tests_total": 53,
"tests... | cpp | {
"raw_signature": "int findMinMoves(vector<int>& machines) {",
"container": "Solution",
"callable": "findMinMoves",
"parameters": [
{
"name": "machines",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnipp... |
518 | coin-change-ii | Medium | You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.
Return the number of combinations that make up that amount. If that amount of money cannot be made up by any combination of the coins, return 0.
You may assume that you have a... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(amount = 20,coins = [1, 5, 10]) == 9\n assert candidate(amount = 1,coins = [1]) == 1\n assert candidate(amount = 0,coins = [1, 2, 5]) == 1\n assert candidate(amount = 5000,coins = [1, 5, 10, 25, 50]) == 432699251\n assert can... | [
"5\n[1,2,5]",
"3\n[2]",
"10\n[10]"
] | [] | {
"canonical_parameter_names": [
"amount",
"coins"
],
"leetcode_dataset_entry_point": "Solution().change",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:57",
"tests_total": 124,
... | cpp | {
"raw_signature": "int change(int amount, vector<int>& coins) {",
"container": "Solution",
"callable": "change",
"parameters": [
{
"name": "amount",
"type": "int"
},
{
"name": "coins",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/... |
520 | detect-capital | Easy | We define the usage of capitals in a word to be right when one of the following cases holds:
- All letters in this word are capitals, like "USA".
- All letters in this word are not capitals, like "leetcode".
- Only the first letter in this word is capital, like "Google".
Given a string word, return true if the usage ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(word = \"AB\") == True\n assert candidate(word = \"Python\") == True\n assert candidate(word = \"python\") == True\n assert candidate(word = \"USA\") == True\n assert candidate(word = \"ab\") == True\n assert candidate(wor... | [
"\"USA\"",
"\"FlaG\""
] | [] | {
"canonical_parameter_names": [
"word"
],
"leetcode_dataset_entry_point": "Solution().detectCapitalUse",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:51:59",
"tests_total": 401,
"test... | cpp | {
"raw_signature": "bool detectCapitalUse(string word) {",
"container": "Solution",
"callable": "detectCapitalUse",
"parameters": [
{
"name": "word",
"type": "string"
}
],
"return_type": "bool",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
521 | longest-uncommon-subsequence-i | Easy | Given two strings a and b, return the length of the longest uncommon subsequence between a and b. If no such uncommon subsequence exists, return -1.
An uncommon subsequence between two strings is a string that is a subsequence of exactly one of them.
Example 1:
Input: a = "aba", b = "cdc"
Output: 3
Explanation: One ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(a = \"aaa\",b = \"bbb\") == 3\n assert candidate(a = \"same\",b = \"same\") == -1\n assert candidate(a = \"test\",b = \"testing\") == 7\n assert candidate(a = \"a\",b = \"b\") == 1\n assert candidate(a = \"abcde\",b = \"fghij... | [
"\"aba\"\n\"cdc\"",
"\"aaa\"\n\"bbb\"",
"\"aaa\"\n\"aaa\""
] | [
"Think very simple.",
"If a == b, the answer is -1.",
"Otherwise, the answer is the string a or the string b."
] | {
"canonical_parameter_names": [
"a",
"b"
],
"leetcode_dataset_entry_point": "Solution().findLUSlength",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:01",
"tests_total": 125,
"t... | cpp | {
"raw_signature": "int findLUSlength(string a, string b) {",
"container": "Solution",
"callable": "findLUSlength",
"parameters": [
{
"name": "a",
"type": "string"
},
{
"name": "b",
"type": "string"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippe... |
522 | longest-uncommon-subsequence-ii | Medium | Given an array of strings strs, return the length of the longest uncommon subsequence between them. If the longest uncommon subsequence does not exist, return -1.
An uncommon subsequence between an array of strings is a string that is a subsequence of one string but not the others.
A subsequence of a string s is a st... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(strs = ['aaa', 'aaa', 'aa']) == -1\n assert candidate(strs = ['a', 'b', 'c', 'd', 'e']) == 1\n assert candidate(strs = ['a', 'a', 'a', 'a']) == -1\n assert candidate(strs = ['xyz', 'xy', 'xz', 'yzz']) == 3\n assert candidate(... | [
"[\"aba\",\"cdc\",\"eae\"]",
"[\"aaa\",\"aaa\",\"aa\"]"
] | [] | {
"canonical_parameter_names": [
"strs"
],
"leetcode_dataset_entry_point": "Solution().findLUSlength",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:04",
"tests_total": 106,
"tests_d... | cpp | {
"raw_signature": "int findLUSlength(vector<string>& strs) {",
"container": "Solution",
"callable": "findLUSlength",
"parameters": [
{
"name": "strs",
"type": "vector<string>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnipp... |
523 | continuous-subarray-sum | Medium | Given an integer array nums and an integer k, return true if nums has a good subarray or false otherwise.
A good subarray is a subarray where:
- its length is at least two, and
- the sum of the elements of the subarray is a multiple of k.
Note that:
- A subarray is a contiguous part of the array.
- An integer x is ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [2, 5, 31, 4, 5, 1],k = 5) == True\n assert candidate(nums = [1, 2, 3, 4, 5],k = 9) == True\n assert candidate(nums = [23, 2, 6, 4, 7],k = 6) == True\n assert candidate(nums = [2, 5, 4, 5, 10],k = 3) == True\n assert c... | [
"[23,2,4,6,7]\n6",
"[23,2,6,4,7]\n6",
"[23,2,6,4,7]\n13"
] | [] | {
"canonical_parameter_names": [
"nums",
"k"
],
"leetcode_dataset_entry_point": "Solution().checkSubarraySum",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:06",
"tests_total": 121... | cpp | {
"raw_signature": "bool checkSubarraySum(vector<int>& nums, int k) {",
"container": "Solution",
"callable": "checkSubarraySum",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
},
{
"name": "k",
"type": "int"
}
],
"return_type": "bool",
"signature_source": ... |
524 | longest-word-in-dictionary-through-deleting | Medium | Given a string s and a string array dictionary, return the longest string in the dictionary that can be formed by deleting some of the given string characters. If there is more than one possible result, return the longest word with the smallest lexicographical order. If there is no possible result, return the empty str... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"a\",dictionary = ['b', 'c', 'd']) == \"\"\n assert candidate(s = \"zcfzdb\",dictionary = ['a', 'b', 'c']) == \"b\"\n assert candidate(s = \"aaaaaaa\",dictionary = ['aaa', 'aaaa']) == \"aaaa\"\n assert candidate(s = \"xyz\"... | [
"\"abpcplea\"\n[\"ale\",\"apple\",\"monkey\",\"plea\"]",
"\"abpcplea\"\n[\"a\",\"b\",\"c\"]"
] | [] | {
"canonical_parameter_names": [
"s",
"dictionary"
],
"leetcode_dataset_entry_point": "Solution().findLongestWord",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:08",
"tests_total"... | cpp | {
"raw_signature": "string findLongestWord(string s, vector<string>& dictionary) {",
"container": "Solution",
"callable": "findLongestWord",
"parameters": [
{
"name": "s",
"type": "string"
},
{
"name": "dictionary",
"type": "vector<string>&"
}
],
"return_type": "strin... |
525 | contiguous-array | Medium | Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1.
Example 1:
Input: nums = [0,1]
Output: 2
Explanation: [0, 1] is the longest contiguous subarray with an equal number of 0 and 1.
Example 2:
Input: nums = [0,1,0]
Output: 2
Explanation: [0, 1] (or [1, 0]) i... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [0, 1, 1, 0, 1, 1, 0, 0]) == 8\n assert candidate(nums = [1, 0, 0, 1, 0, 1, 1]) == 6\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1, 0]) == 8\n assert candidate(nums = [0, 1, 1, 1, 1, 1, 0, 0, 0]) == 6\n assert candida... | [
"[0,1]",
"[0,1,0]",
"[0,1,1,1,1,1,0,0,0]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().findMaxLength",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:10",
"tests_total": 111,
"tests_d... | cpp | {
"raw_signature": "int findMaxLength(vector<int>& nums) {",
"container": "Solution",
"callable": "findMaxLength",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
526 | beautiful-arrangement | Medium | Suppose you have n integers labeled 1 through n. A permutation of those n integers perm (1-indexed) is considered a beautiful arrangement if for every i (1 <= i <= n), either of the following is true:
- perm[i] is divisible by i.
- i is divisible by perm[i].
Given an integer n, return the number of the beautiful arra... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 8) == 132\n assert candidate(n = 3) == 3\n assert candidate(n = 11) == 750\n assert candidate(n = 15) == 24679\n assert candidate(n = 4) == 8\n assert candidate(n = 12) == 4010\n assert candidate(n = 14) == 10680\n ... | [
"2",
"1"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().countArrangement",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:13",
"tests_total": 15,
"tests_dr... | cpp | {
"raw_signature": "int countArrangement(int n) {",
"container": "Solution",
"callable": "countArrangement",
"parameters": [
{
"name": "n",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
529 | minesweeper | Medium | Let's play the minesweeper game (Wikipedia, online game)!
You are given an m x n char matrix board representing the game board where:
- 'M' represents an unrevealed mine,
- 'E' represents an unrevealed empty square,
- 'B' represents a revealed blank square that has no adjacent mines (i.e., above, below, left, right, ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(board = [['E', 'E', 'E', 'E', 'E'], ['E', 'E', 'M', 'E', 'E'], ['E', 'E', 'E', 'E', 'E'], ['E', 'E', 'E', 'E', 'E']],click = [3, 0]) == [['B', '1', 'E', '1', 'B'], ['B', '1', 'M', '1', 'B'], ['B', '1', '1', '1', 'B'], ['B', 'B', 'B', 'B'... | [
"[[\"E\",\"E\",\"E\",\"E\",\"E\"],[\"E\",\"E\",\"M\",\"E\",\"E\"],[\"E\",\"E\",\"E\",\"E\",\"E\"],[\"E\",\"E\",\"E\",\"E\",\"E\"]]\n[3,0]",
"[[\"B\",\"1\",\"E\",\"1\",\"B\"],[\"B\",\"1\",\"M\",\"1\",\"B\"],[\"B\",\"1\",\"1\",\"1\",\"B\"],[\"B\",\"B\",\"B\",\"B\",\"B\"]]\n[1,2]"
] | [] | {
"canonical_parameter_names": [
"board",
"click"
],
"leetcode_dataset_entry_point": "Solution().updateBoard",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:17",
"tests_total": 119... | cpp | {
"raw_signature": "vector<vector<char>> updateBoard(vector<vector<char>>& board, vector<int>& click) {",
"container": "Solution",
"callable": "updateBoard",
"parameters": [
{
"name": "board",
"type": "vector<vector<char>>&"
},
{
"name": "click",
"type": "vector<int>&"
}
... |
532 | k-diff-pairs-in-an-array | Medium | Given an array of integers nums and an integer k, return the number of unique k-diff pairs in the array.
A k-diff pair is an integer pair (nums[i], nums[j]), where the following are true:
- 0 <= i, j < nums.length
- i != j
- |nums[i] - nums[j]| == k
Notice that |val| denotes the absolute value of val.
Example 1:
I... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 4, 5],k = 3) == 2\n assert candidate(nums = [6, 3, 5, 7, 2, 3, 3, 8, 2, 4],k = 2) == 5\n assert candidate(nums = [10, 20, 30, 40, 50],k = 10) == 4\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 5)... | [
"[3,1,4,1,5]\n2",
"[1,2,3,4,5]\n1",
"[1,3,1,5,4]\n0"
] | [] | {
"canonical_parameter_names": [
"nums",
"k"
],
"leetcode_dataset_entry_point": "Solution().findPairs",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:24",
"tests_total": 126,
"te... | cpp | {
"raw_signature": "int findPairs(vector<int>& nums, int k) {",
"container": "Solution",
"callable": "findPairs",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
},
{
"name": "k",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSn... |
537 | complex-number-multiplication | Medium | A complex number can be represented as a string on the form "real+imaginaryi" where:
- real is the real part and is an integer in the range [-100, 100].
- imaginary is the imaginary part and is an integer in the range [-100, 100].
- i^2 == -1.
Given two complex numbers num1 and num2 as strings, return a string of the... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(num1 = \"100+0i\",num2 = \"0+100i\") == \"0+10000i\"\n assert candidate(num1 = \"7+-8i\",num2 = \"-9+2i\") == \"-47+86i\"\n assert candidate(num1 = \"-50+-50i\",num2 = \"50+50i\") == \"0+-5000i\"\n assert candidate(num1 = \"1+-1... | [
"\"1+1i\"\n\"1+1i\"",
"\"1+-1i\"\n\"1+-1i\""
] | [] | {
"canonical_parameter_names": [
"num1",
"num2"
],
"leetcode_dataset_entry_point": "Solution().complexNumberMultiply",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:31",
"tests_tot... | cpp | {
"raw_signature": "string complexNumberMultiply(string num1, string num2) {",
"container": "Solution",
"callable": "complexNumberMultiply",
"parameters": [
{
"name": "num1",
"type": "string"
},
{
"name": "num2",
"type": "string"
}
],
"return_type": "string",
"signa... |
539 | minimum-time-difference | Medium | Given a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time-points in the list.
Example 1:
Input: timePoints = ["23:59","00:00"]
Output: 1
Example 2:
Input: timePoints = ["00:00","23:59","00:00"]
Output: 0
Constraints:
- 2 <= timePoints.length <= 2 * 10^... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(timePoints = ['01:01', '02:02', '03:03', '23:23']) == 61\n assert candidate(timePoints = ['12:34', '12:34', '12:34']) == 0\n assert candidate(timePoints = ['14:59', '15:00', '15:01', '15:02', '15:03']) == 1\n assert candidate(ti... | [
"[\"23:59\",\"00:00\"]",
"[\"00:00\",\"23:59\",\"00:00\"]"
] | [] | {
"canonical_parameter_names": [
"timePoints"
],
"leetcode_dataset_entry_point": "Solution().findMinDifference",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:36",
"tests_total": 84,
... | cpp | {
"raw_signature": "int findMinDifference(vector<string>& timePoints) {",
"container": "Solution",
"callable": "findMinDifference",
"parameters": [
{
"name": "timePoints",
"type": "vector<string>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source":... |
540 | single-element-in-a-sorted-array | Medium | You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once.
Return the single element that appears only once.
Your solution must run in O(log n) time and O(1) space.
Example 1:
Input: nums = [1,1,2,3,3,4,4,8,8]
Output: 2
Exa... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [5, 5, 6, 6, 7, 8, 8]) == 7\n assert candidate(nums = [0, 0, 1, 1, 2]) == 2\n assert candidate(nums = [2, 2, 3, 3, 4, 4, 5, 6, 6]) == 5\n assert candidate(nums = [10, 10, 20, 20, 30, 30, 40, 40, 50]) == 50\n assert can... | [
"[1,1,2,3,3,4,4,8,8]",
"[3,3,7,7,10,11,11]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().singleNonDuplicate",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:38",
"tests_total": 133,
"te... | cpp | {
"raw_signature": "int singleNonDuplicate(vector<int>& nums) {",
"container": "Solution",
"callable": "singleNonDuplicate",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeS... |
541 | reverse-string-ii | Easy | Given a string s and an integer k, reverse the first k characters for every 2k characters counting from the start of the string.
If there are fewer than k characters left, reverse all of them. If there are less than 2k but greater than or equal to k characters, then reverse the first k characters and leave the other a... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"abcdefgh\",k = 3) == \"cbadefhg\"\n assert candidate(s = \"abcdefg\",k = 1) == \"abcdefg\"\n assert candidate(s = \"abcdef\",k = 6) == \"fedcba\"\n assert candidate(s = \"a\",k = 1) == \"a\"\n assert candidate(s = \"abc... | [
"\"abcdefg\"\n2",
"\"abcd\"\n2"
] | [] | {
"canonical_parameter_names": [
"s",
"k"
],
"leetcode_dataset_entry_point": "Solution().reverseStr",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:41",
"tests_total": 104,
"test... | cpp | {
"raw_signature": "string reverseStr(string s, int k) {",
"container": "Solution",
"callable": "reverseStr",
"parameters": [
{
"name": "s",
"type": "string"
},
{
"name": "k",
"type": "int"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
... |
542 | 01-matrix | Medium | Given an m x n binary matrix mat, return the distance of the nearest 0 for each cell.
The distance between two cells sharing a common edge is 1.
Example 1:
Input: mat = [[0,0,0],[0,1,0],[0,0,0]]
Output: [[0,0,0],[0,1,0],[0,0,0]]
Example 2:
Input: mat = [[0,0,0],[0,1,0],[1,1,1]]
Output: [[0,0,0],[0,1,0],[1,2,1]]
C... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(mat = [[1, 0, 1, 1, 0, 0, 1, 0, 0, 1], [0, 1, 1, 0, 1, 0, 1, 0, 1, 1], [0, 0, 1, 0, 1, 0, 0, 1, 0, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1, 1], [0, 0, 0, 1, 1, 1, 1, 0, 1, 0], [1, 0, 1, 1, 0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 1, 0, 0, 1, 1], [1, 0,... | [
"[[0,0,0],[0,1,0],[0,0,0]]",
"[[0,0,0],[0,1,0],[1,1,1]]"
] | [] | {
"canonical_parameter_names": [
"mat"
],
"leetcode_dataset_entry_point": "Solution().updateMatrix",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:43",
"tests_total": 67,
"tests_drop... | cpp | {
"raw_signature": "vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {",
"container": "Solution",
"callable": "updateMatrix",
"parameters": [
{
"name": "mat",
"type": "vector<vector<int>>&"
}
],
"return_type": "vector<vector<int>>",
"signature_source": "leetcode/codeSnippets"... |
546 | remove-boxes | Hard | You are given several boxes with different colors represented by different positive numbers.
You may experience several rounds to remove boxes until there is no box left. Each time you can choose some continuous boxes with the same color (i.e., composed of k boxes, k >= 1), remove them and get k * k points.
Return th... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(boxes = [1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4]) == 54\n assert candidate(boxes = [1, 1, 2, 2, 1, 1]) == 20\n assert candidate(boxes = [1, 2, 2, 1, 3, 3, 3, 4, 4, 4, 4, 5]) == 34\n assert candidate(boxes = [1, 1, 1, 2, 2, 2, ... | [
"[1,3,2,2,2,3,4,3,1]",
"[1,1,1]",
"[1]"
] | [] | {
"canonical_parameter_names": [
"boxes"
],
"leetcode_dataset_entry_point": "Solution().removeBoxes",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:52",
"tests_total": 122,
"tests_dr... | cpp | {
"raw_signature": "int removeBoxes(vector<int>& boxes) {",
"container": "Solution",
"callable": "removeBoxes",
"parameters": [
{
"name": "boxes",
"type": "vector<int>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
547 | number-of-provinces | Medium | There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly with city c.
A province is a group of directly or indirectly connected cities and no other cities outside of the group.
You... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(isConnected = [[1, 0, 0, 1], [0, 1, 1, 0], [0, 1, 1, 1], [1, 0, 1, 1]]) == 1\n assert candidate(isConnected = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]) == 3\n assert candidate(isConnected = [[1, 1, 0], [1, 1, 0], [0, 0, 1]]) == 2\n ass... | [
"[[1,1,0],[1,1,0],[0,0,1]]",
"[[1,0,0],[0,1,0],[0,0,1]]"
] | [] | {
"canonical_parameter_names": [
"isConnected"
],
"leetcode_dataset_entry_point": "Solution().findCircleNum",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:52:54",
"tests_total": 57,
"t... | cpp | {
"raw_signature": "int findCircleNum(vector<vector<int>>& isConnected) {",
"container": "Solution",
"callable": "findCircleNum",
"parameters": [
{
"name": "isConnected",
"type": "vector<vector<int>>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_sour... |
551 | student-attendance-record-i | Easy | You are given a string s representing an attendance record for a student where each character signifies whether the student was absent, late, or present on that day. The record only contains the following three characters:
- 'A': Absent.
- 'L': Late.
- 'P': Present.
The student is eligible for an attendance award if ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"AALL\") == False\n assert candidate(s = \"LLA\") == True\n assert candidate(s = \"PPALLPLL\") == True\n assert candidate(s = \"PLPLPL\") == True\n assert candidate(s = \"PA\") == True\n assert candidate(s = \"LLLLL\"... | [
"\"PPALLP\"",
"\"PPALLL\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().checkRecord",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:53:01",
"tests_total": 181,
"tests_droppe... | cpp | {
"raw_signature": "bool checkRecord(string s) {",
"container": "Solution",
"callable": "checkRecord",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "bool",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
552 | student-attendance-record-ii | Hard | An attendance record for a student can be represented as a string where each character signifies whether the student was absent, late, or present on that day. The record only contains the following three characters:
- 'A': Absent.
- 'L': Late.
- 'P': Present.
Any student is eligible for an attendance award if they me... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 3) == 19\n assert candidate(n = 100) == 985598218\n assert candidate(n = 2) == 8\n assert candidate(n = 1) == 3\n assert candidate(n = 10) == 3536\n assert candidate(n = 5) == 94\n assert candidate(n = 50) == 100469... | [
"2",
"1",
"10101"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().checkRecord",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:53:03",
"tests_total": 11,
"tests_dropped... | cpp | {
"raw_signature": "int checkRecord(int n) {",
"container": "Solution",
"callable": "checkRecord",
"parameters": [
{
"name": "n",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
553 | optimal-division | Medium | You are given an integer array nums. The adjacent integers in nums will perform the float division.
- For example, for nums = [2,3,4], we will evaluate the expression "2/3/4".
However, you can add any number of parenthesis at any position to change the priority of operations. You want to add these parentheses such th... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [10, 20, 30]) == \"10/(20/30)\"\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == \"2/(2/2/2/2/2/2/2/2/2)\"\n assert candidate(nums = [3, 100, 100, 100, 100, 100, 100, 100, 100, 100]) == \"3/(100/100/100/100/100/1... | [
"[1000,100,10,2]",
"[2,3,4]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().optimalDivision",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:53:06",
"tests_total": 114,
"tests... | cpp | {
"raw_signature": "string optimalDivision(vector<int>& nums) {",
"container": "Solution",
"callable": "optimalDivision",
"parameters": [
{
"name": "nums",
"type": "vector<int>&"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeS... |
554 | brick-wall | Medium | There is a rectangular brick wall in front of you with n rows of bricks. The i^th row has some number of bricks each of the same height (i.e., one unit) but they can be of different widths. The total width of each row is the same.
Draw a vertical line from the top to the bottom and cross the least bricks. If your line... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(wall = [[2], [2, 2], [2, 2, 2]]) == 1\n assert candidate(wall = [[2, 2, 2, 2], [2, 2, 2, 2], [2, 2, 2, 2]]) == 0\n assert candidate(wall = [[7], [8, 5, 7], [9, 1, 7, 5], [9, 3], [1, 5, 4], [2, 8, 2, 2], [1, 9, 1, 1, 1], [3, 5, 1, 2... | [
"[[1,2,2,1],[3,1,2],[1,3,2],[2,4],[3,1,2],[1,3,1,1]]",
"[[1],[1],[1]]"
] | [] | {
"canonical_parameter_names": [
"wall"
],
"leetcode_dataset_entry_point": "Solution().leastBricks",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:53:08",
"tests_total": 63,
"tests_drop... | cpp | {
"raw_signature": "int leastBricks(vector<vector<int>>& wall) {",
"container": "Solution",
"callable": "leastBricks",
"parameters": [
{
"name": "wall",
"type": "vector<vector<int>>&"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/cod... |
556 | next-greater-element-iii | Medium | Given a positive integer n, find the smallest integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such positive integer exists, return -1.
Note that the returned integer should fit in 32-bit integer, if there is a valid answer but it does not fit in 32-bit integer,... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 987654321) == -1\n assert candidate(n = 230241) == 230412\n assert candidate(n = 2147483476) == 2147483647\n assert candidate(n = 12) == 21\n assert candidate(n = 21) == -1\n assert candidate(n = 1234) == 1243\n ass... | [
"12",
"21"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().nextGreaterElement",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:53:12",
"tests_total": 80,
"tests_... | cpp | {
"raw_signature": "int nextGreaterElement(int n) {",
"container": "Solution",
"callable": "nextGreaterElement",
"parameters": [
{
"name": "n",
"type": "int"
}
],
"return_type": "int",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.