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 |
|---|---|---|---|---|---|---|---|---|---|
719 | find-k-th-smallest-pair-distance | Hard | The distance of a pair of integers a and b is defined as the absolute difference between a and b.
Given an integer array nums and an integer k, return the k^th smallest distance among all the pairs nums[i] and nums[j] where 0 <= i < j < nums.length.
Example 1:
Input: nums = [1,3,1], k = 1
Output: 0
Explanation: Here... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 4, 5],k = 10) == 4\n assert candidate(nums = [9, 10, 7, 10, 6, 1, 5, 4, 9, 8],k = 18) == 2\n assert candidate(nums = [62, 24, 6, 4, 40],k = 2) == 16\n assert candidate(nums = [5, 4, 3, 2, 1],k = 1) == 1\n ass... | [
"[1,3,1]\n1",
"[1,1,1]\n2",
"[1,6,1]\n3"
] | [
"Binary search for the answer. How can you check how many pairs have distance <= X?"
] | {
"canonical_parameter_names": [
"nums",
"k"
],
"leetcode_dataset_entry_point": "Solution().smallestDistancePair",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:22",
"tests_total":... | typescript | {
"raw_signature": "function smallestDistancePair(nums: number[], k: number): number {",
"container": null,
"callable": "smallestDistancePair",
"parameters": [
{
"name": "nums",
"type": "number[]"
},
{
"name": "k",
"type": "number"
}
],
"return_type": "number",
"sig... |
720 | longest-word-in-dictionary | Medium | Given an array of strings words representing an English Dictionary, return the longest word in words that can be built one character at a time by other words in words.
If there is more than one possible answer, return the longest word with the smallest lexicographical order. If there is no answer, return the empty str... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(words = ['a', 'ab', 'abc', 'abcd', 'abcde', 'abcdef', 'abcdefg', 'abcdefgh']) == \"abcdefgh\"\n assert candidate(words = ['a', 'b', 'c']) == \"a\"\n assert candidate(words = ['w', 'wo', 'wor', 'worl', 'world']) == \"world\"\n as... | [
"[\"w\",\"wo\",\"wor\",\"worl\",\"world\"]",
"[\"a\",\"banana\",\"app\",\"appl\",\"ap\",\"apply\",\"apple\"]"
] | [
"For every word in the input list, we can check whether all prefixes of that word are in the input list by using a Set."
] | {
"canonical_parameter_names": [
"words"
],
"leetcode_dataset_entry_point": "Solution().longestWord",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:24",
"tests_total": 116,
"tests_dr... | typescript | {
"raw_signature": "function longestWord(words: string[]): string {",
"container": null,
"callable": "longestWord",
"parameters": [
{
"name": "words",
"type": "string[]"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
... |
721 | accounts-merge | Medium | Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails representing emails of the account.
Now, we would like to merge these accounts. Two accounts definitely belong to the same person if there is some comm... | {
"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 ... | [
"[[\"John\",\"johnsmith@mail.com\",\"john_newyork@mail.com\"],[\"John\",\"johnsmith@mail.com\",\"john00@mail.com\"],[\"Mary\",\"mary@mail.com\"],[\"John\",\"johnnybravo@mail.com\"]]",
"[[\"Gabe\",\"Gabe0@m.co\",\"Gabe3@m.co\",\"Gabe1@m.co\"],[\"Kevin\",\"Kevin3@m.co\",\"Kevin5@m.co\",\"Kevin0@m.co\"],[\"Ethan\",\... | [
"For every pair of emails in the same account, draw an edge between those emails. The problem is about enumerating the connected components of this graph."
] | {
"canonical_parameter_names": [
"accounts"
],
"leetcode_dataset_entry_point": "Solution().accountsMerge",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:26",
"tests_total": 85,
"test... | typescript | {
"raw_signature": "function accountsMerge(accounts: string[][]): string[][] {",
"container": null,
"callable": "accountsMerge",
"parameters": [
{
"name": "accounts",
"type": "string[][]"
}
],
"return_type": "string[][]",
"signature_source": "leetcode/codeSnippets",
"type_source": "l... |
722 | remove-comments | Medium | Given a C++ program, remove comments from it. The program source is an array of strings source where source[i] is the i^th line of the source code. This represents the result of splitting the original source code string by the newline character '\n'.
In C++, there are two types of comments, line comments, and block co... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(source = ['/* This is a comment // with a line comment inside the block comment */', 'int x = 10;', 'cout << \"Hello World\";', '}']) == ['int x = 10;', 'cout << \"Hello World\";', '}']\n assert candidate(source = ['int main() {', ' ... | [
"[\"/*Test program */\", \"int main()\", \"{ \", \" // variable declaration \", \"int a, b, c;\", \"/* This is a test\", \" multiline \", \" comment for \", \" testing */\", \"a = b + c;\", \"}\"]",
"[\"a/*comment\", \"line\", \"more_comment*/b\"]"
] | [
"Carefully parse each line according to the following rules: * If we start a block comment and we aren't in a block, then we will skip over the next two characters and change our state to be in a block. * If we end a block comment and we are in a block, then we will skip over the next two characters and change our ... | {
"canonical_parameter_names": [
"source"
],
"leetcode_dataset_entry_point": "Solution().removeComments",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:28",
"tests_total": 102,
"test... | typescript | {
"raw_signature": "function removeComments(source: string[]): string[] {",
"container": null,
"callable": "removeComments",
"parameters": [
{
"name": "source",
"type": "string[]"
}
],
"return_type": "string[]",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/co... |
724 | find-pivot-index | Easy | Given an array of integers nums, calculate the pivot index of this array.
The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right.
If the index is on the left edge of the array, then the left sum is 0 because ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == -1\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == -1\n assert candidate(nums = [1]) == 0\n assert candidate(nums = [-1, -2, -3, -4, -5]) == -1\n assert candidate(nums ... | [
"[1,7,3,6,5,6]",
"[1,2,3]",
"[2,1,-1]"
] | [
"Create an array sumLeft where sumLeft[i] is the sum of all the numbers to the left of index i.",
"Create an array sumRight where sumRight[i] is the sum of all the numbers to the right of index i.",
"For each index i, check if sumLeft[i] equals sumRight[i]. If so, return i. If no such i is found, return -1."
] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().pivotIndex",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:33",
"tests_total": 95,
"tests_dropp... | typescript | {
"raw_signature": "function pivotIndex(nums: number[]): number {",
"container": null,
"callable": "pivotIndex",
"parameters": [
{
"name": "nums",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
726 | number-of-atoms | Hard | Given a string formula representing a chemical formula, return the count of each atom.
The atomic element always starts with an uppercase character, then zero or more lowercase letters, representing the name.
One or more digits representing that element's count may follow if the count is greater than 1. If the count ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(formula = \"(NH4)3PO4\") == \"H12N3O4P\"\n assert candidate(formula = \"(NH4)2SO4\") == \"H8N2O4S\"\n assert candidate(formula = \"Be32(Al2(SiO3)4)3\") == \"Al6Be32O36Si12\"\n assert candidate(formula = \"Mg(OH)2\") == \"H2MgO2\... | [
"\"H2O\"",
"\"Mg(OH)2\"",
"\"K4(ON(SO3)2)2\""
] | [
"To parse formula[i:], when we see a `'('`, we will parse recursively whatever is inside the brackets (up to the correct closing ending bracket) and add it to our count, multiplying by the following multiplicity if there is one. Otherwise, we should see an uppercase character: we will parse the rest of the letters ... | {
"canonical_parameter_names": [
"formula"
],
"leetcode_dataset_entry_point": "Solution().countOfAtoms",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:35",
"tests_total": 173,
"tests... | typescript | {
"raw_signature": "function countOfAtoms(formula: string): string {",
"container": null,
"callable": "countOfAtoms",
"parameters": [
{
"name": "formula",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets... |
728 | self-dividing-numbers | Easy | A self-dividing number is a number that is divisible by every digit it contains.
- For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0.
A self-dividing number is not allowed to contain the digit zero.
Given two integers left and right, return a list of all the self-dividin... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(left = 120,right = 130) == [122, 124, 126, 128]\n assert candidate(left = 47,right = 85) == [48, 55, 66, 77]\n assert candidate(left = 1,right = 100) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22, 24, 33, 36, 44, 48, 55, 66, 77, 88... | [
"1\n22",
"47\n85"
] | [
"For each number in the range, check whether it is self dividing by converting that number to a character array (or string in Python), then checking that each digit is nonzero and divides the original number."
] | {
"canonical_parameter_names": [
"left",
"right"
],
"leetcode_dataset_entry_point": "Solution().selfDividingNumbers",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:39",
"tests_tota... | typescript | {
"raw_signature": "function selfDividingNumbers(left: number, right: number): number[] {",
"container": null,
"callable": "selfDividingNumbers",
"parameters": [
{
"name": "left",
"type": "number"
},
{
"name": "right",
"type": "number"
}
],
"return_type": "number[]",
... |
730 | count-different-palindromic-subsequences | Hard | Given a string s, return the number of different non-empty palindromic subsequences in s. Since the answer may be very large, return it modulo 10^9 + 7.
A subsequence of a string is obtained by deleting zero or more characters from the string.
A sequence is palindromic if it is equal to the sequence reversed.
Two se... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"abba\") == 6\n assert candidate(s = \"abccba\") == 14\n assert candidate(s = \"abcba\") == 10\n assert candidate(s = \"abac\") == 5\n assert candidate(s = \"a\") == 1\n assert candidate(s = \"abcdabcdabcdabcdabcdabcd... | [
"\"bccb\"",
"\"abcdabcdabcdabcdabcdabcdabcdabcddcbadcbadcbadcbadcbadcbadcbadcba\""
] | [
"Let dp(i, j) be the answer for the string T = S[i:j+1] including the empty sequence. The answer is the number of unique characters in T, plus palindromes of the form \"a_a\", \"b_b\", \"c_c\", and \"d_d\", where \"_\" represents zero or more characters."
] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().countPalindromicSubsequences",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:42",
"tests_total": 79,... | typescript | {
"raw_signature": "function countPalindromicSubsequences(s: string): number {",
"container": null,
"callable": "countPalindromicSubsequences",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "l... |
733 | flood-fill | Easy | You are given an image represented by an m x n grid of integers image, where image[i][j] represents the pixel value of the image. You are also given three integers sr, sc, and color. Your task is to perform a flood fill on the image starting from the pixel image[sr][sc].
To perform a flood fill:
1. Begin with the sta... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(image = [[0, 0, 0], [0, 0, 0]],sr = 0,sc = 0,color = 0) == [[0, 0, 0], [0, 0, 0]]\n assert candidate(image = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],sr = 0,sc = 0,color = 3) == [[3, 3, 3], [3, 3, 3], [3, 3, 3]]\n assert candidate(image =... | [
"[[1,1,1],[1,1,0],[1,0,1]]\n1\n1\n2",
"[[0,0,0],[0,0,0]]\n0\n0\n0"
] | [
"Write a recursive function that paints the pixel if it's the correct color, then recurses on neighboring pixels."
] | {
"canonical_parameter_names": [
"image",
"sr",
"sc",
"color"
],
"leetcode_dataset_entry_point": "Solution().floodFill",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:44",
... | typescript | {
"raw_signature": "function floodFill(image: number[][], sr: number, sc: number, color: number): number[][] {",
"container": null,
"callable": "floodFill",
"parameters": [
{
"name": "image",
"type": "number[][]"
},
{
"name": "sr",
"type": "number"
},
{
"name": ... |
735 | asteroid-collision | Medium | We are given an array asteroids of integers representing asteroids in a row. The indices of the asteroid in the array represent their relative position in space.
For each asteroid, the absolute value represents its size, and the sign represents its direction (positive meaning right, negative meaning left). Each astero... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(asteroids = [1, -1, 2, -2, 3, -3]) == []\n assert candidate(asteroids = [8, -8]) == []\n assert candidate(asteroids = [-2, -2, 1, 1]) == [-2, -2, 1, 1]\n assert candidate(asteroids = [1, 2, 3, 4, 5, -1, -2, -3, -4, -5]) == [1, 2... | [
"[5,10,-5]",
"[8,-8]",
"[10,2,-5]",
"[3,5,-6,2,-1,4]"
] | [
"Say a row of asteroids is stable. What happens when a new asteroid is added on the right?"
] | {
"canonical_parameter_names": [
"asteroids"
],
"leetcode_dataset_entry_point": "Solution().asteroidCollision",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:48",
"tests_total": 123,
... | typescript | {
"raw_signature": "function asteroidCollision(asteroids: number[]): number[] {",
"container": null,
"callable": "asteroidCollision",
"parameters": [
{
"name": "asteroids",
"type": "number[]"
}
],
"return_type": "number[]",
"signature_source": "leetcode/codeSnippets",
"type_source": ... |
736 | parse-lisp-expression | Hard | You are given a string expression representing a Lisp-like expression to return the integer value of.
The syntax for these expressions is given as follows.
- An expression is either an integer, let expression, add expression, mult expression, or an assigned variable. Expressions always evaluate to a single integer.
-... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(expression = \"(let x 2 (mult x (let x 3 y 4 (add x y))))\") == 14\n assert candidate(expression = \"(let x 7 (let y 2 (let z 3 (mult x (add y z)))))\") == 35\n assert candidate(expression = \"(mult (let x 2 (mult 3 x)) (let x 2 (a... | [
"\"(let x 2 (mult x (let x 3 y 4 (add x y))))\"",
"\"(let x 3 x 2 x)\"",
"\"(let x 1 y 2 x (add x y) (add x y))\""
] | [
"* If the expression starts with a digit or '-', it's an integer: return it. * If the expression starts with a letter, it's a variable. Recall it by checking the current scope in reverse order. * Otherwise, group the tokens (variables or expressions) within this expression by counting the \"balance\" `bal` of the o... | {
"canonical_parameter_names": [
"expression"
],
"leetcode_dataset_entry_point": "Solution().evaluate",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:50",
"tests_total": 111,
"tests_... | typescript | {
"raw_signature": "function evaluate(expression: string): number {",
"container": null,
"callable": "evaluate",
"parameters": [
{
"name": "expression",
"type": "string"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
... |
738 | monotone-increasing-digits | Medium | An integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y.
Given an integer n, return the largest number that is less than or equal to n with monotone increasing digits.
Example 1:
Input: n = 10
Output: 9
Example 2:
Input: n = 1234
Output: 1234
Example 3:
Input:... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 999999999) == 999999999\n assert candidate(n = 111) == 111\n assert candidate(n = 100) == 99\n assert candidate(n = 1000) == 999\n assert candidate(n = 222) == 222\n assert candidate(n = 333) == 333\n assert candida... | [
"10",
"1234",
"332"
] | [
"Build the answer digit by digit, adding the largest possible one that would make the number still less than or equal to N."
] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().monotoneIncreasingDigits",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:55",
"tests_total": 111,
... | typescript | {
"raw_signature": "function monotoneIncreasingDigits(n: number): number {",
"container": null,
"callable": "monotoneIncreasingDigits",
"parameters": [
{
"name": "n",
"type": "number"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/... |
739 | daily-temperatures | Medium | Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait after the i^th day to get a warmer temperature. If there is no future day for which this is possible, keep answer[i] == 0 instead.
Example 1:
Input: temperatures... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(temperatures = [80, 79, 78, 77, 76, 75, 74, 73]) == [0, 0, 0, 0, 0, 0, 0, 0]\n assert candidate(temperatures = [73, 74, 75, 71, 69, 72, 76, 73]) == [1, 1, 4, 2, 1, 1, 0, 0]\n assert candidate(temperatures = [40, 39, 38, 37, 36, 35,... | [
"[73,74,75,71,69,72,76,73]",
"[30,40,50,60]",
"[30,60,90]"
] | [
"If the temperature is say, 70 today, then in the future a warmer temperature must be either 71, 72, 73, ..., 99, or 100. We could remember when all of them occur next."
] | {
"canonical_parameter_names": [
"temperatures"
],
"leetcode_dataset_entry_point": "Solution().dailyTemperatures",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:57",
"tests_total": 107... | typescript | {
"raw_signature": "function dailyTemperatures(temperatures: number[]): number[] {",
"container": null,
"callable": "dailyTemperatures",
"parameters": [
{
"name": "temperatures",
"type": "number[]"
}
],
"return_type": "number[]",
"signature_source": "leetcode/codeSnippets",
"type_sou... |
740 | delete-and-earn | Medium | You are given an integer array nums. You want to maximize the number of points you get by performing the following operation any number of times:
- Pick any nums[i] and delete it to earn nums[i] points. Afterwards, you must delete every element equal to nums[i] - 1 and every element equal to nums[i] + 1.
Return the m... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [2, 3, 5, 8, 13, 21]) == 50\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 60\n assert candidate(nums = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]) == 20\n assert candidate(nums = [2, 2, ... | [
"[3,4,2]",
"[2,2,3,3,3,4]"
] | [
"If you take a number, you might as well take them all. Keep track of what the value is of the subset of the input with maximum M when you either take or don't take M."
] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().deleteAndEarn",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:57:59",
"tests_total": 115,
"tests_d... | typescript | {
"raw_signature": "function deleteAndEarn(nums: number[]): number {",
"container": null,
"callable": "deleteAndEarn",
"parameters": [
{
"name": "nums",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets... |
741 | cherry-pickup | Hard | You are given an n x n grid representing a field of cherries, each cell is one of three possible integers.
- 0 means the cell is empty, so you can pass through,
- 1 means the cell contains a cherry that you can pick up and pass through, or
- -1 means the cell contains a thorn that blocks your way.
Return the maximum ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(grid = [[0, 1, -1], [1, 0, -1], [1, 1, 1]]) == 5\n assert candidate(grid = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]) == 0\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 1, 1], [1, 1, 0, 1], [1, 1, 1, 1]]) == 12\n ... | [
"[[0,1,-1],[1,0,-1],[1,1,1]]",
"[[1,1,-1],[1,-1,1],[-1,1,1]]"
] | [] | {
"canonical_parameter_names": [
"grid"
],
"leetcode_dataset_entry_point": "Solution().cherryPickup",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:02",
"tests_total": 77,
"tests_dro... | typescript | {
"raw_signature": "function cherryPickup(grid: number[][]): number {",
"container": null,
"callable": "cherryPickup",
"parameters": [
{
"name": "grid",
"type": "number[][]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippe... |
743 | network-delay-time | Medium | You are given a network of n nodes, labeled from 1 to n. You are also given times, a list of travel times as directed edges times[i] = (u_i, v_i, w_i), where u_i is the source node, v_i is the target node, and w_i is the time it takes for a signal to travel from source to target.
We will send a signal from a given nod... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(times = [[1, 2, 10], [2, 3, 10], [1, 3, 1]],n = 3,k = 1) == 10\n assert candidate(times = [[1, 2, 1]],n = 2,k = 1) == 1\n assert candidate(times = [[1, 2, 1], [2, 3, 2], [1, 3, 4]],n = 3,k = 1) == 3\n assert candidate(times = [[... | [
"[[2,1,1],[2,3,1],[3,4,1]]\n4\n2",
"[[1,2,1]]\n2\n1",
"[[1,2,1]]\n2\n2"
] | [
"We visit each node at some time, and if that time is better than the fastest time we've reached this node, we travel along outgoing edges in sorted order. Alternatively, we could use Dijkstra's algorithm."
] | {
"canonical_parameter_names": [
"times",
"n",
"k"
],
"leetcode_dataset_entry_point": "Solution().networkDelayTime",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:06",
"tests_t... | typescript | {
"raw_signature": "function networkDelayTime(times: number[][], n: number, k: number): number {",
"container": null,
"callable": "networkDelayTime",
"parameters": [
{
"name": "times",
"type": "number[][]"
},
{
"name": "n",
"type": "number"
},
{
"name": "k",
... |
744 | find-smallest-letter-greater-than-target | Easy | You are given an array of characters letters that is sorted in non-decreasing order, and a character target. There are at least two different characters in letters.
Return the smallest character in letters that is lexicographically greater than target. If such a character does not exist, return the first character in ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'],target = \"d\") == \"e\"\n assert candidate(letters = ['c', 'f', 'j'],target = \"c\") == \"f\"\n assert candidate(letters = ['x', 'x', 'y', 'y'],target = \"z\") == \"x\"\... | [
"[\"c\",\"f\",\"j\"]\n\"a\"",
"[\"c\",\"f\",\"j\"]\n\"c\"",
"[\"x\",\"x\",\"y\",\"y\"]\n\"z\""
] | [
"Try to find whether each of 26 next letters are in the given string array."
] | {
"canonical_parameter_names": [
"letters",
"target"
],
"leetcode_dataset_entry_point": "Solution().nextGreatestLetter",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:08",
"tests_t... | typescript | {
"raw_signature": "function nextGreatestLetter(letters: string[], target: string): string {",
"container": null,
"callable": "nextGreatestLetter",
"parameters": [
{
"name": "letters",
"type": "string[]"
},
{
"name": "target",
"type": "string"
}
],
"return_type": "str... |
746 | min-cost-climbing-stairs | Easy | You are given an integer array cost where cost[i] is the cost of i^th step on a staircase.
Once you pay the cost, you can either climb one or two steps.
You can either start from the step with index 0, or the step with index 1.
Return the minimum cost to reach the top of the staircase, which is the position just pas... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(cost = [999, 999, 999, 999]) == 1998\n assert candidate(cost = [1, 2, 3, 4, 5]) == 6\n assert candidate(cost = [1, 100, 1, 1, 1, 100, 1, 1, 100, 1]) == 6\n assert candidate(cost = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == 25\n asse... | [
"[10,15,20]",
"[1,100,1,1,1,100,1,1,100,1]"
] | [
"Build an array dp where dp[i] is the minimum cost to climb to the top starting from the ith staircase.",
"Assuming we have n staircase labeled from 0 to n - 1 and assuming the top is n, then dp[n] = 0, marking that if you are at the top, the cost is 0.",
"Now, looping from n - 1 to 0, the dp[i] = cost[i] + min... | {
"canonical_parameter_names": [
"cost"
],
"leetcode_dataset_entry_point": "Solution().minCostClimbingStairs",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:11",
"tests_total": 102,
... | typescript | {
"raw_signature": "function minCostClimbingStairs(cost: number[]): number {",
"container": null,
"callable": "minCostClimbingStairs",
"parameters": [
{
"name": "cost",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetc... |
747 | largest-number-at-least-twice-of-others | Easy | You are given an integer array nums where the largest integer is unique.
Determine whether the largest element in the array is at least twice as much as every other number in the array. If it is, return the index of the largest element, or return -1 otherwise.
Example 1:
Input: nums = [3,6,1,0]
Output: 1
Explanation... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 2, 3, 6]) == 3\n assert candidate(nums = [3, 6, 1, 0]) == 1\n assert candidate(nums = [7, 1, 3, 2]) == 0\n assert candidate(nums = [10, 1, 2, 3]) == 0\n assert candidate(nums = [100, 1, 2, 3]) == 0\n assert cand... | [
"[3,6,1,0]",
"[1,2,3,4]"
] | [
"Scan through the array to find the unique largest element `m`, keeping track of it's index `maxIndex`. Scan through the array again. If we find some `x != m` with `m < 2*x`, we should return `-1`. Otherwise, we should return `maxIndex`."
] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().dominantIndex",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:13",
"tests_total": 142,
"tests_d... | typescript | {
"raw_signature": "function dominantIndex(nums: number[]): number {",
"container": null,
"callable": "dominantIndex",
"parameters": [
{
"name": "nums",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets... |
748 | shortest-completing-word | Easy | Given a string licensePlate and an array of strings words, find the shortest completing word in words.
A completing word is a word that contains all the letters in licensePlate. Ignore numbers and spaces in licensePlate, and treat letters as case insensitive. If a letter appears more than once in licensePlate, then it... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(licensePlate = \"GrC8950\",words = ['grace', 'please']) == \"grace\"\n assert candidate(licensePlate = \"Ah71752\",words = ['enough', 'these', 'playground', 'point', 'president']) == None\n assert candidate(licensePlate = \"xyz\",w... | [
"\"1s3 PSt\"\n[\"step\",\"steps\",\"stripe\",\"stepple\"]",
"\"1s3 456\"\n[\"looks\",\"pest\",\"stew\",\"show\"]"
] | [
"Count only the letters (possibly converted to lowercase) of each word. If a word is shorter and the count of each letter is at least the count of that letter in the licensePlate, it is the best answer we've seen yet."
] | {
"canonical_parameter_names": [
"licensePlate",
"words"
],
"leetcode_dataset_entry_point": "Solution().shortestCompletingWord",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:15",
... | typescript | {
"raw_signature": "function shortestCompletingWord(licensePlate: string, words: string[]): string {",
"container": null,
"callable": "shortestCompletingWord",
"parameters": [
{
"name": "licensePlate",
"type": "string"
},
{
"name": "words",
"type": "string[]"
}
],
"re... |
749 | contain-virus | Hard | A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls.
The world is modeled as an m x n binary grid isInfected, where isInfected[i][j] == 0 represents uninfected cells, and isInfected[i][j] == 1 represents cells contaminated with the virus. A wall (and only one wall) can be... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(isInfected = [[0, 1, 0, 0, 0, 0, 0, 1], [0, 1, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0]]) == 10\n assert candidate(isInfected = [[1, 1, 1, 0, 0, 0, 0, 0, 0], [1, 0, 1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 0, 0, 0,... | [
"[[0,1,0,0,0,0,0,1],[0,1,0,0,0,0,0,1],[0,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,0]]",
"[[1,1,1],[1,0,1],[1,1,1]]",
"[[1,1,1,0,0,0,0,0,0],[1,0,1,0,1,1,1,1,1],[1,1,1,0,0,0,0,0,0]]"
] | [
"The implementation is long - we want to perfrom the following steps: * Find all viral regions (connected components), additionally for each region keeping track of the frontier (neighboring uncontaminated cells), and the perimeter of the region. * Disinfect the most viral region, adding it's perimeter to the answe... | {
"canonical_parameter_names": [
"isInfected"
],
"leetcode_dataset_entry_point": "Solution().containVirus",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:17",
"tests_total": 58,
"tes... | typescript | {
"raw_signature": "function containVirus(isInfected: number[][]): number {",
"container": null,
"callable": "containVirus",
"parameters": [
{
"name": "isInfected",
"type": "number[][]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcod... |
752 | open-the-lock | Medium | You have a lock in front of you with 4 circular wheels. Each wheel has 10 slots: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'. The wheels can rotate freely and wrap around: for example we can turn '9' to be '0', or '0' to be '9'. Each move consists of turning one wheel one slot.
The lock initially starts at '0000'... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(deadends = ['1111', '2222', '3333'],target = \"4444\") == 16\n assert candidate(deadends = ['0001', '0002', '0003', '0004'],target = \"0005\") == 5\n assert candidate(deadends = ['0001', '0011', '0101', '1001', '1101', '0111', '011... | [
"[\"0201\",\"0101\",\"0102\",\"1212\",\"2002\"]\n\"0202\"",
"[\"8888\"]\n\"0009\"",
"[\"8887\",\"8889\",\"8878\",\"8898\",\"8788\",\"8988\",\"7888\",\"9888\"]\n\"8888\""
] | [
"We can think of this problem as a shortest path problem on a graph: there are `10000` nodes (strings `'0000'` to `'9999'`), and there is an edge between two nodes if they differ in one digit, that digit differs by 1 (wrapping around, so `'0'` and `'9'` differ by 1), and if *both* nodes are not in `deadends`."
] | {
"canonical_parameter_names": [
"deadends",
"target"
],
"leetcode_dataset_entry_point": "Solution().openLock",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:24",
"tests_total": 11... | typescript | {
"raw_signature": "function openLock(deadends: string[], target: string): number {",
"container": null,
"callable": "openLock",
"parameters": [
{
"name": "deadends",
"type": "string[]"
},
{
"name": "target",
"type": "string"
}
],
"return_type": "number",
"signature... |
753 | cracking-the-safe | Hard | There is a safe protected by a password. The password is a sequence of n digits where each digit can be in the range [0, k - 1].
The safe has a peculiar way of checking the password. When you enter in a sequence, it checks the most recent n digits that were entered each time you type a digit.
- For example, the corre... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 1,k = 2) == \"10\"\n assert candidate(n = 1,k = 4) == \"3210\"\n assert candidate(n = 2,k = 4) == \"03322312113020100\"\n assert candidate(n = 2,k = 5) == \"04433423224131211403020100\"\n assert candidate(n = 3,k = 4) == ... | [
"1\n2",
"2\n2"
] | [
"We can think of this problem as the problem of finding an Euler path (a path visiting every edge exactly once) on the following graph: there are k^{n-1} nodes with each node having k edges. It turns out this graph always has an Eulerian circuit (path starting where it ends.) We should visit each node in \"post-ord... | {
"canonical_parameter_names": [
"n",
"k"
],
"leetcode_dataset_entry_point": "Solution().crackSafe",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:26",
"tests_total": 19,
"tests_... | typescript | {
"raw_signature": "function crackSafe(n: number, k: number): string {",
"container": null,
"callable": "crackSafe",
"parameters": [
{
"name": "n",
"type": "number"
},
{
"name": "k",
"type": "number"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSn... |
754 | reach-a-number | Medium | You are standing at position 0 on an infinite number line. There is a destination at position target.
You can make some number of moves numMoves so that:
- On each move, you can either go left or right.
- During the i^th move (starting from i == 1 to i == numMoves), you take i steps in the chosen direction.
Given th... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(target = 2) == 3\n assert candidate(target = -20) == 7\n assert candidate(target = 15) == 5\n assert candidate(target = 10) == 4\n assert candidate(target = -5) == 5\n assert candidate(target = 1) == 1\n assert candidat... | [
"2",
"3"
] | [] | {
"canonical_parameter_names": [
"target"
],
"leetcode_dataset_entry_point": "Solution().reachNumber",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:28",
"tests_total": 70,
"tests_dr... | typescript | {
"raw_signature": "function reachNumber(target: number): number {",
"container": null,
"callable": "reachNumber",
"parameters": [
{
"name": "target",
"type": "number"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
756 | pyramid-transition-matrix | Medium | You are stacking blocks to form a pyramid. Each block has a color, which is represented by a single letter. Each row of blocks contains one less block than the row beneath it and is centered on top.
To make the pyramid aesthetically pleasing, there are only specific triangular patterns that are allowed. A triangular p... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(bottom = \"FFFA\",allowed = ['FFF', 'FFA', 'FAF', 'AFF']) == True\n assert candidate(bottom = \"ABC\",allowed = ['ABD', 'BDC', 'CDB', 'BDD', 'DEF', 'DEE']) == False\n assert candidate(bottom = \"ABC\",allowed = ['ABD', 'BCE', 'DEF'... | [
"\"BCD\"\n[\"BCC\",\"CDE\",\"CEA\",\"FFF\"]",
"\"AAAA\"\n[\"AAB\",\"AAC\",\"BCD\",\"BBE\",\"DEF\"]"
] | [] | {
"canonical_parameter_names": [
"bottom",
"allowed"
],
"leetcode_dataset_entry_point": "Solution().pyramidTransition",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:33",
"tests_to... | typescript | {
"raw_signature": "function pyramidTransition(bottom: string, allowed: string[]): boolean {",
"container": null,
"callable": "pyramidTransition",
"parameters": [
{
"name": "bottom",
"type": "string"
},
{
"name": "allowed",
"type": "string[]"
}
],
"return_type": "bool... |
757 | set-intersection-size-at-least-two | Hard | You are given a 2D integer array intervals where intervals[i] = [start_i, end_i] represents all the integers from start_i to end_i inclusively.
A containing set is an array nums where each interval from intervals has at least two integers in nums.
- For example, if intervals = [[1,3], [3,7], [8,9]], then [1,2,4,7,8,9... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(intervals = [[1, 10], [5, 10], [7, 15]]) == 2\n assert candidate(intervals = [[1, 2], [2, 3]]) == 3\n assert candidate(intervals = [[1, 3], [1, 4], [2, 5], [3, 5]]) == 3\n assert candidate(intervals = [[1, 3], [3, 7], [8, 9]]) =... | [
"[[1,3],[3,7],[8,9]]",
"[[1,3],[1,4],[2,5],[3,5]]",
"[[1,2],[2,3],[2,4],[4,5]]"
] | [] | {
"canonical_parameter_names": [
"intervals"
],
"leetcode_dataset_entry_point": "Solution().intersectionSizeTwo",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:35",
"tests_total": 90,
... | typescript | {
"raw_signature": "function intersectionSizeTwo(intervals: number[][]): number {",
"container": null,
"callable": "intersectionSizeTwo",
"parameters": [
{
"name": "intervals",
"type": "number[][]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_sourc... |
761 | special-binary-string | Hard | Special binary strings are binary strings with the following two properties:
- The number of 0's is equal to the number of 1's.
- Every prefix of the binary string has at least as many 1's as 0's.
You are given a special binary string s.
A move consists of choosing two consecutive, non-empty, special substrings of s... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"11010011\") == \"110100\"\n assert candidate(s = \"11011000\") == \"11100100\"\n assert candidate(s = \"11100100\") == \"11100100\"\n assert candidate(s = \"111000\") == \"111000\"\n assert candidate(s = \"101010\") == ... | [
"\"11011000\"",
"\"10\""
] | [
"Draw a line from (x, y) to (x+1, y+1) if we see a \"1\", else to (x+1, y-1). A special substring is just a line that starts and ends at the same y-coordinate, and that is the lowest y-coordinate reached. Call a mountain a special substring with no special prefixes - ie. only at the beginning and end is the lowest ... | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().makeLargestSpecial",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:42",
"tests_total": 127,
"tests... | typescript | {
"raw_signature": "function makeLargestSpecial(s: string): string {",
"container": null,
"callable": "makeLargestSpecial",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets... |
762 | prime-number-of-set-bits-in-binary-representation | Easy | Given two integers left and right, return the count of numbers in the inclusive range [left, right] having a prime number of set bits in their binary representation.
Recall that the number of set bits an integer has is the number of 1's present when written in binary.
- For example, 21 written in binary is 10101, whi... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(left = 100,right = 105) == 3\n assert candidate(left = 500,right = 1000) == 253\n assert candidate(left = 1,right = 100) == 65\n assert candidate(left = 6,right = 10) == 4\n assert candidate(left = 999900,right = 1000000) == ... | [
"6\n10",
"10\n15"
] | [
"Write a helper function to count the number of set bits in a number, then check whether the number of set bits is 2, 3, 5, 7, 11, 13, 17 or 19."
] | {
"canonical_parameter_names": [
"left",
"right"
],
"leetcode_dataset_entry_point": "Solution().countPrimeSetBits",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:44",
"tests_total"... | typescript | {
"raw_signature": "function countPrimeSetBits(left: number, right: number): number {",
"container": null,
"callable": "countPrimeSetBits",
"parameters": [
{
"name": "left",
"type": "number"
},
{
"name": "right",
"type": "number"
}
],
"return_type": "number",
"signa... |
763 | partition-labels | Medium | You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part. For example, the string "ababcc" can be partitioned into ["abab", "cc"], but partitions such as ["aba", "bcc"] or ["ab", "ab", "cc"] are invalid.
Note that the partition is done so ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"abcdabcde\") == [8, 1]\n assert candidate(s = \"aaaaaabbbbbccccc\") == [6, 5, 5]\n assert candidate(s = \"xyzxyzxyz\") == [9]\n assert candidate(s = \"aaaabbbbbccccc\") == [4, 5, 5]\n assert candidate(s = \"abcdabcdeabc... | [
"\"ababcbacadefegdehijhklij\"",
"\"eccbbbbdec\""
] | [
"Try to greedily choose the smallest partition that includes the first letter. If you have something like \"abaccbdeffed\", then you might need to add b. You can use an map like \"last['b'] = 5\" to help you expand the width of your partition."
] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().partitionLabels",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:46",
"tests_total": 64,
"tests_dro... | typescript | {
"raw_signature": "function partitionLabels(s: string): number[] {",
"container": null,
"callable": "partitionLabels",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "number[]",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
... |
764 | largest-plus-sign | Medium | You are given an integer n. You have an n x n binary grid grid with all values initially 1's except for some indices given in the array mines. The i^th element of the array mines is defined as mines[i] = [x_i, y_i] where grid[x_i][y_i] == 0.
Return the order of the largest axis-aligned plus sign of 1's contained in gr... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 7,mines = [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6], [1, 0], [1, 6], [2, 0], [2, 6], [3, 0], [3, 6], [4, 0], [4, 6], [5, 0], [5, 6], [6, 0], [6, 1], [6, 2], [6, 3], [6, 4], [6, 5], [6, 6]]) == 3\n assert candidate(n ... | [
"5\n[[4,2]]",
"1\n[[0,0]]"
] | [
"For each direction such as \"left\", find left[r][c] = the number of 1s you will see before a zero starting at r, c and walking left. You can find this in N^2 time with a dp. The largest plus sign at r, c is just the minimum of left[r][c], up[r][c] etc."
] | {
"canonical_parameter_names": [
"n",
"mines"
],
"leetcode_dataset_entry_point": "Solution().orderOfLargestPlusSign",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:48",
"tests_tota... | typescript | {
"raw_signature": "function orderOfLargestPlusSign(n: number, mines: number[][]): number {",
"container": null,
"callable": "orderOfLargestPlusSign",
"parameters": [
{
"name": "n",
"type": "number"
},
{
"name": "mines",
"type": "number[][]"
}
],
"return_type": "numbe... |
765 | couples-holding-hands | Hard | There are n couples sitting in 2n seats arranged in a row and want to hold hands.
The people and seats are represented by an integer array row where row[i] is the ID of the person sitting in the i^th seat. The couples are numbered in order, the first couple being (0, 1), the second couple being (2, 3), and so on with ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(row = [2, 0, 5, 4, 3, 1]) == 1\n assert candidate(row = [0, 1, 2, 3]) == 0\n assert candidate(row = [0, 2, 1, 3]) == 1\n assert candidate(row = [4, 3, 2, 1, 0, 5]) == 2\n assert candidate(row = [2, 0, 5, 4, 3, 6, 7, 1]) == 2\... | [
"[0,2,1,3]",
"[3,2,0,1]"
] | [
"Say there are N two-seat couches. For each couple, draw an edge from the couch of one partner to the couch of the other partner."
] | {
"canonical_parameter_names": [
"row"
],
"leetcode_dataset_entry_point": "Solution().minSwapsCouples",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:51",
"tests_total": 81,
"tests_d... | typescript | {
"raw_signature": "function minSwapsCouples(row: number[]): number {",
"container": null,
"callable": "minSwapsCouples",
"parameters": [
{
"name": "row",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippe... |
766 | toeplitz-matrix | Easy | Given an m x n matrix, return true if the matrix is Toeplitz. Otherwise, return false.
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same elements.
Example 1:
Input: matrix = [[1,2,3,4],[5,1,2,3],[9,5,1,2]]
Output: true
Explanation:
In the above grid, the diagonals are:
"[9]", "[5, 5]"... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(matrix = [[3, 4, 5], [6, 3, 4], [7, 6, 3]]) == True\n assert candidate(matrix = [[1, 2, 3], [4, 1, 2], [7, 4, 1]]) == True\n assert candidate(matrix = [[1]]) == True\n assert candidate(matrix = [[1, 2], [3, 4]]) == False\n as... | [
"[[1,2,3,4],[5,1,2,3],[9,5,1,2]]",
"[[1,2],[2,2]]"
] | [
"Check whether each value is equal to the value of it's top-left neighbor."
] | {
"canonical_parameter_names": [
"matrix"
],
"leetcode_dataset_entry_point": "Solution().isToeplitzMatrix",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:53",
"tests_total": 84,
"tes... | typescript | {
"raw_signature": "function isToeplitzMatrix(matrix: number[][]): boolean {",
"container": null,
"callable": "isToeplitzMatrix",
"parameters": [
{
"name": "matrix",
"type": "number[][]"
}
],
"return_type": "boolean",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetc... |
767 | reorganize-string | Medium | Given a string s, rearrange the characters of s so that any two adjacent characters are not the same.
Return any possible rearrangement of s or return "" if not possible.
Example 1:
Input: s = "aab"
Output: "aba"
Example 2:
Input: s = "aaab"
Output: ""
Constraints:
- 1 <= s.length <= 500
- s consists of lowercas... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"aaabc\") == \"abaca\"\n assert candidate(s = \"aabbccc\") == \"cacbcba\"\n assert candidate(s = \"abcdefg\") == \"aebfcgd\"\n assert candidate(s = \"aaabbbccc\") == \"abacacbcb\"\n assert candidate(s = \"aabbccddeeffggh... | [
"\"aab\"",
"\"aaab\""
] | [
"Alternate placing the most common letters."
] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().reorganizeString",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:55",
"tests_total": 56,
"tests_dr... | typescript | {
"raw_signature": "function reorganizeString(s: string): string {",
"container": null,
"callable": "reorganizeString",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
768 | max-chunks-to-make-sorted-ii | Hard | You are given an integer array arr.
We split arr into some number of chunks (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equal the sorted array.
Return the largest number of chunks we can make to sort the array.
Example 1:
Input: arr = [5,4,3,2,1]
Output: 1
Expla... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(arr = [4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [3, 2, 1, 0, 4, 5, 6, 7, 8, 9]) == 7\n assert candidate(arr = [5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [... | [
"[5,4,3,2,1]",
"[2,1,3,4,4]"
] | [
"Each k for which some permutation of arr[:k] is equal to sorted(arr)[:k] is where we should cut each chunk."
] | {
"canonical_parameter_names": [
"arr"
],
"leetcode_dataset_entry_point": "Solution().maxChunksToSorted",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:57",
"tests_total": 149,
"test... | typescript | {
"raw_signature": "function maxChunksToSorted(arr: number[]): number {",
"container": null,
"callable": "maxChunksToSorted",
"parameters": [
{
"name": "arr",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSn... |
769 | max-chunks-to-make-sorted | Medium | You are given an integer array arr of length n that represents a permutation of the integers in the range [0, n - 1].
We split arr into some number of chunks (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equal the sorted array.
Return the largest number of chunks we... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [1, 2, 0, 3, 4]) == 3\n assert candidate(arr = [5, 4, 3, 2, 1, 0]) == 1\n assert candidate(arr = [3, 1, 0, 2, 4]) == 2\n assert candidate(arr = [2, 0, 1, 3, ... | [
"[4,3,2,1,0]",
"[1,0,2,3,4]"
] | [
"The first chunk can be found as the smallest k for which A[:k+1] == [0, 1, 2, ...k]; then we repeat this process."
] | {
"canonical_parameter_names": [
"arr"
],
"leetcode_dataset_entry_point": "Solution().maxChunksToSorted",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:58:59",
"tests_total": 127,
"test... | typescript | {
"raw_signature": "function maxChunksToSorted(arr: number[]): number {",
"container": null,
"callable": "maxChunksToSorted",
"parameters": [
{
"name": "arr",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSn... |
770 | basic-calculator-iv | Hard | Given an expression such as expression = "e + 8 - a + 5" and an evaluation map such as {"e": 1} (given in terms of evalvars = ["e"] and evalints = [1]), return a list of tokens representing the simplified expression, such as ["-1*a","14"]
- An expression alternates chunks and symbols, with a space separating each chun... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(expression = \"1 + (2 * 3) + (4 * (5 + 6))\",evalvars = [],evalints = []) == ['51']\n assert candidate(expression = \"10 + 20 * (30 + 40) - 50\",evalvars = [],evalints = []) == ['1360']\n assert candidate(expression = \"(x + y) * (... | [
"\"e + 8 - a + 5\"\n[\"e\"]\n[1]",
"\"e - 8 + temperature - pressure\"\n[\"e\", \"temperature\"]\n[1, 12]",
"\"(e + 8) * (e - 8)\"\n[]\n[]"
] | [
"One way is with a Polynomial class. For example, * `Poly:add(this, that)` returns the result of `this + that`. * `Poly:sub(this, that)` returns the result of `this - that`. * `Poly:mul(this, that)` returns the result of `this * that`. * `Poly:evaluate(this, evalmap)` returns the polynomial after replacing all free... | {
"canonical_parameter_names": [
"expression",
"evalvars",
"evalints"
],
"leetcode_dataset_entry_point": "Solution().basicCalculatorIV",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T1... | typescript | {
"raw_signature": "function basicCalculatorIV(expression: string, evalvars: string[], evalints: number[]): string[] {",
"container": null,
"callable": "basicCalculatorIV",
"parameters": [
{
"name": "expression",
"type": "string"
},
{
"name": "evalvars",
"type": "string[]"
... |
771 | jewels-and-stones | Easy | You're given strings jewels representing the types of stones that are jewels, and stones representing the stones you have. Each character in stones is a type of stone you have. You want to know how many of the stones you have are also jewels.
Letters are case sensitive, so "a" is considered a different type of stone f... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(jewels = \"aA\",stones = \"aAAbbbb\") == 3\n assert candidate(jewels = \"xyz\",stones = \"aabbcc\") == 0\n assert candidate(jewels = \"abcdefg\",stones = \"aghfbadcegf\") == 10\n assert candidate(jewels = \"abcdefg\",stones = \"... | [
"\"aA\"\n\"aAAbbbb\"",
"\"z\"\n\"ZZ\""
] | [
"For each stone, check if it is a jewel."
] | {
"canonical_parameter_names": [
"jewels",
"stones"
],
"leetcode_dataset_entry_point": "Solution().numJewelsInStones",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:04",
"tests_tot... | typescript | {
"raw_signature": "function numJewelsInStones(jewels: string, stones: string): number {",
"container": null,
"callable": "numJewelsInStones",
"parameters": [
{
"name": "jewels",
"type": "string"
},
{
"name": "stones",
"type": "string"
}
],
"return_type": "number",
... |
773 | sliding-puzzle | Hard | On an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally adjacent number and swapping it.
The state of the board is solved if and only if the board is [[1,2,3],[4,5,0]].
Given the puzzle board board, return the least number ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(board = [[4, 1, 2], [0, 5, 3]]) == 4\n assert candidate(board = [[3, 2, 4], [1, 5, 0]]) == 14\n assert candidate(board = [[0, 1, 2], [4, 5, 3]]) == 3\n assert candidate(board = [[1, 2, 3], [4, 0, 5]]) == 1\n assert candidate(... | [
"[[1,2,3],[4,0,5]]",
"[[1,2,3],[5,4,0]]",
"[[4,1,2],[5,0,3]]"
] | [
"Perform a breadth-first-search, where the nodes are the puzzle boards and edges are if two puzzle boards can be transformed into one another with one move."
] | {
"canonical_parameter_names": [
"board"
],
"leetcode_dataset_entry_point": "Solution().slidingPuzzle",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:08",
"tests_total": 78,
"tests_d... | typescript | {
"raw_signature": "function slidingPuzzle(board: number[][]): number {",
"container": null,
"callable": "slidingPuzzle",
"parameters": [
{
"name": "board",
"type": "number[][]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSn... |
775 | global-and-local-inversions | Medium | You are given an integer array nums of length n which represents a permutation of all the integers in the range [0, n - 1].
The number of global inversions is the number of the different pairs (i, j) where:
- 0 <= i < j < n
- nums[i] > nums[j]
The number of local inversions is the number of indices i where:
- 0 <= ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [0, 1, 2, 3, 4]) == True\n assert candidate(nums = [4, 3, 2, 1, 0]) == False\n assert candidate(nums = [2, 0, 1, 3]) == False\n assert candidate(nums = [2, 1, 0, 3]) == False\n assert candidate(nums = [3, 2, 1, 0]) == ... | [
"[1,0,2]",
"[1,2,0]"
] | [
"Where can the 0 be placed in an ideal permutation? What about the 1?"
] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().isIdealPermutation",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:13",
"tests_total": 109,
"te... | typescript | {
"raw_signature": "function isIdealPermutation(nums: number[]): boolean {",
"container": null,
"callable": "isIdealPermutation",
"parameters": [
{
"name": "nums",
"type": "number[]"
}
],
"return_type": "boolean",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/... |
777 | swap-adjacent-in-lr-string | Medium | In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL", a move consists of either replacing one occurrence of "XL" with "LX", or replacing one occurrence of "RX" with "XR". Given the starting string start and the ending string result, return True if and only if there exists a sequence of moves to transf... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(start = \"XXL\",result = \"LXX\") == True\n assert candidate(start = \"RXXLRXRXL\",result = \"XRLXXRRLX\") == True\n assert candidate(start = \"LLR\",result = \"RRL\") == False\n assert candidate(start = \"RXXL\",result = \"XRXL... | [
"\"RXXLRXRXL\"\n\"XRLXXRRLX\"",
"\"X\"\n\"L\""
] | [
"Think of the L and R's as people on a horizontal line, where X is a space. The people can't cross each other, and also you can't go from XRX to RXX."
] | {
"canonical_parameter_names": [
"start",
"result"
],
"leetcode_dataset_entry_point": "Solution().canTransform",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:15",
"tests_total": 2... | typescript | {
"raw_signature": "function canTransform(start: string, result: string): boolean {",
"container": null,
"callable": "canTransform",
"parameters": [
{
"name": "start",
"type": "string"
},
{
"name": "result",
"type": "string"
}
],
"return_type": "boolean",
"signature... |
778 | swim-in-rising-water | Hard | You are given an n x n integer matrix grid where each value grid[i][j] represents the elevation at that point (i, j).
It starts raining, and water gradually rises over time. At time t, the water level is t, meaning any cell with elevation less than equal to t is submerged or reachable.
You can swim from a square to a... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(grid = [[3, 0, 8, 4], [2, 5, 1, 7], [9, 6, 10, 11], [13, 12, 14, 15]]) == 15\n assert candidate(grid = [[7, 1, 4, 0, 5], [2, 3, 6, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 19], [20, 21, 22, 23, 24]]) == 24\n assert candidate(g... | [
"[[0,2],[1,3]]",
"[[0,1,2,3,4],[24,23,22,21,5],[12,13,14,15,16],[11,17,18,19,20],[10,9,8,7,6]]"
] | [
"Use either Dijkstra's, or binary search for the best time T for which you can reach the end if you only step on squares at most T."
] | {
"canonical_parameter_names": [
"grid"
],
"leetcode_dataset_entry_point": "Solution().swimInWater",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:17",
"tests_total": 33,
"tests_drop... | typescript | {
"raw_signature": "function swimInWater(grid: number[][]): number {",
"container": null,
"callable": "swimInWater",
"parameters": [
{
"name": "grid",
"type": "number[][]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets... |
779 | k-th-symbol-in-grammar | Medium | We build a table of n rows (1-indexed). We start by writing 0 in the 1^st row. Now in every subsequent row, we look at the previous row and replace each occurrence of 0 with 01, and each occurrence of 1 with 10.
- For example, for n = 3, the 1^st row is 0, the 2^nd row is 01, and the 3^rd row is 0110.
Given two integ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 4,k = 8) == 1\n assert candidate(n = 30,k = 536870912) == 1\n assert candidate(n = 3,k = 2) == 1\n assert candidate(n = 1,k = 1) == 0\n assert candidate(n = 30,k = 536870911) == 0\n assert candidate(n = 4,k = 5) == 1\n... | [
"1\n1",
"2\n1",
"2\n2"
] | [
"Try to represent the current (N, K) in terms of some (N-1, prevK). What is prevK ?"
] | {
"canonical_parameter_names": [
"n",
"k"
],
"leetcode_dataset_entry_point": "Solution().kthGrammar",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:20",
"tests_total": 86,
"tests... | typescript | {
"raw_signature": "function kthGrammar(n: number, k: number): number {",
"container": null,
"callable": "kthGrammar",
"parameters": [
{
"name": "n",
"type": "number"
},
{
"name": "k",
"type": "number"
}
],
"return_type": "number",
"signature_source": "leetcode/code... |
780 | reaching-points | Hard | Given four integers sx, sy, tx, and ty, return true if it is possible to convert the point (sx, sy) to the point (tx, ty) through some operations, or false otherwise.
The allowed operation on some point (x, y) is to convert it to either (x, x + y) or (x + y, y).
Example 1:
Input: sx = 1, sy = 1, tx = 3, ty = 5
Outpu... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(sx = 1,sy = 1,tx = 3,ty = 5) == True\n assert candidate(sx = 3,sy = 4,tx = 3,ty = 12) == False\n assert candidate(sx = 3,sy = 7,tx = 31,ty = 19) == False\n assert candidate(sx = 1,sy = 1,tx = 1000000000,ty = 1000000000) == False... | [
"1\n1\n3\n5",
"1\n1\n2\n2",
"1\n1\n1\n1"
] | [] | {
"canonical_parameter_names": [
"sx",
"sy",
"tx",
"ty"
],
"leetcode_dataset_entry_point": "Solution().reachingPoints",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:22",
"... | typescript | {
"raw_signature": "function reachingPoints(sx: number, sy: number, tx: number, ty: number): boolean {",
"container": null,
"callable": "reachingPoints",
"parameters": [
{
"name": "sx",
"type": "number"
},
{
"name": "sy",
"type": "number"
},
{
"name": "tx",
... |
781 | rabbits-in-forest | Medium | There is a forest with an unknown number of rabbits. We asked n rabbits "How many other rabbits have the same color as you?" and collected the answers in an integer array answers where answers[i] is the answer of the i^th rabbit.
Given the array answers, return the minimum number of rabbits that could be in the forest... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(answers = [1, 2, 3, 4, 5]) == 20\n assert candidate(answers = [4, 4, 4, 4, 4, 4]) == 10\n assert candidate(answers = [1, 1, 2]) == 5\n assert candidate(answers = [0, 0, 1, 1, 1]) == 6\n assert candidate(answers = [999, 999, 9... | [
"[1,1,2]",
"[10,10,10]"
] | [] | {
"canonical_parameter_names": [
"answers"
],
"leetcode_dataset_entry_point": "Solution().numRabbits",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:24",
"tests_total": 66,
"tests_dr... | typescript | {
"raw_signature": "function numRabbits(answers: number[]): number {",
"container": null,
"callable": "numRabbits",
"parameters": [
{
"name": "answers",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets... |
782 | transform-to-chessboard | Hard | You are given an n x n binary grid board. In each move, you can swap any two rows with each other, or any two columns with each other.
Return the minimum number of moves to transform the board into a chessboard board. If the task is impossible, return -1.
A chessboard board is a board where no 0's and no 1's are 4-di... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(board = [[0, 0, 1, 1], [0, 0, 1, 1], [1, 1, 0, 0], [1, 1, 0, 0]]) == 2\n assert candidate(board = [[1, 0], [1, 0]]) == -1\n assert candidate(board = [[0, 1], [1, 0]]) == 0\n assert candidate(board = [[0, 0, 1, 1], [1, 1, 0, 0], ... | [
"[[0,1,1,0],[0,1,1,0],[1,0,0,1],[1,0,0,1]]",
"[[0,1],[1,0]]",
"[[1,0],[1,0]]"
] | [] | {
"canonical_parameter_names": [
"board"
],
"leetcode_dataset_entry_point": "Solution().movesToChessboard",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:26",
"tests_total": 75,
"tes... | typescript | {
"raw_signature": "function movesToChessboard(board: number[][]): number {",
"container": null,
"callable": "movesToChessboard",
"parameters": [
{
"name": "board",
"type": "number[][]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcod... |
784 | letter-case-permutation | Medium | Given a string s, you can transform every letter individually to be lowercase or uppercase to create another string.
Return a list of all possible strings we could create. Return the output in any order.
Example 1:
Input: s = "a1b2"
Output: ["a1b2","a1B2","A1b2","A1B2"]
Example 2:
Input: s = "3z4"
Output: ["3z4","... | {
"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 ... | [
"\"a1b2\"",
"\"3z4\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().letterCasePermutation",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:31",
"tests_total": 111,
"te... | typescript | {
"raw_signature": "function letterCasePermutation(s: string): string[] {",
"container": null,
"callable": "letterCasePermutation",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "string[]",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/co... |
785 | is-graph-bipartite | Medium | There is an undirected graph with n nodes, where each node is numbered between 0 and n - 1. You are given a 2D array graph, where graph[u] is an array of nodes that node u is adjacent to. More formally, for each v in graph[u], there is an undirected edge between node u and node v. The graph has the following properties... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(graph = [[], [3], [], [1]]) == True\n assert candidate(graph = [[], [2, 4, 6], [1, 4, 8, 9], [7, 8], [1, 2, 8, 9], [6, 9], [1, 5, 7, 8, 9], [3, 6, 9], [2, 3, 4, 6, 9], [2, 4, 5, 6, 7, 8]]) == False\n assert candidate(graph = [[1, 3... | [
"[[1,2,3],[0,2],[0,1,3],[0,2]]",
"[[1,3],[0,2],[1,3],[0,2]]"
] | [] | {
"canonical_parameter_names": [
"graph"
],
"leetcode_dataset_entry_point": "Solution().isBipartite",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:33",
"tests_total": 103,
"tests_dr... | typescript | {
"raw_signature": "function isBipartite(graph: number[][]): boolean {",
"container": null,
"callable": "isBipartite",
"parameters": [
{
"name": "graph",
"type": "number[][]"
}
],
"return_type": "boolean",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnip... |
786 | k-th-smallest-prime-fraction | Medium | You are given a sorted integer array arr containing 1 and prime numbers, where all the integers of arr are unique. You are also given an integer k.
For every i and j where 0 <= i < j < arr.length, we consider the fraction arr[i] / arr[j].
Return the k^th smallest fraction considered. Return your answer as an array of... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(arr = [1, 2, 5, 13, 17, 19],k = 10) == [5, 13]\n assert candidate(arr = [1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29],k = 25) == [2, 7]\n assert candidate(arr = [1, 2, 3, 5],k = 3) == [2, 5]\n assert candidate(arr = [1, 2, 5, 7, 11, 1... | [
"[1,2,3,5]\n3",
"[1,7]\n1"
] | [] | {
"canonical_parameter_names": [
"arr",
"k"
],
"leetcode_dataset_entry_point": "Solution().kthSmallestPrimeFraction",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:35",
"tests_tota... | typescript | {
"raw_signature": "function kthSmallestPrimeFraction(arr: number[], k: number): number[] {",
"container": null,
"callable": "kthSmallestPrimeFraction",
"parameters": [
{
"name": "arr",
"type": "number[]"
},
{
"name": "k",
"type": "number"
}
],
"return_type": "number[... |
787 | cheapest-flights-within-k-stops | Medium | There are n cities connected by some number of flights. You are given an array flights where flights[i] = [from_i, to_i, price_i] indicates that there is a flight from city from_i to city to_i with cost price_i.
You are also given three integers src, dst, and k, return the cheapest price from src to dst with at most k... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 6,flights = [[0, 1, 10], [0, 2, 15], [1, 2, 5], [1, 3, 20], [2, 3, 10], [3, 4, 10], [4, 5, 10]],src = 0,dst = 5,k = 2) == -1\n assert candidate(n = 3,flights = [[0, 1, 100], [1, 2, 100]],src = 0,dst = 2,k = 2) == 200\n assert c... | [
"4\n[[0,1,100],[1,2,100],[2,0,100],[1,3,600],[2,3,200]]\n0\n3\n1",
"3\n[[0,1,100],[1,2,100],[0,2,500]]\n0\n2\n1",
"3\n[[0,1,100],[1,2,100],[0,2,500]]\n0\n2\n0"
] | [] | {
"canonical_parameter_names": [
"n",
"flights",
"src",
"dst",
"k"
],
"leetcode_dataset_entry_point": "Solution().findCheapestPrice",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09... | typescript | {
"raw_signature": "function findCheapestPrice(n: number, flights: number[][], src: number, dst: number, k: number): number {",
"container": null,
"callable": "findCheapestPrice",
"parameters": [
{
"name": "n",
"type": "number"
},
{
"name": "flights",
"type": "number[][]"
... |
788 | rotated-digits | Medium | An integer x is a good if after rotating each digit individually by 180 degrees, we get a valid number that is different from x. Each digit must be rotated - we cannot choose to leave it alone.
A number is valid if each digit remains a digit after rotation. For example:
- 0, 1, and 8 rotate to themselves,
- 2 and 5 r... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 100) == 40\n assert candidate(n = 10000) == 2320\n assert candidate(n = 104) == 41\n assert candidate(n = 20) == 9\n assert candidate(n = 2) == 1\n assert candidate(n = 1) == 0\n assert candidate(n = 1000) == 316\n ... | [
"10",
"1",
"2"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().rotatedDigits",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:39",
"tests_total": 55,
"tests_dropp... | typescript | {
"raw_signature": "function rotatedDigits(n: number): number {",
"container": null,
"callable": "rotatedDigits",
"parameters": [
{
"name": "n",
"type": "number"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
789 | escape-the-ghosts | Medium | You are playing a simplified PAC-MAN game on an infinite 2-D grid. You start at the point [0, 0], and you are given a destination point target = [x_target, y_target] that you are trying to get to. There are several ghosts on the map with their starting positions given as a 2D array ghosts, where ghosts[i] = [x_i, y_i] ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(ghosts = [[0, 0], [0, 0]],target = [1, 1]) == False\n assert candidate(ghosts = [[-1, -1]],target = [0, 0]) == True\n assert candidate(ghosts = [[1, 1], [2, 2], [3, 3]],target = [4, 4]) == False\n assert candidate(ghosts = [[1, ... | [
"[[1,0],[0,3]]\n[0,1]",
"[[1,0]]\n[2,0]",
"[[2,0]]\n[1,0]"
] | [] | {
"canonical_parameter_names": [
"ghosts",
"target"
],
"leetcode_dataset_entry_point": "Solution().escapeGhosts",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:41",
"tests_total": ... | typescript | {
"raw_signature": "function escapeGhosts(ghosts: number[][], target: number[]): boolean {",
"container": null,
"callable": "escapeGhosts",
"parameters": [
{
"name": "ghosts",
"type": "number[][]"
},
{
"name": "target",
"type": "number[]"
}
],
"return_type": "boolean"... |
790 | domino-and-tromino-tiling | Medium | You have two types of tiles: a 2 x 1 domino shape and a tromino shape. You may rotate these shapes.
Given an integer n, return the number of ways to tile an 2 x n board. Since the answer may be very large, return it modulo 10^9 + 7.
In a tiling, every square must be covered by a tile. Two tilings are different if and... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 3) == 5\n assert candidate(n = 100) == 190242381\n assert candidate(n = 4) == 11\n assert candidate(n = 2) == 2\n assert candidate(n = 1) == 1\n assert candidate(n = 500) == 603582422\n assert candidate(n = 1000) ==... | [
"3",
"1"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().numTilings",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:44",
"tests_total": 30,
"tests_dropped"... | typescript | {
"raw_signature": "function numTilings(n: number): number {",
"container": null,
"callable": "numTilings",
"parameters": [
{
"name": "n",
"type": "number"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
791 | custom-sort-string | Medium | You are given two strings order and s. All the characters of order are unique and were sorted in some custom order previously.
Permute the characters of s so that they match the order that order was sorted. More specifically, if a character x occurs before a character y in order, then x should occur before y in the pe... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(order = \"zyx\",s = \"zyxwvut\") == \"zwvutyx\"\n assert candidate(order = \"abcdefg\",s = \"gfedcba\") == \"abcdefg\"\n assert candidate(order = \"xyz\",s = \"abcdefghijklmnopqrstuvwxyz\") == \"abcdefghijklmnopqrstuvwxyz\"\n as... | [
"\"cba\"\n\"abcd\"",
"\"bcafg\"\n\"abcd\""
] | [] | {
"canonical_parameter_names": [
"order",
"s"
],
"leetcode_dataset_entry_point": "Solution().customSortString",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:46",
"tests_total": 11... | typescript | {
"raw_signature": "function customSortString(order: string, s: string): string {",
"container": null,
"callable": "customSortString",
"parameters": [
{
"name": "order",
"type": "string"
},
{
"name": "s",
"type": "string"
}
],
"return_type": "string",
"signature_sou... |
792 | number-of-matching-subsequences | Medium | Given a string s and an array of strings words, return the number of words[i] that is a subsequence of s.
A subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.
- For example, "ace" is a s... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"dsahjpjauf\",words = ['ahjpjau', 'ja', 'ahbwzgqnuk', 'tnmlanowax']) == 2\n assert candidate(s = \"abcde\",words = ['a', 'bb', 'acd', 'ace']) == 3\n assert candidate(s = \"qwertyuiopasdfghjklzxcvbnm\",words = ['qz', 'qp', 'qw'... | [
"\"abcde\"\n[\"a\",\"bb\",\"acd\",\"ace\"]",
"\"dsahjpjauf\"\n[\"ahjpjau\",\"ja\",\"ahbwzgqnuk\",\"tnmlanowax\"]"
] | [] | {
"canonical_parameter_names": [
"s",
"words"
],
"leetcode_dataset_entry_point": "Solution().numMatchingSubseq",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:48",
"tests_total": 5... | typescript | {
"raw_signature": "function numMatchingSubseq(s: string, words: string[]): number {",
"container": null,
"callable": "numMatchingSubseq",
"parameters": [
{
"name": "s",
"type": "string"
},
{
"name": "words",
"type": "string[]"
}
],
"return_type": "number",
"signatu... |
793 | preimage-size-of-factorial-zeroes-function | Hard | Let f(x) be the number of zeroes at the end of x!. Recall that x! = 1 * 2 * 3 * ... * x and by convention, 0! = 1.
- For example, f(3) = 0 because 3! = 6 has no zeroes at the end, while f(11) = 2 because 11! = 39916800 has two zeroes at the end.
Given an integer k, return the number of non-negative integers x have th... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(k = 100) == 5\n assert candidate(k = 1) == 5\n assert candidate(k = 10000) == 5\n assert candidate(k = 1000000) == 5\n assert candidate(k = 3) == 5\n assert candidate(k = 0) == 5\n assert candidate(k = 1000) == 5\n a... | [
"0",
"5",
"3"
] | [] | {
"canonical_parameter_names": [
"k"
],
"leetcode_dataset_entry_point": "Solution().preimageSizeFZF",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:50",
"tests_total": 104,
"tests_dr... | typescript | {
"raw_signature": "function preimageSizeFZF(k: number): number {",
"container": null,
"callable": "preimageSizeFZF",
"parameters": [
{
"name": "k",
"type": "number"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
794 | valid-tic-tac-toe-state | Medium | Given a Tic-Tac-Toe board as a string array board, return true if and only if it is possible to reach this board position during the course of a valid tic-tac-toe game.
The board is a 3 x 3 array that consists of characters ' ', 'X', and 'O'. The ' ' character represents an empty square.
Here are the rules of Tic-Tac... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(board = ['XOX', 'O O', 'XOX']) == True\n assert candidate(board = ['X ', 'X ', 'X ']) == False\n assert candidate(board = ['XOX', 'O O', 'XOX']) == True\n assert candidate(board = ['XXX', ' ', 'O O']) == True\n assert ca... | [
"[\"O \",\" \",\" \"]",
"[\"XOX\",\" X \",\" \"]",
"[\"XOX\",\"O O\",\"XOX\"]"
] | [] | {
"canonical_parameter_names": [
"board"
],
"leetcode_dataset_entry_point": "Solution().validTicTacToe",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:52",
"tests_total": 91,
"tests_... | typescript | {
"raw_signature": "function validTicTacToe(board: string[]): boolean {",
"container": null,
"callable": "validTicTacToe",
"parameters": [
{
"name": "board",
"type": "string[]"
}
],
"return_type": "boolean",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSn... |
795 | number-of-subarrays-with-bounded-maximum | Medium | Given an integer array nums and two integers left and right, return the number of contiguous non-empty subarrays such that the value of the maximum array element in that subarray is in the range [left, right].
The test cases are generated so that the answer will fit in a 32-bit integer.
Example 1:
Input: nums = [2,1... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [5, 2, 1],left = 1,right = 5) == 6\n assert candidate(nums = [73, 55, 36, 5, 55, 14, 9, 7, 72, 52],left = 32,right = 69) == 22\n assert candidate(nums = [2, 1, 4, 3],left = 2,right = 3) == 3\n assert candidate(nums = [8, ... | [
"[2,1,4,3]\n2\n3",
"[2,9,2,5,6]\n2\n8"
] | [] | {
"canonical_parameter_names": [
"nums",
"left",
"right"
],
"leetcode_dataset_entry_point": "Solution().numSubarrayBoundedMax",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:55",... | typescript | {
"raw_signature": "function numSubarrayBoundedMax(nums: number[], left: number, right: number): number {",
"container": null,
"callable": "numSubarrayBoundedMax",
"parameters": [
{
"name": "nums",
"type": "number[]"
},
{
"name": "left",
"type": "number"
},
{
"n... |
796 | rotate-string | Easy | Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s.
A shift on s consists of moving the leftmost character of s to the rightmost position.
- For example, if s = "abcde", then it will be "bcdea" after one shift.
Example 1:
Input: s = "abcde", goal = "cdeab"
Ou... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"aaa\",goal = \"aaa\") == True\n assert candidate(s = \"abcdefg\",goal = \"efgabcd\") == True\n assert candidate(s = \"abab\",goal = \"abba\") == False\n assert candidate(s = \"abcd\",goal = \"dcba\") == False\n assert c... | [
"\"m\"\n\"f\"",
"\"c\"\n\"w\""
] | [] | {
"canonical_parameter_names": [
"s",
"goal"
],
"leetcode_dataset_entry_point": "Solution().rotateString",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:57",
"tests_total": 113,
... | typescript | {
"raw_signature": "function rotateString(s: string, goal: string): boolean {",
"container": null,
"callable": "rotateString",
"parameters": [
{
"name": "s",
"type": "string"
},
{
"name": "goal",
"type": "string"
}
],
"return_type": "boolean",
"signature_source": "l... |
797 | all-paths-from-source-to-target | Medium | Given a directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1, find all possible paths from node 0 to node n - 1 and return them in any order.
The graph is given as follows: graph[i] is a list of all nodes you can visit from node i (i.e., there is a directed edge from node i to node graph[i][j]).
Example 1:... | {
"language": "python",
"source": "def answers_match(result, expected):\n \"\"\"The answer may list its items in any order (only the top-level order is free).\"\"\"\n if isinstance(result, list) and isinstance(expected, list):\n return sorted(result, key=repr) == sorted(expected, key=repr)\n return ... | [
"[[1,2],[3],[3],[]]",
"[[4,3,1],[3,2,4],[3],[4],[]]"
] | [] | {
"canonical_parameter_names": [
"graph"
],
"leetcode_dataset_entry_point": "Solution().allPathsSourceTarget",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T19:59:59",
"tests_total": 72,
"... | typescript | {
"raw_signature": "function allPathsSourceTarget(graph: number[][]): number[][] {",
"container": null,
"callable": "allPathsSourceTarget",
"parameters": [
{
"name": "graph",
"type": "number[][]"
}
],
"return_type": "number[][]",
"signature_source": "leetcode/codeSnippets",
"type_sou... |
798 | smallest-rotation-with-highest-score | Hard | You are given an array nums. You can rotate it by a non-negative integer k so that the array becomes [nums[k], nums[k + 1], ... nums[nums.length - 1], nums[0], nums[1], ..., nums[k-1]]. Afterward, any entries that are less than or equal to their index are worth one point.
- For example, if we have nums = [2,4,1,3,0], ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 3, 0, 2, 4]) == 0\n assert candidate(nums = [0, 1, 2, 3, 4]) == 0\n assert candidate(nums = [1, 0, 3, 4, 2]) == 4\n assert candidate(nums = [5, 4, 3, 2, 1, 0]) == 1\n assert candidate(nums = [1, 0, 2, 3, 4]) == 0\n... | [
"[2,3,1,4,0]",
"[1,3,0,2,4]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().bestRotation",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:01",
"tests_total": 94,
"tests_dro... | typescript | {
"raw_signature": "function bestRotation(nums: number[]): number {",
"container": null,
"callable": "bestRotation",
"parameters": [
{
"name": "nums",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
... |
799 | champagne-tower | Medium | We stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100^th row. Each glass holds one cup of champagne.
Then, some champagne is poured into the first glass at the top. When the topmost glass is full, any excess liquid poured will fall equally to the glass im... | {
"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... | [
"0\n0\n0",
"0\n1\n0",
"0\n1\n1"
] | [] | {
"canonical_parameter_names": [
"poured",
"query_row",
"query_glass"
],
"leetcode_dataset_entry_point": "Solution().champagneTower",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:0... | typescript | {
"raw_signature": "function champagneTower(poured: number, query_row: number, query_glass: number): number {",
"container": null,
"callable": "champagneTower",
"parameters": [
{
"name": "poured",
"type": "number"
},
{
"name": "query_row",
"type": "number"
},
{
... |
801 | minimum-swaps-to-make-sequences-increasing | Hard | You are given two integer arrays of the same length nums1 and nums2. In one operation, you are allowed to swap nums1[i] with nums2[i].
- For example, if nums1 = [1,2,3,8], and nums2 = [5,6,7,4], you can swap the element at i = 3 to obtain nums1 = [1,2,3,4] and nums2 = [5,6,7,8].
Return the minimum number of needed op... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums1 = [10, 19, 14, 6, 7],nums2 = [6, 5, 8, 11, 10]) == 2\n assert candidate(nums1 = [0, 4, 4, 5, 9],nums2 = [0, 1, 6, 8, 10]) == 1\n assert candidate(nums1 = [10, 19, 18, 3],nums2 = [5, 5, 5, 4]) == 2\n assert candidate(nums1 ... | [
"[1,3,5,4]\n[1,2,3,7]",
"[0,3,5,8,9]\n[2,1,4,6,9]"
] | [] | {
"canonical_parameter_names": [
"nums1",
"nums2"
],
"leetcode_dataset_entry_point": "Solution().minSwap",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:08",
"tests_total": 107,
... | typescript | {
"raw_signature": "function minSwap(nums1: number[], nums2: number[]): number {",
"container": null,
"callable": "minSwap",
"parameters": [
{
"name": "nums1",
"type": "number[]"
},
{
"name": "nums2",
"type": "number[]"
}
],
"return_type": "number",
"signature_sourc... |
802 | find-eventual-safe-states | Medium | There is a directed graph of n nodes with each node labeled from 0 to n - 1. The graph is represented by a 0-indexed 2D integer array graph where graph[i] is an integer array of nodes adjacent to node i, meaning there is an edge from node i to each node in graph[i].
A node is a terminal node if there are no outgoing e... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(graph = [[1, 2, 3, 4], [1, 2], [3, 4], [0, 4], []]) == [4]\n assert candidate(graph = [[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], [19], []]) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,... | [
"[[1,2],[2,3],[5],[0],[5],[],[]]",
"[[1,2,3,4],[1,2],[3,4],[0,4],[]]"
] | [] | {
"canonical_parameter_names": [
"graph"
],
"leetcode_dataset_entry_point": "Solution().eventualSafeNodes",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:11",
"tests_total": 81,
"tes... | typescript | {
"raw_signature": "function eventualSafeNodes(graph: number[][]): number[] {",
"container": null,
"callable": "eventualSafeNodes",
"parameters": [
{
"name": "graph",
"type": "number[][]"
}
],
"return_type": "number[]",
"signature_source": "leetcode/codeSnippets",
"type_source": "lee... |
803 | bricks-falling-when-hit | Hard | You are given an m x n binary grid, where each 1 represents a brick and 0 represents an empty space. A brick is stable if:
- It is directly connected to the top of the grid, or
- At least one other brick in its four adjacent cells is stable.
You are also given an array hits, which is a sequence of erasures we want to... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1, 0], [1, 0, 0, 0], [1, 1, 1, 0]],hits = [[0, 0], [1, 1], [2, 2]]) == [4, 0, 0]\n assert candidate(grid = [[1, 1, 1, 1], [0, 1, 0, 1], [1, 1, 1, 1]],hits = [[1, 0], [1, 2]]) == [0, 0]\n assert candidate(grid = [[1, ... | [
"[[1,0,0,0],[1,1,1,0]]\n[[1,0]]",
"[[1,0,0,0],[1,1,0,0]]\n[[1,1],[1,0]]"
] | [] | {
"canonical_parameter_names": [
"grid",
"hits"
],
"leetcode_dataset_entry_point": "Solution().hitBricks",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:13",
"tests_total": 155,
... | typescript | {
"raw_signature": "function hitBricks(grid: number[][], hits: number[][]): number[] {",
"container": null,
"callable": "hitBricks",
"parameters": [
{
"name": "grid",
"type": "number[][]"
},
{
"name": "hits",
"type": "number[][]"
}
],
"return_type": "number[]",
"sig... |
804 | unique-morse-code-words | Easy | International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows:
- 'a' maps to ".-",
- 'b' maps to "-...",
- 'c' maps to "-.-.", and so on.
For convenience, the full table for the 26 letters of the English alphabet is given below:
[".-","-...","-.-.","-..",... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(words = ['s', 'u', 'n']) == 3\n assert candidate(words = ['mnop', 'qrst', 'uvwx', 'yz']) == 4\n assert candidate(words = ['hello', 'world']) == 2\n assert candidate(words = ['a']) == 1\n assert candidate(words = ['morse', 'co... | [
"[\"gin\",\"zen\",\"gig\",\"msg\"]",
"[\"a\"]"
] | [] | {
"canonical_parameter_names": [
"words"
],
"leetcode_dataset_entry_point": "Solution().uniqueMorseRepresentations",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:15",
"tests_total": 8... | typescript | {
"raw_signature": "function uniqueMorseRepresentations(words: string[]): number {",
"container": null,
"callable": "uniqueMorseRepresentations",
"parameters": [
{
"name": "words",
"type": "string[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_sou... |
805 | split-array-with-same-average | Hard | You are given an integer array nums.
You should move each element of nums into one of the two arrays A and B such that A and B are non-empty, and average(A) == average(B).
Return true if it is possible to achieve that and false otherwise.
Note that for an array arr, average(arr) is the sum of all the elements of arr... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [10, 20, 30]) == True\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5]) == True\n assert candidate(nums = [2, 4, 6, 8, 10, 12]) == True\n assert candidate(nums = [1, 1, 1, 1]) == True\n assert candidate(nums = [2, 4,... | [
"[1,2,3,4,5,6,7,8]",
"[3,1]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().splitArraySameAverage",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:17",
"tests_total": 100,
... | typescript | {
"raw_signature": "function splitArraySameAverage(nums: number[]): boolean {",
"container": null,
"callable": "splitArraySameAverage",
"parameters": [
{
"name": "nums",
"type": "number[]"
}
],
"return_type": "boolean",
"signature_source": "leetcode/codeSnippets",
"type_source": "lee... |
806 | number-of-lines-to-write-string | Easy | You are given a string s of lowercase English letters and an array widths denoting how many pixels wide each lowercase English letter is. Specifically, widths[0] is the width of 'a', widths[1] is the width of 'b', and so on.
You are trying to write s across several lines, where each line is no longer than 100 pixels. ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(widths = [4, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],s = \"bbbcccdddaaa\") == [2, 4]\n assert candidate(widths = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, ... | [
"[10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]\n\"abcdefghijklmnopqrstuvwxyz\"",
"[4,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10]\n\"bbbcccdddaaa\""
] | [] | {
"canonical_parameter_names": [
"widths",
"s"
],
"leetcode_dataset_entry_point": "Solution().numberOfLines",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:19",
"tests_total": 46,
... | typescript | {
"raw_signature": "function numberOfLines(widths: number[], s: string): number[] {",
"container": null,
"callable": "numberOfLines",
"parameters": [
{
"name": "widths",
"type": "number[]"
},
{
"name": "s",
"type": "string"
}
],
"return_type": "number[]",
"signature... |
807 | max-increase-to-keep-city-skyline | Medium | There is a city composed of n x n blocks, where each block contains a single building shaped like a vertical square prism. You are given a 0-indexed n x n integer matrix grid where grid[r][c] represents the height of the building located in the block at row r and column c.
A city's skyline is the outer contour formed ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(grid = [[1, 1, 1], [1, 1, 1], [1, 1, 1]]) == 0\n assert candidate(grid = [[3, 0, 8, 4], [2, 4, 5, 7], [9, 2, 6, 3], [0, 3, 1, 0]]) == 35\n assert candidate(grid = [[10, 0, 0, 0], [0, 10, 0, 0], [0, 0, 10, 0], [0, 0, 0, 10]]) == 120... | [
"[[3,0,8,4],[2,4,5,7],[9,2,6,3],[0,3,1,0]]",
"[[0,0,0],[0,0,0],[0,0,0]]"
] | [] | {
"canonical_parameter_names": [
"grid"
],
"leetcode_dataset_entry_point": "Solution().maxIncreaseKeepingSkyline",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:22",
"tests_total": 69,... | typescript | {
"raw_signature": "function maxIncreaseKeepingSkyline(grid: number[][]): number {",
"container": null,
"callable": "maxIncreaseKeepingSkyline",
"parameters": [
{
"name": "grid",
"type": "number[][]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_sou... |
808 | soup-servings | Medium | You have two soups, A and B, each starting with n mL. On every turn, one of the following four serving operations is chosen at random, each with probability 0.25 independent of all previous turns:
- pour 100 mL from type A and 0 mL from type B
- pour 75 mL from type A and 25 mL from type B
- pour 50 mL from type A and... | {
"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... | [
"50",
"100"
] | [
"For large n, the answer approaches a constant value.",
"Which soup is more likely to deplete first if we are allowed to perform many operations without bias?"
] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().soupServings",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:24",
"tests_total": 55,
"tests_droppe... | typescript | {
"raw_signature": "function soupServings(n: number): number {",
"container": null,
"callable": "soupServings",
"parameters": [
{
"name": "n",
"type": "number"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
809 | expressive-words | Medium | Sometimes people repeat letters to represent extra feeling. For example:
- "hello" -> "heeellooo"
- "hi" -> "hiiii"
In these strings like "heeellooo", we have groups of adjacent letters that are all the same: "h", "eee", "ll", "ooo".
You are given a string s and an array of query strings words. A query word is stret... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"aaabaaa\",words = ['aa', 'aaa', 'aaaa', 'aabaaa']) == 1\n assert candidate(s = \"aaabaaa\",words = ['aaa', 'aab', 'aaaaa', 'aaabaa', 'aaaba']) == 2\n assert candidate(s = \"abcd\",words = ['abc', 'abcd', 'abdc', 'aabbccdd']) ... | [
"\"heeellooo\"\n[\"hello\", \"hi\", \"helo\"]",
"\"zzzzzyyyyy\"\n[\"zzyy\",\"zy\",\"zyy\"]"
] | [] | {
"canonical_parameter_names": [
"s",
"words"
],
"leetcode_dataset_entry_point": "Solution().expressiveWords",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:26",
"tests_total": 71,... | typescript | {
"raw_signature": "function expressiveWords(s: string, words: string[]): number {",
"container": null,
"callable": "expressiveWords",
"parameters": [
{
"name": "s",
"type": "string"
},
{
"name": "words",
"type": "string[]"
}
],
"return_type": "number",
"signature_s... |
810 | chalkboard-xor-game | Hard | You are given an array of integers nums represents the numbers written on a chalkboard.
Alice and Bob take turns erasing exactly one number from the chalkboard, with Alice starting first. If erasing a number causes the bitwise XOR of all the elements of the chalkboard to become 0, then that player loses. The bitwise X... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(nums = [1, 2, 2, 3]) == True\n assert candidate(nums = [1, 1, 1, 1]) == True\n assert candidate(nums = [8, 15, 23, 42, 67]) == False\n assert candidate(nums = [1, 2, 2, 1]) == True\n assert candidate(nums = [1, 3, 5, 7, 9]) =... | [
"[1,1,2]",
"[0,1]",
"[1,2,3]"
] | [] | {
"canonical_parameter_names": [
"nums"
],
"leetcode_dataset_entry_point": "Solution().xorGame",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:28",
"tests_total": 122,
"tests_dropped... | typescript | {
"raw_signature": "function xorGame(nums: number[]): boolean {",
"container": null,
"callable": "xorGame",
"parameters": [
{
"name": "nums",
"type": "number[]"
}
],
"return_type": "boolean",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
811 | subdomain-visit-count | Medium | A website domain "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com" and at the lowest level, "discuss.leetcode.com". When we visit a domain like "discuss.leetcode.com", we will also visit the parent domains "leetcode.com" and "com" implicitl... | {
"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 ... | [
"[\"9001 discuss.leetcode.com\"]",
"[\"900 google.mail.com\", \"50 yahoo.com\", \"1 intel.mail.com\", \"5 wiki.org\"]"
] | [] | {
"canonical_parameter_names": [
"cpdomains"
],
"leetcode_dataset_entry_point": "Solution().subdomainVisits",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:30",
"tests_total": 68,
"t... | typescript | {
"raw_signature": "function subdomainVisits(cpdomains: string[]): string[] {",
"container": null,
"callable": "subdomainVisits",
"parameters": [
{
"name": "cpdomains",
"type": "string[]"
}
],
"return_type": "string[]",
"signature_source": "leetcode/codeSnippets",
"type_source": "lee... |
812 | largest-triangle-area | Easy | Given an array of points on the X-Y plane points where points[i] = [x_i, y_i], return the area of the largest triangle that can be formed by any three different points. Answers within 10^-5 of the actual answer will be accepted.
Example 1:
Input: points = [[0,0],[0,1],[1,0],[0,2],[2,0]]
Output: 2.00000
Explanation: T... | {
"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... | [
"[[0,0],[0,1],[1,0],[0,2],[2,0]]",
"[[1,0],[0,0],[0,1]]"
] | [] | {
"canonical_parameter_names": [
"points"
],
"leetcode_dataset_entry_point": "Solution().largestTriangleArea",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:33",
"tests_total": 113,
... | typescript | {
"raw_signature": "function largestTriangleArea(points: number[][]): number {",
"container": null,
"callable": "largestTriangleArea",
"parameters": [
{
"name": "points",
"type": "number[][]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "l... |
813 | largest-sum-of-averages | Medium | You are given an integer array nums and an integer k. You can partition the array into at most k non-empty adjacent subarrays. The score of a partition is the sum of the averages of each subarray.
Note that the partition must use every integer in nums, and that the score is not necessarily an integer.
Return the maxi... | {
"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... | [
"[9,1,2,3,9]\n3",
"[1,2,3,4,5,6,7]\n4"
] | [] | {
"canonical_parameter_names": [
"nums",
"k"
],
"leetcode_dataset_entry_point": "Solution().largestSumOfAverages",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:35",
"tests_total":... | typescript | {
"raw_signature": "function largestSumOfAverages(nums: number[], k: number): number {",
"container": null,
"callable": "largestSumOfAverages",
"parameters": [
{
"name": "nums",
"type": "number[]"
},
{
"name": "k",
"type": "number"
}
],
"return_type": "number",
"sig... |
815 | bus-routes | Hard | You are given an array routes representing bus routes where routes[i] is a bus route that the i^th bus repeats forever.
- For example, if routes[0] = [1, 5, 7], this means that the 0^th bus travels in the sequence 1 -> 5 -> 7 -> 1 -> 5 -> 7 -> 1 -> ... forever.
You will start at the bus stop source (You are not on an... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(routes = [[1, 2, 3], [4, 5, 6], [7, 8, 9]],source = 1,target = 9) == -1\n assert candidate(routes = [[1, 2, 3, 4, 5]],source = 1,target = 5) == 1\n assert candidate(routes = [[7, 12], [4, 5, 15], [6], [15, 19], [9, 12, 13]],source ... | [
"[[1,2,7],[3,6,7]]\n1\n6",
"[[7,12],[4,5,15],[6],[15,19],[9,12,13]]\n15\n12"
] | [] | {
"canonical_parameter_names": [
"routes",
"source",
"target"
],
"leetcode_dataset_entry_point": "Solution().numBusesToDestination",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00... | typescript | {
"raw_signature": "function numBusesToDestination(routes: number[][], source: number, target: number): number {",
"container": null,
"callable": "numBusesToDestination",
"parameters": [
{
"name": "routes",
"type": "number[][]"
},
{
"name": "source",
"type": "number"
},
... |
816 | ambiguous-coordinates | Medium | We had some 2-dimensional coordinates, like "(1, 3)" or "(2, 0.5)". Then, we removed all commas, decimal points, and spaces and ended up with the string s.
- For example, "(1, 3)" becomes s = "(13)" and "(2, 0.5)" becomes s = "(205)".
Return a list of strings representing all possibilities for what our original coord... | {
"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 ... | [
"\"(123)\"",
"\"(0123)\"",
"\"(00011)\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().ambiguousCoordinates",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:41",
"tests_total": 93,
"test... | typescript | {
"raw_signature": "function ambiguousCoordinates(s: string): string[] {",
"container": null,
"callable": "ambiguousCoordinates",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "string[]",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/code... |
818 | race-car | Hard | Your car starts at position 0 and speed +1 on an infinite number line. Your car can go into negative positions. Your car drives automatically according to a sequence of instructions 'A' (accelerate) and 'R' (reverse):
- When you get an instruction 'A', your car does the following:
- position += speed
- speed *= 2
... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(target = 3) == 2\n assert candidate(target = 6) == 5\n assert candidate(target = 4) == 5\n assert candidate(target = 10) == 7\n assert candidate(target = 1) == 1\n assert candidate(target = 100) == 19\n assert candidate... | [
"3",
"6"
] | [] | {
"canonical_parameter_names": [
"target"
],
"leetcode_dataset_entry_point": "Solution().racecar",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:46",
"tests_total": 49,
"tests_droppe... | typescript | {
"raw_signature": "function racecar(target: number): number {",
"container": null,
"callable": "racecar",
"parameters": [
{
"name": "target",
"type": "number"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
820 | short-encoding-of-words | Medium | A valid encoding of an array of words is any reference string s and array of indices indices such that:
- words.length == indices.length
- The reference string s ends with the '#' character.
- For each index indices[i], the substring of s starting from indices[i] and up to (but not including) the next '#' character is... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(words = ['abc', 'def', 'ghi', 'jkl', 'mno']) == 20\n assert candidate(words = ['hello', 'hell', 'he', 'h']) == 16\n assert candidate(words = ['aaa', 'aa', 'a']) == 4\n assert candidate(words = ['one', 'two', 'three', 'four', 'fi... | [
"[\"time\",\"me\",\"bell\"]",
"[\"t\"]"
] | [] | {
"canonical_parameter_names": [
"words"
],
"leetcode_dataset_entry_point": "Solution().minimumLengthEncoding",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:48",
"tests_total": 116,
... | typescript | {
"raw_signature": "function minimumLengthEncoding(words: string[]): number {",
"container": null,
"callable": "minimumLengthEncoding",
"parameters": [
{
"name": "words",
"type": "string[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "lee... |
821 | shortest-distance-to-a-character | Easy | Given a string s and a character c that occurs in s, return an array of integers answer where answer.length == s.length and answer[i] is the distance from index i to the closest occurrence of character c in s.
The distance between two indices i and j is abs(i - j), where abs is the absolute value function.
Example 1:... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"abba\",c = \"a\") == [0, 1, 1, 0]\n assert candidate(s = \"loveleetcode\",c = \"e\") == [3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0]\n assert candidate(s = \"abcde\",c = \"e\") == [4, 3, 2, 1, 0]\n assert candidate(s = \"abcabcabc... | [
"\"loveleetcode\"\n\"e\"",
"\"aaab\"\n\"b\""
] | [] | {
"canonical_parameter_names": [
"s",
"c"
],
"leetcode_dataset_entry_point": "Solution().shortestToChar",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:51",
"tests_total": 118,
"... | typescript | {
"raw_signature": "function shortestToChar(s: string, c: string): number[] {",
"container": null,
"callable": "shortestToChar",
"parameters": [
{
"name": "s",
"type": "string"
},
{
"name": "c",
"type": "string"
}
],
"return_type": "number[]",
"signature_source": "l... |
822 | card-flipping-game | Medium | You are given two 0-indexed integer arrays fronts and backs of length n, where the i^th card has the positive integer fronts[i] printed on the front and backs[i] printed on the back. Initially, each card is placed on a table such that the front number is facing up and the other is facing down. You may flip over any num... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(fronts = [1, 3, 5, 7],backs = [2, 4, 6, 8]) == 1\n assert candidate(fronts = [1, 1, 2, 2],backs = [2, 2, 1, 1]) == 1\n assert candidate(fronts = [1, 3, 5, 7],backs = [2, 4, 6, 8]) == 1\n assert candidate(fronts = [1, 2, 3, 4, 5]... | [
"[1,2,4,4,7]\n[1,3,4,1,3]",
"[1]\n[1]"
] | [] | {
"canonical_parameter_names": [
"fronts",
"backs"
],
"leetcode_dataset_entry_point": "Solution().flipgame",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:53",
"tests_total": 107,
... | typescript | {
"raw_signature": "function flipgame(fronts: number[], backs: number[]): number {",
"container": null,
"callable": "flipgame",
"parameters": [
{
"name": "fronts",
"type": "number[]"
},
{
"name": "backs",
"type": "number[]"
}
],
"return_type": "number",
"signature_s... |
823 | binary-trees-with-factors | Medium | Given an array of unique integers, arr, where each integer arr[i] is strictly greater than 1.
We make a binary tree using these integers, and each number may be used for any number of times. Each non-leaf node's value should be equal to the product of the values of its children.
Return the number of binary trees we c... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(arr = [10, 20, 40, 80]) == 4\n assert candidate(arr = [2, 4, 5, 10]) == 7\n assert candidate(arr = [2, 3, 6, 18]) == 12\n assert candidate(arr = [5, 10, 20, 40, 80]) == 5\n assert candidate(arr = [18, 3, 6, 2]) == 12\n ass... | [
"[2,4]",
"[2,4,5,10]"
] | [] | {
"canonical_parameter_names": [
"arr"
],
"leetcode_dataset_entry_point": "Solution().numFactoredBinaryTrees",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:55",
"tests_total": 105,
... | typescript | {
"raw_signature": "function numFactoredBinaryTrees(arr: number[]): number {",
"container": null,
"callable": "numFactoredBinaryTrees",
"parameters": [
{
"name": "arr",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetc... |
824 | goat-latin | Easy | You are given a string sentence that consist of words separated by spaces. Each word consists of lowercase and uppercase letters only.
We would like to convert the sentence to "Goat Latin" (a made-up language similar to Pig Latin.) The rules of Goat Latin are as follows:
- If a word begins with a vowel ('a', 'e', 'i'... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(sentence = \"Convert this sentence\") == \"onvertCmaa histmaaa entencesmaaaa\"\n assert candidate(sentence = \"In the end\") == \"Inmaa hetmaaa endmaaaa\"\n assert candidate(sentence = \"a e i o u\") == \"amaa emaaa imaaaa omaaaaa ... | [
"\"I speak Goat Latin\"",
"\"The quick brown fox jumped over the lazy dog\""
] | [] | {
"canonical_parameter_names": [
"sentence"
],
"leetcode_dataset_entry_point": "Solution().toGoatLatin",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:57",
"tests_total": 135,
"tests... | typescript | {
"raw_signature": "function toGoatLatin(sentence: string): string {",
"container": null,
"callable": "toGoatLatin",
"parameters": [
{
"name": "sentence",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets... |
825 | friends-of-appropriate-ages | Medium | There are n persons on a social media website. You are given an integer array ages where ages[i] is the age of the i^th person.
A Person x will not send a friend request to a person y (x != y) if any of the following conditions is true:
- age[y] <= 0.5 * age[x] + 7
- age[y] > age[x]
- age[y] > 100 && age[x] < 100
Ot... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(ages = [120, 119, 118, 117, 116, 115, 114, 113, 112, 111, 110]) == 55\n assert candidate(ages = [25, 25, 25, 25, 25, 25, 25, 25, 25, 25]) == 90\n assert candidate(ages = [18, 18, 18, 18, 18, 18, 18, 18, 18, 18]) == 90\n assert c... | [
"[16,16]",
"[16,17,18]",
"[20,30,100,110,120]"
] | [] | {
"canonical_parameter_names": [
"ages"
],
"leetcode_dataset_entry_point": "Solution().numFriendRequests",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:00:59",
"tests_total": 102,
"tes... | typescript | {
"raw_signature": "function numFriendRequests(ages: number[]): number {",
"container": null,
"callable": "numFriendRequests",
"parameters": [
{
"name": "ages",
"type": "number[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/code... |
826 | most-profit-assigning-work | Medium | You have n jobs and m workers. You are given three arrays: difficulty, profit, and worker where:
- difficulty[i] and profit[i] are the difficulty and the profit of the i^th job, and
- worker[j] is the ability of j^th worker (i.e., the j^th worker can only complete a job with difficulty at most worker[j]).
Every worke... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(difficulty = [68, 35, 52, 47, 86],profit = [67, 17, 17, 26, 86],worker = [68, 37, 50, 76, 33]) == 177\n assert candidate(difficulty = [10, 15, 25],profit = [100, 150, 250],worker = [20, 25, 30]) == 650\n assert candidate(difficulty... | [
"[2,4,6,8,10]\n[10,20,30,40,50]\n[4,5,6,7]",
"[85,47,57]\n[24,66,99]\n[40,25,25]"
] | [] | {
"canonical_parameter_names": [
"difficulty",
"profit",
"worker"
],
"leetcode_dataset_entry_point": "Solution().maxProfitAssignment",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:... | typescript | {
"raw_signature": "function maxProfitAssignment(difficulty: number[], profit: number[], worker: number[]): number {",
"container": null,
"callable": "maxProfitAssignment",
"parameters": [
{
"name": "difficulty",
"type": "number[]"
},
{
"name": "profit",
"type": "number[]"
... |
827 | making-a-large-island | Hard | You are given an n x n binary matrix grid. You are allowed to change at most one 0 to be 1.
Return the size of the largest island in grid after applying this operation.
An island is a 4-directionally connected group of 1s.
Example 1:
Input: grid = [[1,0],[0,1]]
Output: 3
Explanation: Change one 0 to 1 and connect t... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(grid = [[1, 1], [1, 0]]) == 4\n assert candidate(grid = [[1, 0], [0, 1]]) == 3\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 9\n assert candidate(grid = [[1, 1, 1, 1], [1, 0, 0, 1], [1, 0, 0, 1], [1, 1, 1, 1]])... | [
"[[1,0],[0,1]]",
"[[1,1],[1,0]]",
"[[1,1],[1,1]]"
] | [] | {
"canonical_parameter_names": [
"grid"
],
"leetcode_dataset_entry_point": "Solution().largestIsland",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:05",
"tests_total": 81,
"tests_dr... | typescript | {
"raw_signature": "function largestIsland(grid: number[][]): number {",
"container": null,
"callable": "largestIsland",
"parameters": [
{
"name": "grid",
"type": "number[][]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnip... |
828 | count-unique-characters-of-all-substrings-of-a-given-string | Hard | Let's define a function countUniqueChars(s) that returns the number of unique characters in s.
- For example, calling countUniqueChars(s) if s = "LEETCODE" then "L", "T", "C", "O", "D" are the unique characters since they appear only once in s, therefore countUniqueChars(s) = 5.
Given a string s, return the sum of co... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"ABCDEFG\") == 84\n assert candidate(s = \"ABAC\") == 16\n assert candidate(s = \"ABAB\") == 12\n assert candidate(s = \"JXWTRVABFBJSFNWFTTTOWEJXSGZSWQSZSQXRXRJTSFO\") == 4609\n assert candidate(s = \"ABCABC\") == 36\n ... | [
"\"ABC\"",
"\"ABA\"",
"\"LEETCODE\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().uniqueLetterString",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:08",
"tests_total": 160,
"tests... | typescript | {
"raw_signature": "function uniqueLetterString(s: string): number {",
"container": null,
"callable": "uniqueLetterString",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets... |
829 | consecutive-numbers-sum | Hard | Given an integer n, return the number of ways you can write n as the sum of consecutive positive integers.
Example 1:
Input: n = 5
Output: 2
Explanation: 5 = 2 + 3
Example 2:
Input: n = 9
Output: 3
Explanation: 9 = 4 + 5 = 2 + 3 + 4
Example 3:
Input: n = 15
Output: 4
Explanation: 15 = 8 + 7 = 4 + 5 + 6 = 1 + 2 + ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 100) == 3\n assert candidate(n = 15) == 4\n assert candidate(n = 9) == 3\n assert candidate(n = 1000000) == 7\n assert candidate(n = 25) == 3\n assert candidate(n = 1) == 1\n assert candidate(n = 1000000000) == 10\n... | [
"5",
"9",
"15"
] | [] | {
"canonical_parameter_names": [
"n"
],
"leetcode_dataset_entry_point": "Solution().consecutiveNumbersSum",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:10",
"tests_total": 53,
"tes... | typescript | {
"raw_signature": "function consecutiveNumbersSum(n: number): number {",
"container": null,
"callable": "consecutiveNumbersSum",
"parameters": [
{
"name": "n",
"type": "number"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSn... |
830 | positions-of-large-groups | Easy | In a string s of lowercase letters, these letters form consecutive groups of the same character.
For example, a string like s = "abbxxxxzyy" has the groups "a", "bb", "xxxx", "z", and "yy".
A group is identified by an interval [start, end], where start and end denote the start and end indices (inclusive) of the group... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"aabbbccccdddd\") == [[2, 4], [5, 8], [9, 12]]\n assert candidate(s = \"aabbbccccddeee\") == [[2, 4], [5, 8], [11, 13]]\n assert candidate(s = \"abcdefghijk\") == []\n assert candidate(s = \"aabbaa\") == []\n assert cand... | [
"\"abbxxxxzzy\"",
"\"abc\"",
"\"abcdddeeeeaabbbcd\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().largeGroupPositions",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:12",
"tests_total": 54,
"tests... | typescript | {
"raw_signature": "function largeGroupPositions(s: string): number[][] {",
"container": null,
"callable": "largeGroupPositions",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "number[][]",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/co... |
831 | masking-personal-information | Medium | You are given a personal information string s, representing either an email address or a phone number. Return the masked personal information using the below rules.
Email address:
An email address is:
- A name consisting of at least two uppercase and lowercase English letters, followed by
- The '@' symbol, followed ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"12345678901\") == \"+*-***-***-8901\"\n assert candidate(s = \"+11234567890\") == \"+*-***-***-7890\"\n assert candidate(s = \"123 456 7890\") == \"***-***-7890\"\n assert candidate(s = \"+1-800-555-0199\") == \"+*-***-***... | [
"\"LeetCode@LeetCode.com\"",
"\"AB@qq.com\"",
"\"1(234)567-890\""
] | [] | {
"canonical_parameter_names": [
"s"
],
"leetcode_dataset_entry_point": "Solution().maskPII",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:15",
"tests_total": 187,
"tests_dropped": ... | typescript | {
"raw_signature": "function maskPII(s: string): string {",
"container": null,
"callable": "maskPII",
"parameters": [
{
"name": "s",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippets"
} |
832 | flipping-an-image | Easy | Given an n x n binary matrix image, flip the image horizontally, then invert it, and return the resulting image.
To flip an image horizontally means that each row of the image is reversed.
- For example, flipping [1,1,0] horizontally results in [0,1,1].
To invert an image means that each 0 is replaced by 1, and each... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(image = [[1, 1], [1, 0]]) == [[0, 0], [1, 0]]\n assert candidate(image = [[1, 1, 0, 0], [1, 0, 0, 1], [0, 1, 1, 1], [1, 0, 1, 0]]) == [[1, 1, 0, 0], [0, 1, 1, 0], [0, 0, 0, 1], [1, 0, 1, 0]]\n assert candidate(image = [[1, 0, 1], [... | [
"[[1,1,0],[1,0,1],[0,0,0]]",
"[[1,1,0,0],[1,0,0,1],[0,1,1,1],[1,0,1,0]]"
] | [] | {
"canonical_parameter_names": [
"image"
],
"leetcode_dataset_entry_point": "Solution().flipAndInvertImage",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:17",
"tests_total": 61,
"te... | typescript | {
"raw_signature": "function flipAndInvertImage(image: number[][]): number[][] {",
"container": null,
"callable": "flipAndInvertImage",
"parameters": [
{
"name": "image",
"type": "number[][]"
}
],
"return_type": "number[][]",
"signature_source": "leetcode/codeSnippets",
"type_source"... |
833 | find-and-replace-in-string | Medium | You are given a 0-indexed string s that you must perform k replacement operations on. The replacement operations are given as three 0-indexed parallel arrays, indices, sources, and targets, all of length k.
To complete the i^th replacement operation:
1. Check if the substring sources[i] occurs at index indices[i] in ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(s = \"abcd\",indices = [0, 2],sources = ['a', 'cd'],targets = ['eee', 'ffff']) == \"eeebffff\"\n assert candidate(s = \"abcd\",indices = [0, 1, 2, 3],sources = ['a', 'b', 'c', 'd'],targets = ['aa', 'bb', 'cc', 'dd']) == \"aabbccdd\"\n... | [
"\"abcd\"\n[0, 2]\n[\"a\", \"cd\"]\n[\"eee\", \"ffff\"]",
"\"abcd\"\n[0, 2]\n[\"ab\",\"ec\"]\n[\"eee\",\"ffff\"]"
] | [] | {
"canonical_parameter_names": [
"s",
"indices",
"sources",
"targets"
],
"leetcode_dataset_entry_point": "Solution().findReplaceString",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-... | typescript | {
"raw_signature": "function findReplaceString(s: string, indices: number[], sources: string[], targets: string[]): string {",
"container": null,
"callable": "findReplaceString",
"parameters": [
{
"name": "s",
"type": "string"
},
{
"name": "indices",
"type": "number[]"
},... |
834 | sum-of-distances-in-tree | Hard | There is an undirected connected tree with n nodes labeled from 0 to n - 1 and n - 1 edges.
You are given the integer n and the array edges where edges[i] = [a_i, b_i] indicates that there is an edge between nodes a_i and b_i in the tree.
Return an array answer of length n where answer[i] is the sum of the distances ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(n = 10,edges = [[0, 1], [0, 2], [0, 3], [1, 4], [1, 5], [2, 6], [2, 7], [3, 8], [3, 9]]) == [15, 19, 19, 19, 27, 27, 27, 27, 27, 27]\n assert candidate(n = 7,edges = [[0, 1], [0, 2], [1, 3], [1, 4], [2, 5], [2, 6]]) == [10, 11, 11, 16... | [
"6\n[[0,1],[0,2],[2,3],[2,4],[2,5]]",
"1\n[]",
"2\n[[1,0]]"
] | [] | {
"canonical_parameter_names": [
"n",
"edges"
],
"leetcode_dataset_entry_point": "Solution().sumOfDistancesInTree",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:21",
"tests_total"... | typescript | {
"raw_signature": "function sumOfDistancesInTree(n: number, edges: number[][]): number[] {",
"container": null,
"callable": "sumOfDistancesInTree",
"parameters": [
{
"name": "n",
"type": "number"
},
{
"name": "edges",
"type": "number[][]"
}
],
"return_type": "number[... |
835 | image-overlap | Medium | You are given two images, img1 and img2, represented as binary, square matrices of size n x n. A binary matrix has only 0s and 1s as values.
We translate one image however we choose by sliding all the 1 bits left, right, up, and/or down any number of units. We then place it on top of the other image. We can then calcu... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(img1 = [[1, 1, 0], [0, 1, 0], [0, 1, 0]],img2 = [[0, 0, 0], [0, 1, 1], [0, 0, 1]]) == 3\n assert candidate(img1 = [[1, 0], [0, 1]],img2 = [[1, 1], [1, 1]]) == 2\n assert candidate(img1 = [[1, 1, 1], [1, 1, 1], [1, 1, 1]],img2 = [[0... | [
"[[1,1,0],[0,1,0],[0,1,0]]\n[[0,0,0],[0,1,1],[0,0,1]]",
"[[1]]\n[[1]]",
"[[0]]\n[[0]]"
] | [] | {
"canonical_parameter_names": [
"img1",
"img2"
],
"leetcode_dataset_entry_point": "Solution().largestOverlap",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:23",
"tests_total": 75... | typescript | {
"raw_signature": "function largestOverlap(img1: number[][], img2: number[][]): number {",
"container": null,
"callable": "largestOverlap",
"parameters": [
{
"name": "img1",
"type": "number[][]"
},
{
"name": "img2",
"type": "number[][]"
}
],
"return_type": "number",
... |
836 | rectangle-overlap | Easy | An axis-aligned rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) is the coordinate of its bottom-left corner, and (x2, y2) is the coordinate of its top-right corner. Its top and bottom edges are parallel to the X-axis, and its left and right edges are parallel to the Y-axis.
Two rectangles overlap i... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(rec1 = [-5, -5, -3, -3],rec2 = [-4, -4, -2, -2]) == True\n assert candidate(rec1 = [1, 1, 5, 5],rec2 = [4, 4, 8, 8]) == True\n assert candidate(rec1 = [-5, -5, -2, -2],rec2 = [-4, -4, -1, -1]) == True\n assert candidate(rec1 = [... | [
"[0,0,2,2]\n[1,1,3,3]",
"[0,0,1,1]\n[1,0,2,1]",
"[0,0,1,1]\n[2,2,3,3]"
] | [] | {
"canonical_parameter_names": [
"rec1",
"rec2"
],
"leetcode_dataset_entry_point": "Solution().isRectangleOverlap",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:26",
"tests_total"... | typescript | {
"raw_signature": "function isRectangleOverlap(rec1: number[], rec2: number[]): boolean {",
"container": null,
"callable": "isRectangleOverlap",
"parameters": [
{
"name": "rec1",
"type": "number[]"
},
{
"name": "rec2",
"type": "number[]"
}
],
"return_type": "boolean"... |
837 | new-21-game | Medium | Alice plays the following game, loosely based on the card game "21".
Alice starts with 0 points and draws numbers while she has less than k points. During each draw, she gains an integer number of points randomly from the range [1, maxPts], where maxPts is an integer. Each draw is independent and the outcomes have equ... | {
"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... | [
"10\n1\n10",
"6\n1\n10",
"21\n17\n10"
] | [] | {
"canonical_parameter_names": [
"n",
"k",
"maxPts"
],
"leetcode_dataset_entry_point": "Solution().new21Game",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:28",
"tests_total":... | typescript | {
"raw_signature": "function new21Game(n: number, k: number, maxPts: number): number {",
"container": null,
"callable": "new21Game",
"parameters": [
{
"name": "n",
"type": "number"
},
{
"name": "k",
"type": "number"
},
{
"name": "maxPts",
"type": "number"
... |
838 | push-dominoes | Medium | There are n dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to the left or to the right.
After each second, each domino that is falling to the left pushes the adjacent domino on the left. Similarly, the dominoes falling to the right ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(dominoes = \"R..L\") == \"RRLL\"\n assert candidate(dominoes = \"..R......L..\") == \"..RRRRLLLL..\"\n assert candidate(dominoes = \"RRRRRRRRRR\") == \"RRRRRRRRRR\"\n assert candidate(dominoes = \"L........R\") == \"L........R\"... | [
"\"RR.L\"",
"\".L.R...LR..L..\""
] | [] | {
"canonical_parameter_names": [
"dominoes"
],
"leetcode_dataset_entry_point": "Solution().pushDominoes",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:30",
"tests_total": 162,
"test... | typescript | {
"raw_signature": "function pushDominoes(dominoes: string): string {",
"container": null,
"callable": "pushDominoes",
"parameters": [
{
"name": "dominoes",
"type": "string"
}
],
"return_type": "string",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSnippe... |
839 | similar-string-groups | Hard | Two strings, X and Y, are considered similar if either they are identical or we can make them equivalent by swapping at most two letters (in distinct positions) within the string X.
For example, "tars" and "rats" are similar (swapping at positions 0 and 2), and "rats" and "arts" are similar, but "star" is not similar ... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(strs = ['abc', 'bca', 'cab', 'cba', 'bac', 'acb']) == 1\n assert candidate(strs = ['ab', 'ba', 'abc', 'cab', 'bca']) == 1\n assert candidate(strs = ['aaaaa', 'aaabb', 'aaabc', 'aaaba', 'aaaaa']) == 1\n assert candidate(strs = ['... | [
"[\"tars\",\"rats\",\"arts\",\"star\"]",
"[\"omv\",\"ovm\"]"
] | [] | {
"canonical_parameter_names": [
"strs"
],
"leetcode_dataset_entry_point": "Solution().numSimilarGroups",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:32",
"tests_total": 57,
"tests... | typescript | {
"raw_signature": "function numSimilarGroups(strs: string[]): number {",
"container": null,
"callable": "numSimilarGroups",
"parameters": [
{
"name": "strs",
"type": "string[]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/codeSn... |
840 | magic-squares-in-grid | Medium | A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, column, and both diagonals all have the same sum.
Given a row x col grid of integers, how many 3 x 3 magic square subgrids are there?
Note: while a magic square can only contain numbers from 1 to 9, grid may contain numb... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(grid = [[4, 3, 8, 4, 0], [9, 5, 1, 9, 3], [2, 7, 6, 2, 4], [1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) == 1\n assert candidate(grid = [[7, 0, 5], [3, 5, 1], [6, 4, 3]]) == 0\n assert candidate(grid = [[8]]) == 0\n assert candidate(grid ... | [
"[[4,3,8,4],[9,5,1,9],[2,7,6,2]]",
"[[8]]"
] | [] | {
"canonical_parameter_names": [
"grid"
],
"leetcode_dataset_entry_point": "Solution().numMagicSquaresInside",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:35",
"tests_total": 82,
"... | typescript | {
"raw_signature": "function numMagicSquaresInside(grid: number[][]): number {",
"container": null,
"callable": "numMagicSquaresInside",
"parameters": [
{
"name": "grid",
"type": "number[][]"
}
],
"return_type": "number",
"signature_source": "leetcode/codeSnippets",
"type_source": "l... |
841 | keys-and-rooms | Medium | There are n rooms labeled from 0 to n - 1 and all the rooms are locked except for room 0. Your goal is to visit all the rooms. However, you cannot enter a locked room without having its key.
When you visit a room, you may find a set of distinct keys in it. Each key has a number on it, denoting which room it unlocks, a... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(rooms = [[1], [2], [], [3]]) == False\n assert candidate(rooms = [[1], [1, 2], [2], []]) == False\n assert candidate(rooms = [[1], [2, 3], [3], []]) == True\n assert candidate(rooms = [[2, 3], [0, 1], [3], [0]]) == False\n as... | [
"[[1],[2],[3],[]]",
"[[1,3],[3,0,1],[2],[0]]"
] | [] | {
"canonical_parameter_names": [
"rooms"
],
"leetcode_dataset_entry_point": "Solution().canVisitAllRooms",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:37",
"tests_total": 86,
"test... | typescript | {
"raw_signature": "function canVisitAllRooms(rooms: number[][]): boolean {",
"container": null,
"callable": "canVisitAllRooms",
"parameters": [
{
"name": "rooms",
"type": "number[][]"
}
],
"return_type": "boolean",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcod... |
842 | split-array-into-fibonacci-sequence | Medium | You are given a string of digits num, such as "123456579". We can split it into a Fibonacci-like sequence [123, 456, 579].
Formally, a Fibonacci-like sequence is a list f of non-negative integers such that:
- 0 <= f[i] < 2^31, (that is, each integer fits in a 32-bit signed integer type),
- f.length >= 3, and
- f[i] +... | {
"language": "python",
"source": "def check(candidate):\n assert candidate(num = \"10\") == []\n assert candidate(num = \"1203\") == []\n assert candidate(num = \"101001011001101110000110011100011010011110000\") == []\n assert candidate(num = \"0123\") == []\n assert candidate(num = \"53983465721539... | [
"\"1101111\"",
"\"112358130\"",
"\"0123\""
] | [] | {
"canonical_parameter_names": [
"num"
],
"leetcode_dataset_entry_point": "Solution().splitIntoFibonacci",
"problem_source": "newfacade/LeetCodeDataset",
"description_source": "leetcode.com",
"interface_source": "leetcode/codeSnippets",
"fetched_at": "2026-09-30T20:01:39",
"tests_total": 78,
"test... | typescript | {
"raw_signature": "function splitIntoFibonacci(num: string): number[] {",
"container": null,
"callable": "splitIntoFibonacci",
"parameters": [
{
"name": "num",
"type": "string"
}
],
"return_type": "number[]",
"signature_source": "leetcode/codeSnippets",
"type_source": "leetcode/code... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.