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
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, "...
typescript
{ "raw_signature": "function longestPalindromeSubseq(s: string): number {", "container": null, "callable": "longestPalindromeSubseq", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/co...
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...
typescript
{ "raw_signature": "function findMinMoves(machines: number[]): number {", "container": null, "callable": "findMinMoves", "parameters": [ { "name": "machines", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSn...
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, ...
typescript
{ "raw_signature": "function change(amount: number, coins: number[]): number {", "container": null, "callable": "change", "parameters": [ { "name": "amount", "type": "number" }, { "name": "coins", "type": "number[]" } ], "return_type": "number", "signature_source": ...
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...
typescript
{ "raw_signature": "function detectCapitalUse(word: string): boolean {", "container": null, "callable": "detectCapitalUse", "parameters": [ { "name": "word", "type": "string" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnip...
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...
typescript
{ "raw_signature": "function findLUSlength(a: string, b: string): number {", "container": null, "callable": "findLUSlength", "parameters": [ { "name": "a", "type": "string" }, { "name": "b", "type": "string" } ], "return_type": "number", "signature_source": "leetcod...
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...
typescript
{ "raw_signature": "function findLUSlength(strs: string[]): number {", "container": null, "callable": "findLUSlength", "parameters": [ { "name": "strs", "type": "string[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets...
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...
typescript
{ "raw_signature": "function checkSubarraySum(nums: number[], k: number): boolean {", "container": null, "callable": "checkSubarraySum", "parameters": [ { "name": "nums", "type": "number[]" }, { "name": "k", "type": "number" } ], "return_type": "boolean", "signature...
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"...
typescript
{ "raw_signature": "function findLongestWord(s: string, dictionary: string[]): string {", "container": null, "callable": "findLongestWord", "parameters": [ { "name": "s", "type": "string" }, { "name": "dictionary", "type": "string[]" } ], "return_type": "string", "s...
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...
typescript
{ "raw_signature": "function findMaxLength(nums: number[]): number {", "container": null, "callable": "findMaxLength", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "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...
typescript
{ "raw_signature": "function countArrangement(n: number): number {", "container": null, "callable": "countArrangement", "parameters": [ { "name": "n", "type": "number" } ], "return_type": "number", "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...
typescript
{ "raw_signature": "function updateBoard(board: string[][], click: number[]): string[][] {", "container": null, "callable": "updateBoard", "parameters": [ { "name": "board", "type": "string[][]" }, { "name": "click", "type": "number[]" } ], "return_type": "string[][]"...
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...
typescript
{ "raw_signature": "function findPairs(nums: number[], k: number): number {", "container": null, "callable": "findPairs", "parameters": [ { "name": "nums", "type": "number[]" }, { "name": "k", "type": "number" } ], "return_type": "number", "signature_source": "leetc...
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...
typescript
{ "raw_signature": "function complexNumberMultiply(num1: string, num2: string): string {", "container": null, "callable": "complexNumberMultiply", "parameters": [ { "name": "num1", "type": "string" }, { "name": "num2", "type": "string" } ], "return_type": "string", ...
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, ...
typescript
{ "raw_signature": "function findMinDifference(timePoints: string[]): number {", "container": null, "callable": "findMinDifference", "parameters": [ { "name": "timePoints", "type": "string[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "l...
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...
typescript
{ "raw_signature": "function singleNonDuplicate(nums: number[]): number {", "container": null, "callable": "singleNonDuplicate", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/co...
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...
typescript
{ "raw_signature": "function reverseStr(s: string, k: number): string {", "container": null, "callable": "reverseStr", "parameters": [ { "name": "s", "type": "string" }, { "name": "k", "type": "number" } ], "return_type": "string", "signature_source": "leetcode/code...
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...
typescript
{ "raw_signature": "function updateMatrix(mat: number[][]): number[][] {", "container": null, "callable": "updateMatrix", "parameters": [ { "name": "mat", "type": "number[][]" } ], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/code...
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...
typescript
{ "raw_signature": "function removeBoxes(boxes: number[]): number {", "container": null, "callable": "removeBoxes", "parameters": [ { "name": "boxes", "type": "number[]" } ], "return_type": "number", "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...
typescript
{ "raw_signature": "function findCircleNum(isConnected: number[][]): number {", "container": null, "callable": "findCircleNum", "parameters": [ { "name": "isConnected", "type": "number[][]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "lee...
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...
typescript
{ "raw_signature": "function checkRecord(s: string): boolean {", "container": null, "callable": "checkRecord", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "boolean", "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...
typescript
{ "raw_signature": "function checkRecord(n: number): number {", "container": null, "callable": "checkRecord", "parameters": [ { "name": "n", "type": "number" } ], "return_type": "number", "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...
typescript
{ "raw_signature": "function optimalDivision(nums: number[]): string {", "container": null, "callable": "optimalDivision", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnip...
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...
typescript
{ "raw_signature": "function leastBricks(wall: number[][]): number {", "container": null, "callable": "leastBricks", "parameters": [ { "name": "wall", "type": "number[][]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets...
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_...
typescript
{ "raw_signature": "function nextGreaterElement(n: number): number {", "container": null, "callable": "nextGreaterElement", "parameters": [ { "name": "n", "type": "number" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets...
557
reverse-words-in-a-string-iii
Easy
Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. Example 1: Input: s = "Let's take LeetCode contest" Output: "s'teL ekat edoCteeL tsetnoc" Example 2: Input: s = "Mr Ding" Output: "rM gniD" Constraints: - 1 <= s.length <= 5 *...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"Reverse each word\") == \"esreveR hcae drow\"\n assert candidate(s = \"Python Programming\") == \"nohtyP gnimmargorP\"\n assert candidate(s = \"Python is fun\") == \"nohtyP si nuf\"\n assert candidate(s = \"reverse each wo...
[ "\"Let's take LeetCode contest\"", "\"Mr Ding\"" ]
[]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().reverseWords", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:15", "tests_total": 91, "tests_droppe...
typescript
{ "raw_signature": "function reverseWords(s: string): string {", "container": null, "callable": "reverseWords", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
560
subarray-sum-equals-k
Medium
Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k. A subarray is a contiguous non-empty sequence of elements within an array. Example 1: Input: nums = [1,1,1], k = 2 Output: 2 Example 2: Input: nums = [1,2,3], k = 3 Output: 2 Constraints: - 1 <= nums.len...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 2, 2, 2, 2],k = 4) == 4\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 15) == 8\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 0) == 55\n assert candidate(nums = [1, 2, 1, 2, 1],k = 3) == 4...
[ "[1,1,1]\n2", "[1,2,3]\n3" ]
[ "Will Brute force work here? Try to optimize it.", "Can we optimize it by using some extra space?", "What about storing sum frequencies in a hash table? Will it be useful?", "sum(i,j)=sum(0,j)-sum(0,i), where sum(i,j) represents the sum of all the elements from index i to j-1. Can we use this property to opti...
{ "canonical_parameter_names": [ "nums", "k" ], "leetcode_dataset_entry_point": "Solution().subarraySum", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:17", "tests_total": 102, "...
typescript
{ "raw_signature": "function subarraySum(nums: number[], k: number): number {", "container": null, "callable": "subarraySum", "parameters": [ { "name": "nums", "type": "number[]" }, { "name": "k", "type": "number" } ], "return_type": "number", "signature_source": "l...
561
array-partition
Easy
Given an integer array nums of 2n integers, group these integers into n pairs (a_1, b_1), (a_2, b_2), ..., (a_n, b_n) such that the sum of min(a_i, b_i) for all i is maximized. Return the maximized sum. Example 1: Input: nums = [1,4,3,2] Output: 4 Explanation: All possible pairings (ignoring the ordering of elements)...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 28\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5]) == 20\n assert candidate(nums = [-10000, -9999, -9998, -9997, -9996, -9995, -9994, -9993]) == -39988\n assert candidate(nums = [1, 2, ...
[ "[1,4,3,2]", "[6,2,6,5,1,2]" ]
[ "Obviously, brute force won't help here. Think of something else, take some example like 1,2,3,4.", "How will you make pairs to get the result? There must be some pattern.", "Did you observe that- Minimum element gets add into the result in sacrifice of maximum element.", "Still won't able to find pairs? Sort...
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().arrayPairSum", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:19", "tests_total": 112, "tests_dr...
typescript
{ "raw_signature": "function arrayPairSum(nums: number[]): number {", "container": null, "callable": "arrayPairSum", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" ...
564
find-the-closest-palindrome
Hard
Given a string n representing an integer, return the closest integer (not including itself), which is a palindrome. If there is a tie, return the smaller one. The closest is defined as the absolute difference minimized between two integers. Example 1: Input: n = "123" Output: "121" Example 2: Input: n = "1" Output...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = \"10\") == \"9\"\n assert candidate(n = \"1001\") == \"999\"\n assert candidate(n = \"1234\") == \"1221\"\n assert candidate(n = \"123321\") == \"122221\"\n assert candidate(n = \"999999999\") == \"1000000001\"\n asser...
[ "\"123\"", "\"1\"" ]
[ "Will brute force work for this problem? Think of something else.", "Take some examples like 1234, 999,1000, etc and check their closest palindromes. How many different cases are possible?", "Do we have to consider only left half or right half of the string or both?", "Try to find the closest palindrome of th...
{ "canonical_parameter_names": [ "n" ], "leetcode_dataset_entry_point": "Solution().nearestPalindromic", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:26", "tests_total": 114, "tests...
typescript
{ "raw_signature": "function nearestPalindromic(n: string): string {", "container": null, "callable": "nearestPalindromic", "parameters": [ { "name": "n", "type": "string" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets...
565
array-nesting
Medium
You are given an integer array nums of length n where nums is a permutation of the numbers in the range [0, n - 1]. You should build a set s[k] = {nums[k], nums[nums[k]], nums[nums[nums[k]]], ... } subjected to the following rule: - The first element in s[k] starts with the selection of the element nums[k] of index =...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 0, 3, 4, 2]) == 3\n assert candidate(nums = [5, 1, 4, 2, 0, 6, 3]) == 6\n assert candidate(nums = [3, 2, 1, 0]) == 2\n assert candidate(nums = [1, 2, 0, 3]) == 3\n assert candidate(nums = [0, 2, 1]) == 2\n asser...
[ "[5,4,0,3,1,6,2]", "[0,1,2]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().arrayNesting", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:29", "tests_total": 97, "tests_dro...
typescript
{ "raw_signature": "function arrayNesting(nums: number[]): number {", "container": null, "callable": "arrayNesting", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" ...
566
reshape-the-matrix
Easy
In MATLAB, there is a handy function called reshape which can reshape an m x n matrix into a new one with a different size r x c keeping its original data. You are given an m x n matrix mat and two integers r and c representing the number of rows and the number of columns of the wanted reshaped matrix. The reshaped m...
{ "language": "python", "source": "def check(candidate):\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 1,c = 6) == [[1, 2, 3, 4, 5, 6]]\n assert candidate(mat = [[1, 2], [3, 4]],r = 1,c = 4) == [[1, 2, 3, 4]]\n assert candidate(mat = [[1, 2, 3], [4, 5, 6]],r = 3,c = 2) == [[1, 2], [3, 4], [5, 6]]\n ...
[ "[[1,2],[3,4]]\n1\n4", "[[1,2],[3,4]]\n2\n4" ]
[ "Do you know how 2d matrix is stored in 1d memory? Try to map 2-dimensions into one.", "M[i][j]=M[n*i+j] , where n is the number of cols. This is the one way of converting 2-d indices into one 1-d index. Now, how will you convert 1-d index into 2-d indices?", "Try to use division and modulus to convert 1-d inde...
{ "canonical_parameter_names": [ "mat", "r", "c" ], "leetcode_dataset_entry_point": "Solution().matrixReshape", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:31", "tests_total"...
typescript
{ "raw_signature": "function matrixReshape(mat: number[][], r: number, c: number): number[][] {", "container": null, "callable": "matrixReshape", "parameters": [ { "name": "mat", "type": "number[][]" }, { "name": "r", "type": "number" }, { "name": "c", "ty...
567
permutation-in-string
Medium
Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other words, return true if one of s1's permutations is the substring of s2. Example 1: Input: s1 = "ab", s2 = "eidbaooo" Output: true Explanation: s2 contains one permutation of s1 ("ba"). Example 2: Input: s1 = "a...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s1 = \"abc\",s2 = \"bbbccca\") == False\n assert candidate(s1 = \"adc\",s2 = \"dcda\") == True\n assert candidate(s1 = \"abc\",s2 = \"bbbccba\") == True\n assert candidate(s1 = \"abcde\",s2 = \"adecb\") == True\n assert candi...
[ "\"ab\"\n\"eidbaooo\"", "\"ab\"\n\"eidboaoo\"" ]
[ "Obviously, brute force will result in TLE. Think of something else.", "How will you check whether one string is a permutation of another string?", "One way is to sort the string and then compare. But, Is there a better way?", "If one string is a permutation of another string then they must have one common me...
{ "canonical_parameter_names": [ "s1", "s2" ], "leetcode_dataset_entry_point": "Solution().checkInclusion", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:33", "tests_total": 95, ...
typescript
{ "raw_signature": "function checkInclusion(s1: string, s2: string): boolean {", "container": null, "callable": "checkInclusion", "parameters": [ { "name": "s1", "type": "string" }, { "name": "s2", "type": "string" } ], "return_type": "boolean", "signature_source": ...
575
distribute-candies
Easy
Alice has n candies, where the i^th candy is of type candyType[i]. Alice noticed that she started to gain weight, so she visited a doctor. The doctor advised Alice to only eat n / 2 of the candies she has (n is always even). Alice likes her candies very much, and she wants to eat the maximum number of different types ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(candyType = [1, 2, 1, 3, 1, 2, 1, 3, 1, 2]) == 3\n assert candidate(candyType = [1, 1, 2, 3]) == 2\n assert candidate(candyType = [1, 1, 1, 2, 2, 2]) == 2\n assert candidate(candyType = [0, 0, 0, 0, 0, 0]) == 1\n assert candi...
[ "[1,1,2,2,3,3]", "[1,1,2,3]", "[6,6,6,6]" ]
[ "To maximize the number of kinds of candies, we should try to distribute candies such that Alice will gain all kinds.", "What is the upper limit of the number of kinds of candies Alice will gain? Remember candies are to distributed equally.", "Which data structure is the most suitable for finding the number of ...
{ "canonical_parameter_names": [ "candyType" ], "leetcode_dataset_entry_point": "Solution().distributeCandies", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:42", "tests_total": 106, ...
typescript
{ "raw_signature": "function distributeCandies(candyType: number[]): number {", "container": null, "callable": "distributeCandies", "parameters": [ { "name": "candyType", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "lee...
576
out-of-boundary-paths
Medium
There is an m x n grid with a ball. The ball is initially at the position [startRow, startColumn]. You are allowed to move the ball to one of the four adjacent cells in the grid (possibly out of the grid crossing the grid boundary). You can apply at most maxMove moves to the ball. Given the five integers m, n, maxMove...
{ "language": "python", "source": "def check(candidate):\n assert candidate(m = 3,n = 3,maxMove = 1,startRow = 1,startColumn = 1) == 0\n assert candidate(m = 5,n = 5,maxMove = 50,startRow = 0,startColumn = 0) == 101070018\n assert candidate(m = 2,n = 2,maxMove = 2,startRow = 0,startColumn = 0) == 6\n as...
[ "2\n2\n2\n0\n0", "1\n3\n3\n0\n1" ]
[ "Is traversing every path feasible? There are many possible paths for a small matrix. Try to optimize it.", "Can we use some space to store the number of paths and update them after every move?", "One obvious thing: the ball will go out of the boundary only by crossing it. Also, there is only one possible way t...
{ "canonical_parameter_names": [ "m", "n", "maxMove", "startRow", "startColumn" ], "leetcode_dataset_entry_point": "Solution().findPaths", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "20...
typescript
{ "raw_signature": "function findPaths(m: number, n: number, maxMove: number, startRow: number, startColumn: number): number {", "container": null, "callable": "findPaths", "parameters": [ { "name": "m", "type": "number" }, { "name": "n", "type": "number" }, { "...
581
shortest-unsorted-continuous-subarray
Medium
Given an integer array nums, you need to find one continuous subarray such that if you only sort this subarray in non-decreasing order, then the whole array will be sorted in non-decreasing order. Return the shortest such subarray and output its length. Example 1: Input: nums = [2,6,4,8,10,9,15] Output: 5 Explanatio...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 2, 4, 5]) == 2\n assert candidate(nums = [1, 2, 3, 5, 4]) == 2\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == 10\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 0\n assert candidate(...
[ "[2,6,4,8,10,9,15]", "[1,2,3,4]", "[1]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().findUnsortedSubarray", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:47", "tests_total": 158, "...
typescript
{ "raw_signature": "function findUnsortedSubarray(nums: number[]): number {", "container": null, "callable": "findUnsortedSubarray", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcod...
583
delete-operation-for-two-strings
Medium
Given two strings word1 and word2, return the minimum number of steps required to make word1 and word2 the same. In one step, you can delete exactly one character in either string. Example 1: Input: word1 = "sea", word2 = "eat" Output: 2 Explanation: You need one step to make "sea" to "ea" and another step to make "...
{ "language": "python", "source": "def check(candidate):\n assert candidate(word1 = \"abc\",word2 = \"def\") == 6\n assert candidate(word1 = \"abcde\",word2 = \"fghij\") == 10\n assert candidate(word1 = \"abcdefghijklmnopqrstuvwxyz\",word2 = \"zyxwvutsrqponmlkjihgfedcba\") == 50\n assert candidate(word1...
[ "\"sea\"\n\"eat\"", "\"leetcode\"\n\"etco\"" ]
[]
{ "canonical_parameter_names": [ "word1", "word2" ], "leetcode_dataset_entry_point": "Solution().minDistance", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:52", "tests_total": 104...
typescript
{ "raw_signature": "function minDistance(word1: string, word2: string): number {", "container": null, "callable": "minDistance", "parameters": [ { "name": "word1", "type": "string" }, { "name": "word2", "type": "string" } ], "return_type": "number", "signature_sourc...
587
erect-the-fence
Hard
You are given an array trees where trees[i] = [x_i, y_i] represents the location of a tree in the garden. Fence the entire garden using the minimum length of rope, as it is expensive. The garden is well-fenced only if all the trees are enclosed. Return the coordinates of trees that are exactly located on the fence pe...
{ "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,1],[2,2],[2,0],[2,4],[3,3],[4,2]]", "[[1,2],[2,2],[4,2]]" ]
[]
{ "canonical_parameter_names": [ "trees" ], "leetcode_dataset_entry_point": "Solution().outerTrees", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:54", "tests_total": 113, "tests_dro...
typescript
{ "raw_signature": "function outerTrees(trees: number[][]): number[][] {", "container": null, "callable": "outerTrees", "parameters": [ { "name": "trees", "type": "number[][]" } ], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/code...
591
tag-validator
Hard
Given a string representing a code snippet, implement a tag validator to parse the code and return whether it is valid. A code snippet is valid if all the following rules hold: 1. The code must be wrapped in a valid closed tag. Otherwise, the code is invalid. 2. A closed tag (not necessarily valid) has exactly the fo...
{ "language": "python", "source": "def check(candidate):\n assert candidate(code = \"<A>abc</A>\") == True\n assert candidate(code = \"<A><![CDATA[wahaha]]]></A>\") == True\n assert candidate(code = \"<A><B><![CDATA[CDATA]]></B></A>\") == True\n assert candidate(code = \"<A><B></C></B></A>\") == False\n...
[ "\"<DIV>This is the first line <![CDATA[<div>]]></DIV>\"", "\"<DIV>>> ![cdata[]] <![CDATA[<div>]>]]>]]>>]</DIV>\"", "\"<A> <B> </A> </B>\"" ]
[]
{ "canonical_parameter_names": [ "code" ], "leetcode_dataset_entry_point": "Solution().isValid", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:56", "tests_total": 231, "tests_dropped...
typescript
{ "raw_signature": "function isValid(code: string): boolean {", "container": null, "callable": "isValid", "parameters": [ { "name": "code", "type": "string" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
592
fraction-addition-and-subtraction
Medium
Given a string expression representing an expression of fraction addition and subtraction, return the calculation result in string format. The final result should be an irreducible fraction. If your final result is an integer, change it to the format of a fraction that has a denominator 1. So in this case, 2 should be...
{ "language": "python", "source": "def check(candidate):\n assert candidate(expression = \"9/10-1/5\") == \"7/10\"\n assert candidate(expression = \"5/6-1/3\") == \"1/2\"\n assert candidate(expression = \"-1/10-2/10-3/10-4/10\") == \"-1/1\"\n assert candidate(expression = \"3/4+1/4-1/2\") == \"1/2\"\n ...
[ "\"-1/2+1/2\"", "\"-1/2+1/2+1/3\"", "\"1/3-1/2\"" ]
[]
{ "canonical_parameter_names": [ "expression" ], "leetcode_dataset_entry_point": "Solution().fractionAddition", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:53:58", "tests_total": 126, ...
typescript
{ "raw_signature": "function fractionAddition(expression: string): string {", "container": null, "callable": "fractionAddition", "parameters": [ { "name": "expression", "type": "string" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcod...
593
valid-square
Medium
Given the coordinates of four points in 2D space p1, p2, p3 and p4, return true if the four points construct a square. The coordinate of a point p_i is represented as [x_i, y_i]. The input is not given in any order. A valid square has four equal sides with positive length and four equal angles (90-degree angles). Ex...
{ "language": "python", "source": "def check(candidate):\n assert candidate(p1 = [-1, -1],p2 = [-1, 1],p3 = [1, 1],p4 = [1, -1]) == True\n assert candidate(p1 = [1, 2],p2 = [3, 4],p3 = [5, 6],p4 = [7, 8]) == False\n assert candidate(p1 = [2, 2],p2 = [3, 3],p3 = [4, 4],p4 = [5, 5]) == False\n assert cand...
[ "[0,0]\n[1,1]\n[1,0]\n[0,1]", "[0,0]\n[1,1]\n[1,0]\n[0,12]", "[1,0]\n[-1,0]\n[0,1]\n[0,-1]" ]
[]
{ "canonical_parameter_names": [ "p1", "p2", "p3", "p4" ], "leetcode_dataset_entry_point": "Solution().validSquare", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:01", "tes...
typescript
{ "raw_signature": "function validSquare(p1: number[], p2: number[], p3: number[], p4: number[]): boolean {", "container": null, "callable": "validSquare", "parameters": [ { "name": "p1", "type": "number[]" }, { "name": "p2", "type": "number[]" }, { "name": "p3"...
594
longest-harmonious-subsequence
Easy
We define a harmonious array as an array where the difference between its maximum value and its minimum value is exactly 1. Given an integer array nums, return the length of its longest harmonious subsequence among all its possible subsequences. Example 1: Input: nums = [1,3,2,2,5,2,3,7] Output: 5 Explanation: The l...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [5, 5, 5, 6]) == 4\n assert candidate(nums = [-1, 0, -1, 0, -1, 0, -1]) == 7\n assert candidate(nums = [1, 1, 1, 1]) == 0\n assert candidate(nums = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]) == 9\n assert candidate...
[ "[1,3,2,2,5,2,3,7]", "[1,2,3,4]", "[1,1,1,1]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().findLHS", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:03", "tests_total": 116, "tests_dropped...
typescript
{ "raw_signature": "function findLHS(nums: number[]): number {", "container": null, "callable": "findLHS", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
598
range-addition-ii
Easy
You are given an m x n matrix M initialized with all 0's and an array of operations ops, where ops[i] = [a_i, b_i] means M[x][y] should be incremented by one for all 0 <= x < a_i and 0 <= y < b_i. Count and return the number of maximum integers in the matrix after performing all the operations. Example 1: Input: m =...
{ "language": "python", "source": "def check(candidate):\n assert candidate(m = 5,n = 4,ops = [[2, 2]]) == 4\n assert candidate(m = 1,n = 1,ops = []) == 1\n assert candidate(m = 2,n = 2,ops = [[2, 2], [1, 1], [2, 2]]) == 1\n assert candidate(m = 1,n = 1,ops = [[1, 1]]) == 1\n assert candidate(m = 4,n...
[ "3\n3\n[[2,2],[3,3]]", "3\n3\n[[2,2],[3,3],[3,3],[3,3],[2,2],[3,3],[3,3],[3,3],[2,2],[3,3],[3,3],[3,3]]", "3\n3\n[]" ]
[]
{ "canonical_parameter_names": [ "m", "n", "ops" ], "leetcode_dataset_entry_point": "Solution().maxCount", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:05", "tests_total": 112...
typescript
{ "raw_signature": "function maxCount(m: number, n: number, ops: number[][]): number {", "container": null, "callable": "maxCount", "parameters": [ { "name": "m", "type": "number" }, { "name": "n", "type": "number" }, { "name": "ops", "type": "number[][]" ...
599
minimum-index-sum-of-two-lists
Easy
Given two arrays of strings list1 and list2, find the common strings with the least index sum. A common string is a string that appeared in both list1 and list2. A common string with the least index sum is a common string such that if it appeared at list1[i] and list2[j] then i + j should be the minimum value among a...
{ "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 ...
[ "[\"Shogun\",\"Tapioca Express\",\"Burger King\",\"KFC\"]\n[\"Piatti\",\"The Grill at Torrey Pines\",\"Hungry Hunter Steakhouse\",\"Shogun\"]", "[\"Shogun\",\"Tapioca Express\",\"Burger King\",\"KFC\"]\n[\"KFC\",\"Shogun\",\"Burger King\"]", "[\"happy\",\"sad\",\"good\"]\n[\"sad\",\"happy\",\"good\"]" ]
[]
{ "canonical_parameter_names": [ "list1", "list2" ], "leetcode_dataset_entry_point": "Solution().findRestaurant", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:08", "tests_total": ...
typescript
{ "raw_signature": "function findRestaurant(list1: string[], list2: string[]): string[] {", "container": null, "callable": "findRestaurant", "parameters": [ { "name": "list1", "type": "string[]" }, { "name": "list2", "type": "string[]" } ], "return_type": "string[]", ...
600
non-negative-integers-without-consecutive-ones
Hard
Given a positive integer n, return the number of the integers in the range [0, n] whose binary representations do not contain consecutive ones. Example 1: Input: n = 5 Output: 5 Explanation: Here are the non-negative integers <= 5 with their corresponding binary representations: 0 : 0 1 : 1 2 : 10 3 : 11 4 : 100 5 : ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 100) == 34\n assert candidate(n = 15) == 8\n assert candidate(n = 1000000) == 17711\n assert candidate(n = 32) == 14\n assert candidate(n = 2) == 3\n assert candidate(n = 1) == 2\n assert candidate(n = 1000000000) =...
[ "5", "1", "2" ]
[]
{ "canonical_parameter_names": [ "n" ], "leetcode_dataset_entry_point": "Solution().findIntegers", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:10", "tests_total": 26, "tests_droppe...
typescript
{ "raw_signature": "function findIntegers(n: number): number {", "container": null, "callable": "findIntegers", "parameters": [ { "name": "n", "type": "number" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
605
can-place-flowers
Easy
You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots. Given an integer array flowerbed containing 0's and 1's, where 0 means empty and 1 means not empty, and an integer n, return true if n new flowers can be planted in the flowerbed wi...
{ "language": "python", "source": "def check(candidate):\n assert candidate(flowerbed = [1, 0, 0, 0, 0, 1],n = 2) == False\n assert candidate(flowerbed = [1, 0, 1, 0, 1],n = 0) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 1],n = 1) == True\n assert candidate(flowerbed = [1, 0, 0, 0, 1],n = 2) == ...
[ "[1,0,0,0,1]\n1", "[1,0,0,0,1]\n2" ]
[]
{ "canonical_parameter_names": [ "flowerbed", "n" ], "leetcode_dataset_entry_point": "Solution().canPlaceFlowers", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:12", "tests_total":...
typescript
{ "raw_signature": "function canPlaceFlowers(flowerbed: number[], n: number): boolean {", "container": null, "callable": "canPlaceFlowers", "parameters": [ { "name": "flowerbed", "type": "number[]" }, { "name": "n", "type": "number" } ], "return_type": "boolean", "s...
609
find-duplicate-file-in-system
Medium
Given a list paths of directory info, including the directory path, and all the files with contents in this directory, return all the duplicate files in the file system in terms of their paths. You may return the answer in any order. A group of duplicate files consists of at least two files that have the same content....
{ "language": "python", "source": "def answers_match(result, expected):\n \"\"\"The groups, and the items inside each group, may come in any order.\"\"\"\n def canonical(groups):\n return sorted((sorted(g, key=repr) if isinstance(g, list) else g for g in groups), key=repr)\n if isinstance(result, li...
[ "[\"root/a 1.txt(abcd) 2.txt(efgh)\",\"root/c 3.txt(abcd)\",\"root/c/d 4.txt(efgh)\",\"root 4.txt(efgh)\"]", "[\"root/a 1.txt(abcd) 2.txt(efgh)\",\"root/c 3.txt(abcd)\",\"root/c/d 4.txt(efgh)\"]" ]
[]
{ "canonical_parameter_names": [ "paths" ], "leetcode_dataset_entry_point": "Solution().findDuplicate", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:17", "tests_total": 83, "tests_d...
typescript
{ "raw_signature": "function findDuplicate(paths: string[]): string[][] {", "container": null, "callable": "findDuplicate", "parameters": [ { "name": "paths", "type": "string[]" } ], "return_type": "string[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/co...
611
valid-triangle-number
Medium
Given an integer array nums, return the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle. Example 1: Input: nums = [2,2,3,4] Output: 3 Explanation: Valid combinations are: 2,3,4 (using the first 2) 2,3,4 (using the second 2) 2,2,3 Example 2: Input: nums ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 2, 3, 4, 5]) == 7\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 22\n assert candidate(nums = [1, 1, 1, 1]) == 4\n assert candidate(nums = [4, 2, 3, 4]) == 4\n assert candidate(nums = [0, 1, 0, 1]) ==...
[ "[2,2,3,4]", "[4,2,3,4]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().triangleNumber", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:19", "tests_total": 115, "tests_...
typescript
{ "raw_signature": "function triangleNumber(nums: number[]): number {", "container": null, "callable": "triangleNumber", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippe...
621
task-scheduler
Medium
You are given an array of CPU tasks, each labeled with a letter from A to Z, and a number n. Each CPU interval can be idle or allow the completion of one task. Tasks can be completed in any order, but there's a constraint: there has to be a gap of at least n intervals between two tasks with the same label. Return the ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(tasks = ['A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'C', 'D', 'D', 'D'],n = 3) == 13\n assert candidate(tasks = ['A', 'B', 'C', 'D'],n = 0) == 4\n assert candidate(tasks = ['A', 'B', 'C', 'D', 'E', 'F', 'G'],n = 2) == 7\n assert ca...
[ "[\"A\",\"A\",\"A\",\"B\",\"B\",\"B\"]\n2", "[\"A\",\"C\",\"A\",\"B\",\"D\",\"B\"]\n1", "[\"A\",\"A\",\"A\", \"B\",\"B\",\"B\"]\n3" ]
[ "There are many different solutions for this problem, including a greedy algorithm.", "For every cycle, find the most frequent letter that can be placed in this cycle. After placing, decrease the frequency of that letter by one.", "Use Priority Queue." ]
{ "canonical_parameter_names": [ "tasks", "n" ], "leetcode_dataset_entry_point": "Solution().leastInterval", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:26", "tests_total": 86, ...
typescript
{ "raw_signature": "function leastInterval(tasks: string[], n: number): number {", "container": null, "callable": "leastInterval", "parameters": [ { "name": "tasks", "type": "string[]" }, { "name": "n", "type": "number" } ], "return_type": "number", "signature_sourc...
624
maximum-distance-in-arrays
Medium
You are given m arrays, where each array is sorted in ascending order. You can pick up two integers from two different arrays (each array picks one) and calculate the distance. We define the distance between two integers a and b to be their absolute difference |a - b|. Return the maximum distance. Example 1: Input:...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arrays = [[1, 2], [3, 4], [5, 6], [7, 8]]) == 7\n assert candidate(arrays = [[1, 2, 3], [4, 5], [1, 2, 3]]) == 4\n assert candidate(arrays = [[1, 3, 5], [2, 4, 6], [0, 7, 9]]) == 8\n assert candidate(arrays = [[-10000, 10000], [...
[ "[[1,2,3],[4,5],[1,2,3]]", "[[1],[1]]" ]
[]
{ "canonical_parameter_names": [ "arrays" ], "leetcode_dataset_entry_point": "Solution().maxDistance", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:31", "tests_total": 100, "tests_d...
typescript
{ "raw_signature": "function maxDistance(arrays: number[][]): number {", "container": null, "callable": "maxDistance", "parameters": [ { "name": "arrays", "type": "number[][]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnip...
628
maximum-product-of-three-numbers
Easy
You are given an integer array nums. Find three numbers whose product is maximum and return the maximum product. Example 1: Input: nums = [1,2,3] Output: 6 Explanation: The only three numbers are 1, 2, and 3, so the maximum product is 1 * 2 * 3 = 6. Example 2: Input: nums = [1,2,3,4] Output: 24 Explanation: The la...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [-10, -10, 5, 2]) == 500\n assert candidate(nums = [1, 2, 3, 4]) == 24\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 99]) == 99\n assert candidate(nums = [0, 2, 3, 5]) == 30\n assert candidate(nums = [0, 2, 3, -1, 5]) =...
[ "[1,2,3]", "[1,2,3,4]", "[-1,-2,-3]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().maximumProduct", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:35", "tests_total": 111, "tests_...
typescript
{ "raw_signature": "function maximumProduct(nums: number[]): number {", "container": null, "callable": "maximumProduct", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippe...
629
k-inverse-pairs-array
Hard
For an integer array nums, an inverse pair is a pair of integers [i, j] where 0 <= i < j < nums.length and nums[i] > nums[j]. Given two integers n and k, return the number of different arrays consisting of numbers from 1 to n such that there are exactly k inverse pairs. Since the answer can be huge, return it modulo 1...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 1000,k = 500) == 955735232\n assert candidate(n = 100,k = 0) == 1\n assert candidate(n = 20,k = 50) == 788876615\n assert candidate(n = 1000,k = 0) == 1\n assert candidate(n = 10,k = 10) == 21670\n assert candidate(n =...
[ "3\n0", "3\n1" ]
[]
{ "canonical_parameter_names": [ "n", "k" ], "leetcode_dataset_entry_point": "Solution().kInversePairs", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:38", "tests_total": 80, "te...
typescript
{ "raw_signature": "function kInversePairs(n: number, k: number): number {", "container": null, "callable": "kInversePairs", "parameters": [ { "name": "n", "type": "number" }, { "name": "k", "type": "number" } ], "return_type": "number", "signature_source": "leetcod...
630
course-schedule-iii
Hard
There are n different online courses numbered from 1 to n. You are given an array courses where courses[i] = [duration_i, lastDay_i] indicate that the i^th course should be taken continuously for duration_i days and must be finished before or on lastDay_i. You will start on the 1^st day and you cannot take two or more...
{ "language": "python", "source": "def check(candidate):\n assert candidate(courses = [[7, 17], [3, 12], [10, 20], [9, 10], [11, 15], [11, 16], [8, 13], [11, 17], [4, 11], [2, 12]]) == 4\n assert candidate(courses = [[100, 200], [200, 1300], [1000, 1250], [300, 3100]]) == 4\n assert candidate(courses = [[1...
[ "[[100,200],[200,1300],[1000,1250],[2000,3200]]", "[[1,2]]", "[[3,2],[4,3]]" ]
[ "During iteration, say I want to add the current course, currentTotalTime being total time of all courses taken till now, but adding the current course might exceed my deadline or it doesn’t. 1. If it doesn’t, then I have added one new course. Increment the currentTotalTime with duration of current course.", "2. ...
{ "canonical_parameter_names": [ "courses" ], "leetcode_dataset_entry_point": "Solution().scheduleCourse", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:40", "tests_total": 130, "tes...
typescript
{ "raw_signature": "function scheduleCourse(courses: number[][]): number {", "container": null, "callable": "scheduleCourse", "parameters": [ { "name": "courses", "type": "number[][]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/...
632
smallest-range-covering-elements-from-k-lists
Hard
You have k lists of sorted integers in non-decreasing order. Find the smallest range that includes at least one number from each of the k lists. We define the range [a, b] is smaller than range [c, d] if b - a < d - c or a < c if b - a == d - c. Example 1: Input: nums = [[4,10,15,24,26],[0,9,12,20],[5,18,22,30]] Out...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [[-10, -5, -3, -1], [0, 2, 4, 6], [5, 10, 15, 20]]) == [-1, 5]\n assert candidate(nums = [[1, 2, 3], [1, 2, 3], [1, 2, 3]]) == [1, 1]\n assert candidate(nums = [[1, 5, 9], [2, 6, 10], [3, 7, 11]]) == [1, 3]\n assert candi...
[ "[[4,10,15,24,26],[0,9,12,20],[5,18,22,30]]", "[[1,2,3],[1,2,3],[1,2,3]]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().smallestRange", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:42", "tests_total": 97, "tests_dr...
typescript
{ "raw_signature": "function smallestRange(nums: number[][]): number[] {", "container": null, "callable": "smallestRange", "parameters": [ { "name": "nums", "type": "number[][]" } ], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/code...
633
sum-of-square-numbers
Medium
Given a non-negative integer c, decide whether there're two integers a and b such that a^2 + b^2 = c. Example 1: Input: c = 5 Output: true Explanation: 1 * 1 + 2 * 2 = 5 Example 2: Input: c = 3 Output: false Constraints: - 0 <= c <= 2^31 - 1
{ "language": "python", "source": "def check(candidate):\n assert candidate(c = 0) == True\n assert candidate(c = 1000000001) == False\n assert candidate(c = 25) == True\n assert candidate(c = 2) == True\n assert candidate(c = 3) == False\n assert candidate(c = 5) == True\n assert candidate(c =...
[ "5", "3" ]
[]
{ "canonical_parameter_names": [ "c" ], "leetcode_dataset_entry_point": "Solution().judgeSquareSum", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:45", "tests_total": 52, "tests_drop...
typescript
{ "raw_signature": "function judgeSquareSum(c: number): boolean {", "container": null, "callable": "judgeSquareSum", "parameters": [ { "name": "c", "type": "number" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
636
exclusive-time-of-functions
Medium
On a single-threaded CPU, we execute a program containing n functions. Each function has a unique ID between 0 and n - 1. Function calls are stored in a call stack: when a function call starts, its ID is pushed onto the stack, and when a function call ends, its ID is popped off the stack. The function whose ID is at t...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 1,logs = ['0:start:0', '0:end:1']) == [2]\n assert candidate(n = 4,logs = ['0:start:0', '1:start:1', '2:start:2', '2:end:3', '1:end:4', '0:end:5', '3:start:6', '3:end:7']) == [2, 2, 2, 2]\n assert candidate(n = 4,logs = ['0:sta...
[ "2\n[\"0:start:0\",\"1:start:2\",\"1:end:5\",\"0:end:6\"]", "1\n[\"0:start:0\",\"0:start:2\",\"0:end:5\",\"0:start:6\",\"0:end:6\",\"0:end:7\"]", "2\n[\"0:start:0\",\"0:start:2\",\"0:end:5\",\"1:start:6\",\"1:end:6\",\"0:end:7\"]" ]
[]
{ "canonical_parameter_names": [ "n", "logs" ], "leetcode_dataset_entry_point": "Solution().exclusiveTime", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:49", "tests_total": 69, ...
typescript
{ "raw_signature": "function exclusiveTime(n: number, logs: string[]): number[] {", "container": null, "callable": "exclusiveTime", "parameters": [ { "name": "n", "type": "number" }, { "name": "logs", "type": "string[]" } ], "return_type": "number[]", "signature_sou...
638
shopping-offers
Medium
In LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or more different kinds of items with a sale price. You are given an integer array price where price[i] is the price of the i^th item, and an integer array needs where needs[...
{ "language": "python", "source": "def check(candidate):\n assert candidate(price = [10, 10, 10],special = [[3, 1, 0, 10], [1, 2, 1, 15]],needs = [2, 2, 1]) == 25\n assert candidate(price = [4, 10, 1, 1, 1],special = [[1, 1, 1, 1, 1, 7]],needs = [4, 10, 1, 1, 1]) == 109\n assert candidate(price = [10, 10, ...
[ "[2,5]\n[[3,0,5],[1,2,10]]\n[3,2]", "[2,3,4]\n[[1,1,0,4],[2,2,1,9]]\n[1,2,1]" ]
[]
{ "canonical_parameter_names": [ "price", "special", "needs" ], "leetcode_dataset_entry_point": "Solution().shoppingOffers", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:54", ...
typescript
{ "raw_signature": "function shoppingOffers(price: number[], special: number[][], needs: number[]): number {", "container": null, "callable": "shoppingOffers", "parameters": [ { "name": "price", "type": "number[]" }, { "name": "special", "type": "number[][]" }, { ...
639
decode-ways-ii
Hard
A message containing letters from A-Z can be encoded into numbers using the following mapping: 'A' -> "1" 'B' -> "2" ... 'Z' -> "26" To decode an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For example, "11106" can ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"*1*2*3*4*5*6*7*8*9*\") == 554657727\n assert candidate(s = \"26\") == 2\n assert candidate(s = \"2*\") == 15\n assert candidate(s = \"11106\") == 2\n assert candidate(s = \"210\") == 1\n assert candidate(s = \"******...
[ "\"*\"", "\"1*\"", "\"2*\"" ]
[]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().numDecodings", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:56", "tests_total": 157, "tests_dropp...
typescript
{ "raw_signature": "function numDecodings(s: string): number {", "container": null, "callable": "numDecodings", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
640
solve-the-equation
Medium
Solve a given equation and return the value of 'x' in the form of a string "x=#value". The equation contains only '+', '-' operation, the variable 'x' and its coefficient. You should return "No solution" if there is no solution for the equation, or "Infinite solutions" if there are infinite solutions for the equation. ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(equation = \"-x=x\") == \"x=0\"\n assert candidate(equation = \"0x=0\") == \"Infinite solutions\"\n assert candidate(equation = \"x+3x=4x\") == \"Infinite solutions\"\n assert candidate(equation = \"2x+3=3x+1\") == \"x=2\"\n ...
[ "\"x+5-3+x=6+x-2\"", "\"x=x\"", "\"2x=x\"" ]
[]
{ "canonical_parameter_names": [ "equation" ], "leetcode_dataset_entry_point": "Solution().solveEquation", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:54:58", "tests_total": 253, "tes...
typescript
{ "raw_signature": "function solveEquation(equation: string): string {", "container": null, "callable": "solveEquation", "parameters": [ { "name": "equation", "type": "string" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnip...
643
maximum-average-subarray-i
Easy
You are given an integer array nums consisting of n elements, and an integer k. Find a contiguous subarray whose length is equal to k that has the maximum average value and return this value. Any answer with a calculation error less than 10^-5 will be accepted. Example 1: Input: nums = [1,12,-5,-6,50,3], k = 4 Outpu...
{ "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,12,-5,-6,50,3]\n4", "[5]\n1" ]
[]
{ "canonical_parameter_names": [ "nums", "k" ], "leetcode_dataset_entry_point": "Solution().findMaxAverage", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:01", "tests_total": 95, ...
typescript
{ "raw_signature": "function findMaxAverage(nums: number[], k: number): number {", "container": null, "callable": "findMaxAverage", "parameters": [ { "name": "nums", "type": "number[]" }, { "name": "k", "type": "number" } ], "return_type": "number", "signature_sourc...
645
set-mismatch
Easy
You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the numbers in s got duplicated to another number in the set, which results in repetition of one number and loss of another number. You are given an integer array nums representing the data sta...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [3, 1, 2, 5, 3]) == [3, 4]\n assert candidate(nums = [10, 2, 8, 2, 5, 3, 9, 1, 4, 7]) == [2, 6]\n assert candidate(nums = [9, 1, 8, 5, 6, 7, 9, 2, 4]) == [9, 3]\n assert candidate(nums = [1, 2, 4, 6, 6]) == [6, 2]\n as...
[ "[1,2,2,4]", "[1,1]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().findErrorNums", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:05", "tests_total": 89, "tests_dr...
typescript
{ "raw_signature": "function findErrorNums(nums: number[]): number[] {", "container": null, "callable": "findErrorNums", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnip...
646
maximum-length-of-pair-chain
Medium
You are given an array of n pairs pairs where pairs[i] = [left_i, right_i] and left_i < right_i. A pair p2 = [c, d] follows a pair p1 = [a, b] if b < c. A chain of pairs can be formed in this fashion. Return the length longest chain which can be formed. You do not need to use up all the given intervals. You can sele...
{ "language": "python", "source": "def check(candidate):\n assert candidate(pairs = [[1, 20], [2, 3], [4, 5], [6, 7], [8, 9], [10, 11]]) == 5\n assert candidate(pairs = [[-10, -5], [-3, -1], [0, 2], [5, 6]]) == 4\n assert candidate(pairs = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]) == 5\n assert candida...
[ "[[1,2],[2,3],[3,4]]", "[[1,2],[7,8],[4,5]]" ]
[]
{ "canonical_parameter_names": [ "pairs" ], "leetcode_dataset_entry_point": "Solution().findLongestChain", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:08", "tests_total": 106, "tes...
typescript
{ "raw_signature": "function findLongestChain(pairs: number[][]): number {", "container": null, "callable": "findLongestChain", "parameters": [ { "name": "pairs", "type": "number[][]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/...
647
palindromic-substrings
Medium
Given a string s, return the number of palindromic substrings in it. A string is a palindrome when it reads the same backward as forward. A substring is a contiguous sequence of characters within the string. Example 1: Input: s = "abc" Output: 3 Explanation: Three palindromic strings: "a", "b", "c". Example 2: In...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"abba\") == 6\n assert candidate(s = \"aaaaa\") == 15\n assert candidate(s = \"babad\") == 7\n assert candidate(s = \"noon\") == 6\n assert candidate(s = \"banana\") == 10\n assert candidate(s = \"aabbbaa\") == 14\n ...
[ "\"abc\"", "\"aaa\"" ]
[ "How can we reuse a previously computed palindrome to compute a larger palindrome?", "If “aba” is a palindrome, is “xabax” a palindrome? Similarly is “xabay” a palindrome?", "Complexity based hint: If we use brute force and check whether for every start and end position a substring is a palindrome we have O(n^2...
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().countSubstrings", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:10", "tests_total": 140, "tests_dr...
typescript
{ "raw_signature": "function countSubstrings(s: string): number {", "container": null, "callable": "countSubstrings", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
648
replace-words
Medium
In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word derivative. For example, when the root "help" is followed by the word "ful", we can form a derivative "helpful". Given a dictionary consisting of many roots and a sentence consisting o...
{ "language": "python", "source": "def check(candidate):\n assert candidate(dictionary = ['a', 'aa', 'aaa'],sentence = \"aaaa aaa aa a\") == \"a a a a\"\n assert candidate(dictionary = ['base', 'bat', 'ba'],sentence = \"baseball batman bat\") == \"ba ba ba\"\n assert candidate(dictionary = ['dog', 'cat'],s...
[ "[\"cat\",\"bat\",\"rat\"]\n\"the cattle was rattled by the battery\"", "[\"a\",\"b\",\"c\"]\n\"aadsfasf absbs bbab cadsfafs\"" ]
[]
{ "canonical_parameter_names": [ "dictionary", "sentence" ], "leetcode_dataset_entry_point": "Solution().replaceWords", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:12", "tests_to...
typescript
{ "raw_signature": "function replaceWords(dictionary: string[], sentence: string): string {", "container": null, "callable": "replaceWords", "parameters": [ { "name": "dictionary", "type": "string[]" }, { "name": "sentence", "type": "string" } ], "return_type": "strin...
649
dota2-senate
Medium
In the world of Dota2, there are two parties: the Radiant and the Dire. The Dota2 senate consists of senators coming from two parties. Now the Senate wants to decide on a change in the Dota2 game. The voting for this change is a round-based procedure. In each round, each senator can exercise one of the two rights: - ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(senate = \"RDDRDR\") == \"Dire\"\n assert candidate(senate = \"RDD\") == \"Dire\"\n assert candidate(senate = \"DRDR\") == \"Dire\"\n assert candidate(senate = \"RDDRRD\") == \"Radiant\"\n assert candidate(senate = \"RDRDRDRD...
[ "\"RD\"", "\"RDD\"" ]
[]
{ "canonical_parameter_names": [ "senate" ], "leetcode_dataset_entry_point": "Solution().predictPartyVictory", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:14", "tests_total": 177, ...
typescript
{ "raw_signature": "function predictPartyVictory(senate: string): string {", "container": null, "callable": "predictPartyVictory", "parameters": [ { "name": "senate", "type": "string" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/...
650
2-keys-keyboard
Medium
There is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step: - Copy All: You can copy all the characters present on the screen (a partial copy is not allowed). - Paste: You can paste the characters which are copied last time. Given an integer n, retu...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 3) == 3\n assert candidate(n = 12) == 7\n assert candidate(n = 100) == 14\n assert candidate(n = 10) == 7\n assert candidate(n = 1000) == 21\n assert candidate(n = 5) == 5\n assert candidate(n = 4) == 4\n assert ...
[ "3", "1" ]
[ "How many characters may be there in the clipboard at the last step if n = 3? n = 7? n = 10? n = 24?" ]
{ "canonical_parameter_names": [ "n" ], "leetcode_dataset_entry_point": "Solution().minSteps", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:17", "tests_total": 65, "tests_dropped": ...
typescript
{ "raw_signature": "function minSteps(n: number): number {", "container": null, "callable": "minSteps", "parameters": [ { "name": "n", "type": "number" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
657
robot-return-to-origin
Easy
There is a robot starting at the position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) after it completes its moves. You are given a string moves that represents the move sequence of the robot where moves[i] represents its i^th move. Valid moves are 'R' (right...
{ "language": "python", "source": "def check(candidate):\n assert candidate(moves = \"LULLDDRRUURRDDLL\") == False\n assert candidate(moves = \"UUUUUUUUUUDDDDDDDDDDLLLLRRRR\") == True\n assert candidate(moves = \"UDLR\") == True\n assert candidate(moves = \"UUDDRRLL\") == True\n assert candidate(move...
[ "\"UD\"", "\"LL\"" ]
[]
{ "canonical_parameter_names": [ "moves" ], "leetcode_dataset_entry_point": "Solution().judgeCircle", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:30", "tests_total": 112, "tests_dr...
typescript
{ "raw_signature": "function judgeCircle(moves: string): boolean {", "container": null, "callable": "judgeCircle", "parameters": [ { "name": "moves", "type": "string" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
658
find-k-closest-elements
Medium
Given a sorted integer array arr, two integers k and x, return the k closest integers to x in the array. The result should also be sorted in ascending order. An integer a is closer to x than an integer b if: - |a - x| < |b - x|, or - |a - x| == |b - x| and a < b Example 1: Input: arr = [1,2,3,4,5], k = 4, x = 3 Out...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 3, 5, 7, 9],k = 4,x = 6) == [3, 5, 7, 9]\n assert candidate(arr = [1, 3, 5, 7, 9],k = 2,x = 6) == [5, 7]\n assert candidate(arr = [1, 3, 5, 7, 9],k = 1,x = 6) == [5]\n assert candidate(arr = [1, 3, 5, 7, 9],k = 5,x = 6...
[ "[1,2,3,4,5]\n4\n3", "[1,1,2,3,4,5]\n4\n-1" ]
[]
{ "canonical_parameter_names": [ "arr", "k", "x" ], "leetcode_dataset_entry_point": "Solution().findClosestElements", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:33", "tests_...
typescript
{ "raw_signature": "function findClosestElements(arr: number[], k: number, x: number): number[] {", "container": null, "callable": "findClosestElements", "parameters": [ { "name": "arr", "type": "number[]" }, { "name": "k", "type": "number" }, { "name": "x", ...
659
split-array-into-consecutive-subsequences
Medium
You are given an integer array nums that is sorted in non-decreasing order. Determine if it is possible to split nums into one or more subsequences such that both of the following conditions are true: - Each subsequence is a consecutive increasing sequence (i.e. each integer is exactly one more than the previous inte...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 4, 4, 5]) == False\n assert candidate(nums = [1, 2, 3, 4, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 10, 10, 10, 10]) == False\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 5]) == False\n assert candidate(nums = ...
[ "[1,2,3,3,4,5]", "[1,2,3,3,4,4,5,5]", "[1,2,3,4,4,5]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().isPossible", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:35", "tests_total": 123, "tests_drop...
typescript
{ "raw_signature": "function isPossible(nums: number[]): boolean {", "container": null, "callable": "isPossible", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
661
image-smoother
Easy
An image smoother is a filter of the size 3 x 3 that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding cells (i.e., the average of the nine cells in the blue smoother). If one or more of the surrounding cells of a cell is not present, we do not consider it in the...
{ "language": "python", "source": "def check(candidate):\n assert candidate(img = [[100, 200, 100], [200, 50, 200], [100, 200, 100]]) == [[137, 141, 137], [141, 138, 141], [137, 141, 137]]\n assert candidate(img = [[10, 20, 30], [40, 50, 60], [70, 80, 90]]) == [[30, 35, 40], [45, 50, 55], [60, 65, 70]]\n a...
[ "[[1,1,1],[1,0,1],[1,1,1]]", "[[100,200,100],[200,50,200],[100,200,100]]" ]
[]
{ "canonical_parameter_names": [ "img" ], "leetcode_dataset_entry_point": "Solution().imageSmoother", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:39", "tests_total": 81, "tests_dro...
typescript
{ "raw_signature": "function imageSmoother(img: number[][]): number[][] {", "container": null, "callable": "imageSmoother", "parameters": [ { "name": "img", "type": "number[][]" } ], "return_type": "number[][]", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/co...
664
strange-printer
Hard
There is a strange printer with the following two special properties: - The printer can only print a sequence of the same character each time. - At each turn, the printer can print new characters starting from and ending at any place and will cover the original existing characters. Given a string s, return the minimu...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"pppppppp\") == 1\n assert candidate(s = \"abcba\") == 3\n assert candidate(s = \"aabbaa\") == 2\n assert candidate(s = \"zzzzy\") == 2\n assert candidate(s = \"abababab\") == 5\n assert candidate(s = \"ppqpqr\") == 4...
[ "\"aaabbb\"", "\"aba\"" ]
[]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().strangePrinter", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:46", "tests_total": 102, "tests_dro...
typescript
{ "raw_signature": "function strangePrinter(s: string): number {", "container": null, "callable": "strangePrinter", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
665
non-decreasing-array
Medium
Given an array nums with n integers, your task is to check if it could become non-decreasing by modifying at most one element. We define an array is non-decreasing if nums[i] <= nums[i + 1] holds for every i (0-based) such that (0 <= i <= n - 2). Example 1: Input: nums = [4,2,3] Output: true Explanation: You could m...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 5, 4, 6]) == True\n assert candidate(nums = [10, 5, 7]) == True\n assert candidate(nums = [1, 2, 2, 3]) == True\n assert candidate(nums = [1, 2, 3, 5, 4]) == True\n assert candidate(nums = [1, 1, 1]) == True\...
[ "[4,2,3]", "[4,2,1]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().checkPossibility", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:49", "tests_total": 165, "test...
typescript
{ "raw_signature": "function checkPossibility(nums: number[]): boolean {", "container": null, "callable": "checkPossibility", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/code...
667
beautiful-arrangement-ii
Medium
Given two integers n and k, construct a list answer that contains n different positive integers ranging from 1 to n and obeys the following requirement: - Suppose this list is answer = [a_1, a_2, a_3, ... , a_n], then the list [|a_1 - a_2|, |a_2 - a_3|, |a_3 - a_4|, ... , |a_{n-1} - a_n|] has exactly k distinct intege...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 3,k = 1) == [1, 2, 3]\n assert candidate(n = 7,k = 4) == [1, 7, 2, 6, 5, 4, 3]\n assert candidate(n = 10,k = 5) == [1, 10, 2, 9, 3, 4, 5, 6, 7, 8]\n assert candidate(n = 5,k = 2) == [1, 5, 4, 3, 2]\n assert candidate(n = ...
[ "3\n1", "3\n2" ]
[]
{ "canonical_parameter_names": [ "n", "k" ], "leetcode_dataset_entry_point": "Solution().constructArray", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:55:53", "tests_total": 71, "t...
typescript
{ "raw_signature": "function constructArray(n: number, k: number): number[] {", "container": null, "callable": "constructArray", "parameters": [ { "name": "n", "type": "number" }, { "name": "k", "type": "number" } ], "return_type": "number[]", "signature_source": "l...
668
kth-smallest-number-in-multiplication-table
Hard
Nearly everyone has used the Multiplication Table. The multiplication table of size m x n is an integer matrix mat where mat[i][j] == i * j (1-indexed). Given three integers m, n, and k, return the k^th smallest element in the m x n multiplication table. Example 1: Input: m = 3, n = 3, k = 5 Output: 3 Explanation: T...
{ "language": "python", "source": "def check(candidate):\n assert candidate(m = 3,n = 3,k = 5) == 3\n assert candidate(m = 10,n = 10,k = 25) == 10\n assert candidate(m = 5,n = 5,k = 1) == 1\n assert candidate(m = 4,n = 4,k = 10) == 6\n assert candidate(m = 4,n = 4,k = 8) == 4\n assert candidate(m ...
[ "3\n3\n5", "2\n3\n6" ]
[]
{ "canonical_parameter_names": [ "m", "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:55:55", "tests_total": ...
typescript
{ "raw_signature": "function findKthNumber(m: number, n: number, k: number): number {", "container": null, "callable": "findKthNumber", "parameters": [ { "name": "m", "type": "number" }, { "name": "n", "type": "number" }, { "name": "k", "type": "number" ...
670
maximum-swap
Medium
You are given an integer num. You can swap two digits at most once to get the maximum valued number. Return the maximum valued number you can get. Example 1: Input: num = 2736 Output: 7236 Explanation: Swap the number 2 and the number 7. Example 2: Input: num = 9973 Output: 9973 Explanation: No swap. Constraints:...
{ "language": "python", "source": "def check(candidate):\n assert candidate(num = 9) == 9\n assert candidate(num = 12) == 21\n assert candidate(num = 21) == 21\n assert candidate(num = 0) == 0\n assert candidate(num = 98368) == 98863\n assert candidate(num = 11111) == 11111\n assert candidate(n...
[ "2736", "9973" ]
[]
{ "canonical_parameter_names": [ "num" ], "leetcode_dataset_entry_point": "Solution().maximumSwap", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:00", "tests_total": 119, "tests_drop...
typescript
{ "raw_signature": "function maximumSwap(num: number): number {", "container": null, "callable": "maximumSwap", "parameters": [ { "name": "num", "type": "number" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
672
bulb-switcher-ii
Medium
There is a room with n bulbs labeled from 1 to n that all are turned on initially, and four buttons on the wall. Each of the four buttons has a different functionality where: - Button 1: Flips the status of all the bulbs. - Button 2: Flips the status of all the bulbs with even labels (i.e., 2, 4, ...). - Button 3: Fli...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 1,presses = 1) == 2\n assert candidate(n = 5,presses = 3) == 8\n assert candidate(n = 1000,presses = 1000) == 8\n assert candidate(n = 4,presses = 2) == 7\n assert candidate(n = 2,presses = 1) == 3\n assert candidate(n...
[ "1\n1", "2\n1", "3\n1" ]
[]
{ "canonical_parameter_names": [ "n", "presses" ], "leetcode_dataset_entry_point": "Solution().flipLights", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:04", "tests_total": 90, ...
typescript
{ "raw_signature": "function flipLights(n: number, presses: number): number {", "container": null, "callable": "flipLights", "parameters": [ { "name": "n", "type": "number" }, { "name": "presses", "type": "number" } ], "return_type": "number", "signature_source": "l...
673
number-of-longest-increasing-subsequence
Medium
Given an integer array nums, return the number of longest increasing subsequences. Notice that the sequence has to be strictly increasing. Example 1: Input: nums = [1,3,5,4,7] Output: 2 Explanation: The two longest increasing subsequences are [1, 3, 4, 7] and [1, 3, 5, 7]. Example 2: Input: nums = [2,2,2,2,2] Outp...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [5, 4, 3, 2, 1]) == 5\n assert candidate(nums = [1]) == 1\n assert candidate(nums = [7, 7, 7, 7, 7, 7, 7]) == 7\n assert candidate(nums = [1, 2, 4, 3, 5, 4, 7, 2]) == 3\n assert candidate(nums = [1, 2]) == 1\n asser...
[ "[1,3,5,4,7]", "[2,2,2,2,2]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().findNumberOfLIS", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:07", "tests_total": 109, "tests...
typescript
{ "raw_signature": "function findNumberOfLIS(nums: number[]): number {", "container": null, "callable": "findNumberOfLIS", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnip...
674
longest-continuous-increasing-subsequence
Easy
Given an unsorted array of integers nums, return the length of the longest continuous increasing subsequence (i.e. subarray). The subsequence must be strictly increasing. A continuous increasing subsequence is defined by two indices l and r (l < r) such that it is [nums[l], nums[l + 1], ..., nums[r - 1], nums[r]] and ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 13, 15]) == 8\n assert candidate(nums = [1, 3, 5, 7, 9, 11, 4, 5, 6, 7, 8, 12]) == 6\n assert candidate(nums = [0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6]) == 7\n assert candidate(nums = [10, 9, 2, 5, 3, 7, 101,...
[ "[1,3,5,4,7]", "[2,2,2,2,2]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().findLengthOfLCIS", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:09", "tests_total": 134, "test...
typescript
{ "raw_signature": "function findLengthOfLCIS(nums: number[]): number {", "container": null, "callable": "findLengthOfLCIS", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSn...
675
cut-off-trees-for-golf-event
Hard
You are asked to cut off all the trees in a forest for a golf event. The forest is represented as an m x n matrix. In this matrix: - 0 means the cell cannot be walked through. - 1 represents an empty cell that can be walked through. - A number greater than 1 represents a tree in a cell that can be walked through, and ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(forest = [[1, 2, 3, 4], [0, 0, 0, 0], [5, 6, 7, 8], [9, 10, 11, 12]]) == -1\n assert candidate(forest = [[1, 1, 1, 1], [1, 0, 1, 1], [1, 1, 1, 1]]) == 0\n assert candidate(forest = [[1, 2, 3], [0, 0, 4], [7, 6, 5]]) == 6\n asser...
[ "[[1,2,3],[0,0,4],[7,6,5]]", "[[1,2,3],[0,0,0],[7,6,5]]", "[[2,3,4],[0,0,5],[8,7,6]]" ]
[]
{ "canonical_parameter_names": [ "forest" ], "leetcode_dataset_entry_point": "Solution().cutOffTree", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:11", "tests_total": 99, "tests_dro...
typescript
{ "raw_signature": "function cutOffTree(forest: number[][]): number {", "container": null, "callable": "cutOffTree", "parameters": [ { "name": "forest", "type": "number[][]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippe...
678
valid-parenthesis-string
Medium
Given a string s containing only three types of characters: '(', ')' and '*', return true if s is valid. The following rules define a valid string: - Any left parenthesis '(' must have a corresponding right parenthesis ')'. - Any right parenthesis ')' must have a corresponding left parenthesis '('. - Left parenthesis...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"(())*\") == True\n assert candidate(s = \"((((((**))))))\") == True\n assert candidate(s = \"(()*\") == True\n assert candidate(s = \"****\") == True\n assert candidate(s = \"(()****)\") == True\n assert candidate(s ...
[ "\"()\"", "\"(*)\"", "\"(*))\"", "\"(\"" ]
[ "Use backtracking to explore all possible combinations of treating '*' as either '(', ')', or an empty string. If any combination leads to a valid string, return true.", "DP[i][j] represents whether the substring s[i:j] is valid.", "Keep track of the count of open parentheses encountered so far. If you encounte...
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().checkValidString", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:13", "tests_total": 181, "tests_d...
typescript
{ "raw_signature": "function checkValidString(s: string): boolean {", "container": null, "callable": "checkValidString", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" ...
679
24-game
Hard
You are given an integer array cards of length 4. You have four cards, each containing a number in the range [1, 9]. You should arrange the numbers on these cards in a mathematical expression using the operators ['+', '-', '*', '/'] and the parentheses '(' and ')' to get the value 24. You are restricted with the follo...
{ "language": "python", "source": "def check(candidate):\n assert candidate(cards = [9, 9, 9, 9]) == False\n assert candidate(cards = [2, 8, 1, 4]) == True\n assert candidate(cards = [4, 4, 7, 7]) == True\n assert candidate(cards = [1, 3, 4, 6]) == True\n assert candidate(cards = [9, 5, 5, 1]) == Tru...
[ "[4,1,8,7]", "[1,2,1,2]" ]
[]
{ "canonical_parameter_names": [ "cards" ], "leetcode_dataset_entry_point": "Solution().judgePoint24", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:15", "tests_total": 109, "tests_d...
typescript
{ "raw_signature": "function judgePoint24(cards: number[]): boolean {", "container": null, "callable": "judgePoint24", "parameters": [ { "name": "cards", "type": "number[]" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippe...
680
valid-palindrome-ii
Easy
Given a string s, return true if the s can be palindrome after deleting at most one character from it. Example 1: Input: s = "aba" Output: true Example 2: Input: s = "abca" Output: true Explanation: You could delete the character 'c'. Example 3: Input: s = "abc" Output: false Constraints: - 1 <= s.length <= 10^...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"raceecar\") == True\n assert candidate(s = \"abcba\") == True\n assert candidate(s = \"deeee\") == True\n assert candidate(s = \"ab\") == True\n assert candidate(s = \"abc\") == False\n assert candidate(s = \"racecar...
[ "\"aba\"", "\"abca\"", "\"abc\"" ]
[]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().validPalindrome", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:17", "tests_total": 108, "tests_dr...
typescript
{ "raw_signature": "function validPalindrome(s: string): boolean {", "container": null, "callable": "validPalindrome", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
682
baseball-game
Easy
You are keeping the scores for a baseball game with strange rules. At the beginning of the game, you start with an empty record. You are given a list of strings operations, where operations[i] is the i^th operation you must apply to the record and is one of the following: - An integer x. - Record a new score of x. ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(operations = ['3', 'D', '+', '2', 'C', '+', '+', 'C', 'C', 'C']) == 9\n assert candidate(operations = ['10', '20', '30', 'D', '+']) == 210\n assert candidate(operations = ['3', '6', '+', 'D', 'C', '3', 'D', '+', '-2', 'D', '9', '+'...
[ "[\"5\",\"2\",\"C\",\"D\",\"+\"]", "[\"5\",\"-2\",\"4\",\"C\",\"D\",\"9\",\"+\",\"+\"]", "[\"1\",\"C\"]" ]
[]
{ "canonical_parameter_names": [ "operations" ], "leetcode_dataset_entry_point": "Solution().calPoints", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:22", "tests_total": 76, "tests_...
typescript
{ "raw_signature": "function calPoints(operations: string[]): number {", "container": null, "callable": "calPoints", "parameters": [ { "name": "operations", "type": "string[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnip...
684
redundant-connection
Medium
In this problem, a tree is an undirected graph that is connected and has no cycles. You are given a graph that started as a tree with n nodes labeled from 1 to n, with one additional edge added. The added edge has two different vertices chosen from 1 to n, and was not an edge that already existed. The graph is represe...
{ "language": "python", "source": "def check(candidate):\n assert candidate(edges = [[3, 4], [1, 2], [2, 4], [3, 5], [2, 5]]) == [2, 5]\n assert candidate(edges = [[1, 2], [2, 3], [1, 3]]) == [1, 3]\n assert candidate(edges = [[1, 4], [3, 4], [1, 3], [1, 2], [4, 5]]) == [1, 3]\n assert candidate(edges =...
[ "[[1,2],[1,3],[2,3]]", "[[1,2],[2,3],[3,4],[1,4],[1,5]]" ]
[]
{ "canonical_parameter_names": [ "edges" ], "leetcode_dataset_entry_point": "Solution().findRedundantConnection", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:26", "tests_total": 76, ...
typescript
{ "raw_signature": "function findRedundantConnection(edges: number[][]): number[] {", "container": null, "callable": "findRedundantConnection", "parameters": [ { "name": "edges", "type": "number[][]" } ], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_s...
685
redundant-connection-ii
Hard
In this problem, a rooted tree is a directed graph such that, there is exactly one node (the root) for which all other nodes are descendants of this node, plus every node has exactly one parent, except for the root node which has no parents. The given input is a directed graph that started as a rooted tree with n node...
{ "language": "python", "source": "def check(candidate):\n assert candidate(edges = [[3, 1], [4, 1], [5, 2], [3, 2], [3, 5]]) == [3, 1]\n assert candidate(edges = [[1, 2], [2, 3], [3, 1]]) == [3, 1]\n assert candidate(edges = [[3, 1], [4, 1], [5, 2], [3, 5], [4, 2]]) == [4, 1]\n assert candidate(edges =...
[ "[[1,2],[1,3],[2,3]]", "[[1,2],[2,3],[3,4],[4,1],[1,5]]" ]
[]
{ "canonical_parameter_names": [ "edges" ], "leetcode_dataset_entry_point": "Solution().findRedundantDirectedConnection", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:29", "tests_tota...
typescript
{ "raw_signature": "function findRedundantDirectedConnection(edges: number[][]): number[] {", "container": null, "callable": "findRedundantDirectedConnection", "parameters": [ { "name": "edges", "type": "number[][]" } ], "return_type": "number[]", "signature_source": "leetcode/codeSnip...
686
repeated-string-match
Medium
Given two strings a and b, return the minimum number of times you should repeat string a so that string b is a substring of it. If it is impossible for b to be a substring of a after repeating it, return -1. Notice: string "abc" repeated 0 times is "", repeated 1 time is "abc" and repeated 2 times is "abcabc". Exampl...
{ "language": "python", "source": "def check(candidate):\n assert candidate(a = \"abab\",b = \"abababab\") == 2\n assert candidate(a = \"ab\",b = \"aba\") == 2\n assert candidate(a = \"abc\",b = \"def\") == -1\n assert candidate(a = \"abc\",b = \"abcabc\") == 2\n assert candidate(a = \"aaaaaaaaaaaaaa...
[ "\"abcd\"\n\"cdabcdab\"", "\"a\"\n\"aa\"" ]
[]
{ "canonical_parameter_names": [ "a", "b" ], "leetcode_dataset_entry_point": "Solution().repeatedStringMatch", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:31", "tests_total": 144...
typescript
{ "raw_signature": "function repeatedStringMatch(a: string, b: string): number {", "container": null, "callable": "repeatedStringMatch", "parameters": [ { "name": "a", "type": "string" }, { "name": "b", "type": "string" } ], "return_type": "number", "signature_sourc...
688
knight-probability-in-chessboard
Medium
On an n x n chessboard, a knight starts at the cell (row, column) and attempts to make exactly k moves. The rows and columns are 0-indexed, so the top-left cell is (0, 0), and the bottom-right cell is (n - 1, n - 1). A chess knight has eight possible moves it can make, as illustrated below. Each move is two cells in a...
{ "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...
[ "3\n2\n0\n0", "1\n0\n0\n0" ]
[]
{ "canonical_parameter_names": [ "n", "k", "row", "column" ], "leetcode_dataset_entry_point": "Solution().knightProbability", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:35...
typescript
{ "raw_signature": "function knightProbability(n: number, k: number, row: number, column: number): number {", "container": null, "callable": "knightProbability", "parameters": [ { "name": "n", "type": "number" }, { "name": "k", "type": "number" }, { "name": "row...
689
maximum-sum-of-3-non-overlapping-subarrays
Hard
Given an integer array nums and an integer k, find three non-overlapping subarrays of length k with maximum sum and return them. Return the result as a list of indices representing the starting position of each interval (0-indexed). If there are multiple answers, return the lexicographically smallest one. Example 1: ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 2) == [0, 2, 4]\n assert candidate(nums = [1, 2, 1, 2, 6, 7, 5, 1, 9, 7, 4, 6],k = 3) == [3, 6, 9]\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
[ "[1,2,1,2,6,7,5,1]\n2", "[1,2,1,2,1,2,1,2,1]\n2" ]
[]
{ "canonical_parameter_names": [ "nums", "k" ], "leetcode_dataset_entry_point": "Solution().maxSumOfThreeSubarrays", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:37", "tests_total...
typescript
{ "raw_signature": "function maxSumOfThreeSubarrays(nums: number[], k: number): number[] {", "container": null, "callable": "maxSumOfThreeSubarrays", "parameters": [ { "name": "nums", "type": "number[]" }, { "name": "k", "type": "number" } ], "return_type": "number[]"...
691
stickers-to-spell-word
Hard
We are given n different types of stickers. Each sticker has a lowercase English word on it. You would like to spell out the given string target by cutting individual letters from your collection of stickers and rearranging them. You can use each sticker more than once if you want, and you have infinite quantities of ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(stickers = ['aaa', 'bbb'],target = \"aabbbccc\") == -1\n assert candidate(stickers = ['a', 'b', 'c'],target = \"abc\") == 3\n assert candidate(stickers = ['abc', 'abc'],target = \"abcabc\") == 2\n assert candidate(stickers = ['a...
[ "[\"with\",\"example\",\"science\"]\n\"thehat\"", "[\"notice\",\"possible\"]\n\"basicbasic\"" ]
[ "We want to perform an exhaustive search, but we need to speed it up based on the input data being random. For all stickers, we can ignore any letters that are not in the target word. When our candidate answer won't be smaller than an answer we have already found, we can stop searching this path. When a sticker dom...
{ "canonical_parameter_names": [ "stickers", "target" ], "leetcode_dataset_entry_point": "Solution().minStickers", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:39", "tests_total":...
typescript
{ "raw_signature": "function minStickers(stickers: string[], target: string): number {", "container": null, "callable": "minStickers", "parameters": [ { "name": "stickers", "type": "string[]" }, { "name": "target", "type": "string" } ], "return_type": "number", "sig...
692
top-k-frequent-words
Medium
Given an array of strings words and an integer k, return the k most frequent strings. Return the answer sorted by the frequency from highest to lowest. Sort the words with the same frequency by their lexicographical order. Example 1: Input: words = ["i","love","leetcode","i","love","coding"], k = 2 Output: ["i","lov...
{ "language": "python", "source": "def check(candidate):\n assert candidate(words = ['a', 'aa', 'aaa'],k = 1) == ['a']\n assert candidate(words = ['a', 'aa', 'aaa'],k = 2) == ['a', 'aa']\n assert candidate(words = ['i', 'love', 'leetcode', 'i', 'love', 'coding'],k = 2) == ['i', 'love']\n assert candidat...
[ "[\"i\",\"love\",\"leetcode\",\"i\",\"love\",\"coding\"]\n2", "[\"the\",\"day\",\"is\",\"sunny\",\"the\",\"the\",\"the\",\"sunny\",\"is\",\"is\"]\n4" ]
[]
{ "canonical_parameter_names": [ "words", "k" ], "leetcode_dataset_entry_point": "Solution().topKFrequent", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:42", "tests_total": 92, ...
typescript
{ "raw_signature": "function topKFrequent(words: string[], k: number): string[] {", "container": null, "callable": "topKFrequent", "parameters": [ { "name": "words", "type": "string[]" }, { "name": "k", "type": "number" } ], "return_type": "string[]", "signature_sou...
693
binary-number-with-alternating-bits
Easy
Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example 1: Input: n = 5 Output: true Explanation: The binary representation of 5 is: 101 Example 2: Input: n = 7 Output: false Explanation: The binary representation of 7 is: 111. Exampl...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 3) == False\n assert candidate(n = 11) == False\n assert candidate(n = 15) == False\n assert candidate(n = 2) == True\n assert candidate(n = 1) == True\n assert candidate(n = 7) == False\n assert candidate(n = 10) =...
[ "5", "7", "11" ]
[]
{ "canonical_parameter_names": [ "n" ], "leetcode_dataset_entry_point": "Solution().hasAlternatingBits", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:44", "tests_total": 72, "tests_...
typescript
{ "raw_signature": "function hasAlternatingBits(n: number): boolean {", "container": null, "callable": "hasAlternatingBits", "parameters": [ { "name": "n", "type": "number" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippe...
695
max-area-of-island
Medium
You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water. The area of an island is the number of cells with a value 1 in the island. Return the maximum area of an isl...
{ "language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0], [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0,...
[ "[[0,0,1,0,0,0,0,1,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,1,1,0,1,0,0,0,0,0,0,0,0],[0,1,0,0,1,1,0,0,1,0,1,0,0],[0,1,0,0,1,1,0,0,1,1,1,0,0],[0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,0],[0,0,0,0,0,0,0,1,1,0,0,0,0]]", "[[0,0,0,0,0,0,0,0]]" ]
[]
{ "canonical_parameter_names": [ "grid" ], "leetcode_dataset_entry_point": "Solution().maxAreaOfIsland", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:48", "tests_total": 59, "tests_...
typescript
{ "raw_signature": "function maxAreaOfIsland(grid: number[][]): number {", "container": null, "callable": "maxAreaOfIsland", "parameters": [ { "name": "grid", "type": "number[][]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/code...
696
count-binary-substrings
Easy
Given a binary string s, return the number of non-empty substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutively. Substrings that occur multiple times are counted the number of times they occur. Example 1: Input: s = "00110011" Output: 6 Expla...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"000111000111\") == 9\n assert candidate(s = \"01\") == 1\n assert candidate(s = \"110011\") == 4\n assert candidate(s = \"00110011\") == 6\n assert candidate(s = \"11110000\") == 4\n assert candidate(s = \"10101\") =...
[ "\"00110011\"", "\"10101\"" ]
[ "How many valid binary substrings exist in \"000111\", and how many in \"11100\"? What about \"00011100\"?" ]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().countBinarySubstrings", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:50", "tests_total": 158, "te...
typescript
{ "raw_signature": "function countBinarySubstrings(s: string): number {", "container": null, "callable": "countBinarySubstrings", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSn...
697
degree-of-an-array
Easy
Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your task is to find the smallest possible length of a (contiguous) subarray of nums, that has the same degree as nums. Example 1: Input: nums = [1,2,2,3,1] Output: 2 Explan...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 1, 2, 2, 2, 3]) == 3\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 10\n assert candidate(nums = [1, 2, 2, 3, 1]) == 2\n assert candidate(nums = [0, 0, 1, 1, 2, 2, 3, 3, 4, 4]) == 2\n assert candidate...
[ "[1,2,2,3,1]", "[1,2,2,3,1,4,2]" ]
[ "Say 5 is the only element that occurs the most number of times - for example, nums = [1, 5, 2, 3, 5, 4, 5, 6]. What is the answer?" ]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().findShortestSubArray", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:53", "tests_total": 93, "t...
typescript
{ "raw_signature": "function findShortestSubArray(nums: number[]): number {", "container": null, "callable": "findShortestSubArray", "parameters": [ { "name": "nums", "type": "number[]" } ], "return_type": "number", "signature_source": "leetcode/codeSnippets", "type_source": "leetcod...
698
partition-to-k-equal-sum-subsets
Medium
Given an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal. Example 1: Input: nums = [4,3,2,3,5,2,1], k = 4 Output: true Explanation: It is possible to divide it into 4 subsets (5), (1, 4), (2,3), (2,3) with equal sums. Example 2...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 2, 2, 2, 3, 4, 5],k = 4) == False\n assert candidate(nums = [4, 4, 6, 2, 3, 8, 10, 2, 10, 7],k = 4) == True\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1],k = 2) == True\n assert candidate(nums = [1, 2, 3, 4],k = ...
[ "[4,3,2,3,5,2,1]\n4", "[1,2,3,4]\n3" ]
[ "We can figure out what target each subset must sum to. Then, let's recursively search, where at each call to our function, we choose which of k subsets the next value will join." ]
{ "canonical_parameter_names": [ "nums", "k" ], "leetcode_dataset_entry_point": "Solution().canPartitionKSubsets", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:56", "tests_total":...
typescript
{ "raw_signature": "function canPartitionKSubsets(nums: number[], k: number): boolean {", "container": null, "callable": "canPartitionKSubsets", "parameters": [ { "name": "nums", "type": "number[]" }, { "name": "k", "type": "number" } ], "return_type": "boolean", "s...
699
falling-squares
Hard
There are several squares being dropped onto the X-axis of a 2D plane. You are given a 2D integer array positions where positions[i] = [left_i, sideLength_i] represents the i^th square with a side length of sideLength_i that is dropped with its left edge aligned with X-coordinate left_i. Each square is dropped one at...
{ "language": "python", "source": "def check(candidate):\n assert candidate(positions = [[4, 1], [2, 2], [1, 3], [3, 4]]) == [1, 2, 5, 9]\n assert candidate(positions = [[1, 5], [2, 2], [7, 3]]) == [5, 7, 7]\n assert candidate(positions = [[1, 3], [3, 2], [5, 1]]) == [3, 5, 5]\n assert candidate(positio...
[ "[[1,2],[2,3],[6,1]]", "[[100,100],[200,100]]" ]
[ "If positions = [[10, 20], [20, 30]], this is the same as [[1, 2], [2, 3]]. Currently, the values of positions are very large. Can you generalize this approach so as to make the values in positions manageable?" ]
{ "canonical_parameter_names": [ "positions" ], "leetcode_dataset_entry_point": "Solution().fallingSquares", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:56:58", "tests_total": 105, "t...
typescript
{ "raw_signature": "function fallingSquares(positions: number[][]): number[] {", "container": null, "callable": "fallingSquares", "parameters": [ { "name": "positions", "type": "number[][]" } ], "return_type": "number[]", "signature_source": "leetcode/codeSnippets", "type_source": "l...
704
binary-search
Easy
Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You must write an algorithm with O(log n) runtime complexity. Example 1: Input: nums = [-1,0,3,5,9,12], target = 9 Outpu...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [-10, 0, 10, 20, 30],target = -5) == -1\n assert candidate(nums = [1, 2, 3, 4, 5],target = 6) == -1\n assert candidate(nums = [-10, -9, -8, -7, -6, -5, -4, -3, -2, -1],target = 0) == -1\n assert candidate(nums = [1, 2, 3,...
[ "[-1,0,3,5,9,12]\n9", "[-1,0,3,5,9,12]\n2" ]
[]
{ "canonical_parameter_names": [ "nums", "target" ], "leetcode_dataset_entry_point": "Solution().search", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:57:04", "tests_total": 115, "...
typescript
{ "raw_signature": "function search(nums: number[], target: number): number {", "container": null, "callable": "search", "parameters": [ { "name": "nums", "type": "number[]" }, { "name": "target", "type": "number" } ], "return_type": "number", "signature_source": "l...
712
minimum-ascii-delete-sum-for-two-strings
Medium
Given two strings s1 and s2, return the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Input: s1 = "sea", s2 = "eat" Output: 231 Explanation: Deleting "s" from "sea" adds the ASCII value of "s" (115) to the sum. Deleting "t" from "eat" adds 116 to the sum. At the end, both strings are eq...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s1 = \"delete\",s2 = \"leet\") == 403\n assert candidate(s1 = \"aaa\",s2 = \"aa\") == 97\n assert candidate(s1 = \"abc\",s2 = \"abcde\") == 201\n assert candidate(s1 = \"abc\",s2 = \"def\") == 597\n assert candidate(s1 = \"pq...
[ "\"sea\"\n\"eat\"", "\"delete\"\n\"leet\"" ]
[ "Let dp(i, j) be the answer for inputs s1[i:] and s2[j:]." ]
{ "canonical_parameter_names": [ "s1", "s2" ], "leetcode_dataset_entry_point": "Solution().minimumDeleteSum", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:57:11", "tests_total": 115,...
typescript
{ "raw_signature": "function minimumDeleteSum(s1: string, s2: string): number {", "container": null, "callable": "minimumDeleteSum", "parameters": [ { "name": "s1", "type": "string" }, { "name": "s2", "type": "string" } ], "return_type": "number", "signature_source"...
713
subarray-product-less-than-k
Medium
You are given an array of integers nums and an integer k. Return the number of contiguous subarrays where the product of all the elements in the subarray is strictly less than k. Example 1: Input: nums = [10,5,2,6], k = 100 Output: 8 Explanation: The 8 subarrays that have product less than 100 are: [10], [5], [2], [...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 2, 5, 6, 1],k = 100) == 12\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 50) == 19\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9],k = 100) == 21\n assert candidate(nums = [6, 5, 1, 2, 3],k = 10...
[ "[686, 28, 455, 675, 605, 29, 942, 48, 502, 889, 854, 206, 231, 796, 272, 565, 887, 969, 558, 13, 22, 455, 145, 804, 15]\n515854", "[542, 433, 935, 193, 280, 849, 122, 107, 688, 913, 31, 311, 814, 507, 596, 109, 340, 981, 662, 145, 955, 692, 659, 46, 276, 734, 177, 727, 329, 320, 93, 78, 451, 129, 226, 491, 595, ...
[ "For each j, let opt(j) be the smallest i so that nums[i] * nums[i+1] * ... * nums[j] is less than k. opt is an increasing function." ]
{ "canonical_parameter_names": [ "nums", "k" ], "leetcode_dataset_entry_point": "Solution().numSubarrayProductLessThanK", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:57:13", "tests_...
typescript
{ "raw_signature": "function numSubarrayProductLessThanK(nums: number[], k: number): number {", "container": null, "callable": "numSubarrayProductLessThanK", "parameters": [ { "name": "nums", "type": "number[]" }, { "name": "k", "type": "number" } ], "return_type": "n...
714
best-time-to-buy-and-sell-stock-with-transaction-fee
Medium
You are given an array prices where prices[i] is the price of a given stock on the i^th day, and an integer fee representing a transaction fee. Find the maximum profit you can achieve. You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction. Note: - You may not...
{ "language": "python", "source": "def check(candidate):\n assert candidate(prices = [10, 20, 30, 40, 50],fee = 5) == 35\n assert candidate(prices = [1, 3, 2, 8, 4, 9],fee = 2) == 8\n assert candidate(prices = [1, 2, 3, 4, 5],fee = 1) == 3\n assert candidate(prices = [50, 40, 30, 20, 10],fee = 5) == 0\n...
[ "[1,3,2,8,4,9]\n2", "[1,3,7,5,10,3]\n3" ]
[ "Consider the first K stock prices. At the end, the only legal states are that you don't own a share of stock, or that you do. Calculate the most profit you could have under each of these two cases." ]
{ "canonical_parameter_names": [ "prices", "fee" ], "leetcode_dataset_entry_point": "Solution().maxProfit", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:57:15", "tests_total": 107, ...
typescript
{ "raw_signature": "function maxProfit(prices: number[], fee: number): number {", "container": null, "callable": "maxProfit", "parameters": [ { "name": "prices", "type": "number[]" }, { "name": "fee", "type": "number" } ], "return_type": "number", "signature_source"...
717
1-bit-and-2-bit-characters
Easy
We have two special characters: - The first character can be represented by one bit 0. - The second character can be represented by two bits (10 or 11). Given a binary array bits that ends with 0, return true if the last character must be a one-bit character. Example 1: Input: bits = [1,0,0] Output: true Explanatio...
{ "language": "python", "source": "def check(candidate):\n assert candidate(bits = [1, 1, 1, 0]) == False\n assert candidate(bits = [0, 0, 0, 0]) == True\n assert candidate(bits = [1, 0, 1, 1, 0]) == True\n assert candidate(bits = [0]) == True\n assert candidate(bits = [1, 1, 1, 1, 0]) == True\n a...
[ "[1,0,0]", "[1,1,1,0]" ]
[ "Keep track of where the next character starts. At the end, you want to know if you started on the last bit." ]
{ "canonical_parameter_names": [ "bits" ], "leetcode_dataset_entry_point": "Solution().isOneBitCharacter", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:57:18", "tests_total": 95, "test...
typescript
{ "raw_signature": "function isOneBitCharacter(bits: number[]): boolean {", "container": null, "callable": "isOneBitCharacter", "parameters": [ { "name": "bits", "type": "number[]" } ], "return_type": "boolean", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/co...
718
maximum-length-of-repeated-subarray
Medium
Given two integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays. Example 1: Input: nums1 = [1,2,3,2,1], nums2 = [3,2,1,4,7] Output: 3 Explanation: The repeated subarray with maximum length is [3,2,1]. Example 2: Input: nums1 = [0,0,0,0,0], nums2 = [0,0,0,0,0] Output: 5 ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums1 = [1, 2, 3, 2, 1],nums2 = [3, 2, 1, 4, 7]) == 3\n assert candidate(nums1 = [1, 2, 3],nums2 = [3, 4, 5]) == 1\n assert candidate(nums1 = [1, 0, 0, 0, 1],nums2 = [1, 0, 0, 0, 1]) == 5\n assert candidate(nums1 = [1],nums2 = [...
[ "[1,2,3,2,1]\n[3,2,1,4,7]", "[0,0,0,0,0]\n[0,0,0,0,0]" ]
[ "Use dynamic programming. dp[i][j] will be the longest common prefix of A[i:] and B[j:].", "The answer is max(dp[i][j]) over all i, j." ]
{ "canonical_parameter_names": [ "nums1", "nums2" ], "leetcode_dataset_entry_point": "Solution().findLength", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T19:57:20", "tests_total": 110,...
typescript
{ "raw_signature": "function findLength(nums1: number[], nums2: number[]): number {", "container": null, "callable": "findLength", "parameters": [ { "name": "nums1", "type": "number[]" }, { "name": "nums2", "type": "number[]" } ], "return_type": "number", "signature...