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
871
minimum-number-of-refueling-stops
Hard
A car travels from a starting position to a destination which is target miles east of the starting position. There are gas stations along the way. The gas stations are represented as an array stations where stations[i] = [position_i, fuel_i] indicates that the i^th gas station is position_i miles east of the starting ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(target = 100,startFuel = 100,stations = [[10, 10], [20, 20], [30, 30], [40, 40], [50, 50]]) == 0\n assert candidate(target = 150,startFuel = 50,stations = [[25, 25], [50, 50], [75, 25]]) == 3\n assert candidate(target = 150,startFu...
[ "1\n1\n[]", "100\n1\n[[10,100]]", "100\n10\n[[10,60],[20,30],[30,30],[60,40]]" ]
[]
{ "canonical_parameter_names": [ "target", "startFuel", "stations" ], "leetcode_dataset_entry_point": "Solution().minRefuelStops", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:02:3...
cpp
{ "raw_signature": "int minRefuelStops(int target, int startFuel, vector<vector<int>>& stations) {", "container": "Solution", "callable": "minRefuelStops", "parameters": [ { "name": "target", "type": "int" }, { "name": "startFuel", "type": "int" }, { "name": "st...
873
length-of-longest-fibonacci-subsequence
Medium
A sequence x_1, x_2, ..., x_n is Fibonacci-like if: - n >= 3 - x_i + x_{i+1} == x_{i+2} for all i + 2 <= n Given a strictly increasing array arr of positive integers forming a sequence, return the length of the longest Fibonacci-like subsequence of arr. If one does not exist, return 0. A subsequence is derived from ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 2, 3, 4, 6, 9, 13, 19, 28, 41, 60, 88]) == 3\n assert candidate(arr = [1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946]) == 20\n assert candidate(arr = [2, 4, 7, 11, 18, 29, 47, 7...
[ "[1,2,3,4,5,6,7,8]", "[1,3,7,11,12,14,18]" ]
[ "Can we use dynamic programming here?", "Consider a sequence ending at index iarr[i], which can be done in linear time per element." ]
{ "canonical_parameter_names": [ "arr" ], "leetcode_dataset_entry_point": "Solution().lenLongestFibSubseq", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:02:41", "tests_total": 122, "te...
cpp
{ "raw_signature": "int lenLongestFibSubseq(vector<int>& arr) {", "container": "Solution", "callable": "lenLongestFibSubseq", "parameters": [ { "name": "arr", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeS...
874
walking-robot-simulation
Medium
A robot on an infinite XY-plane starts at point (0, 0) facing north. The robot receives an array of integers commands, which represents a sequence of moves that it needs to execute. There are only three possible types of instructions the robot can receive: - -2: Turn left 90 degrees. - -1: Turn right 90 degrees. - 1 <...
{ "language": "python", "source": "def check(candidate):\n assert candidate(commands = [5, -2, 5, -2, 5, -2, 5],obstacles = [[-1, -1], [1, 1]]) == 50\n assert candidate(commands = [1, -2, 1, -2, 1, -2, 1, -2],obstacles = [[0, 1], [1, 0], [-1, 0], [0, -1]]) == 0\n assert candidate(commands = [5, -2, 5, -2, ...
[ "[4,-1,3]\n[]", "[4,-1,4,-2,4]\n[[2,4]]", "[-1,9]\n[[5,0],[2,0]]" ]
[]
{ "canonical_parameter_names": [ "commands", "obstacles" ], "leetcode_dataset_entry_point": "Solution().robotSim", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:02:43", "tests_total":...
cpp
{ "raw_signature": "int robotSim(vector<int>& commands, vector<vector<int>>& obstacles) {", "container": "Solution", "callable": "robotSim", "parameters": [ { "name": "commands", "type": "vector<int>&" }, { "name": "obstacles", "type": "vector<vector<int>>&" } ], "ret...
875
koko-eating-bananas
Medium
Koko loves to eat bananas. There are n piles of bananas, the i^th pile has piles[i] bananas. The guards have gone and will come back in h hours. Koko can decide her bananas-per-hour eating speed of k. Each hour, she chooses some pile of bananas and eats k bananas from that pile. If the pile has less than k bananas, sh...
{ "language": "python", "source": "def check(candidate):\n assert candidate(piles = [1, 2, 3],h = 5) == 2\n assert candidate(piles = [1000000000],h = 1000000000) == 1\n assert candidate(piles = [805306457, 805306457, 805306457],h = 1000000000) == 3\n assert candidate(piles = [30, 11, 23, 4, 20],h = 5) =...
[ "[3,6,7,11]\n8", "[30,11,23,4,20]\n5", "[30,11,23,4,20]\n6" ]
[]
{ "canonical_parameter_names": [ "piles", "h" ], "leetcode_dataset_entry_point": "Solution().minEatingSpeed", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:02:45", "tests_total": 124,...
cpp
{ "raw_signature": "int minEatingSpeed(vector<int>& piles, int h) {", "container": "Solution", "callable": "minEatingSpeed", "parameters": [ { "name": "piles", "type": "vector<int>&" }, { "name": "h", "type": "int" } ], "return_type": "int", "signature_source": "lee...
877
stone-game
Medium
Alice and Bob play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to end with the most stones. The total number of stones across all the piles is odd, so there are no ties. Alice and Bob tak...
{ "language": "python", "source": "def check(candidate):\n assert candidate(piles = [15, 30, 5, 10, 20, 25]) == True\n assert candidate(piles = [8, 15, 3, 7]) == True\n assert candidate(piles = [7, 3, 8, 5, 12, 10]) == True\n assert candidate(piles = [1, 2, 3, 4, 5, 6, 7, 8]) == True\n assert candida...
[ "[5,3,4,5]", "[3,7,2,3]" ]
[]
{ "canonical_parameter_names": [ "piles" ], "leetcode_dataset_entry_point": "Solution().stoneGame", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:02:50", "tests_total": 119, "tests_drop...
cpp
{ "raw_signature": "bool stoneGame(vector<int>& piles) {", "container": "Solution", "callable": "stoneGame", "parameters": [ { "name": "piles", "type": "vector<int>&" } ], "return_type": "bool", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
878
nth-magical-number
Hard
A positive integer is magical if it is divisible by either a or b. Given the three integers n, a, and b, return the n^th magical number. Since the answer may be very large, return it modulo 10^9 + 7. Example 1: Input: n = 1, a = 2, b = 3 Output: 2 Example 2: Input: n = 4, a = 2, b = 3 Output: 6 Constraints: - 1 ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 5,a = 6,b = 5) == 15\n assert candidate(n = 10,a = 3,b = 7) == 24\n assert candidate(n = 1000000000,a = 2,b = 3) == 499999993\n assert candidate(n = 10,a = 7,b = 3) == 24\n assert candidate(n = 5,a = 3,b = 5) == 10\n a...
[ "1\n2\n3", "4\n2\n3" ]
[]
{ "canonical_parameter_names": [ "n", "a", "b" ], "leetcode_dataset_entry_point": "Solution().nthMagicalNumber", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:02:52", "tests_total...
cpp
{ "raw_signature": "int nthMagicalNumber(int n, int a, int b) {", "container": "Solution", "callable": "nthMagicalNumber", "parameters": [ { "name": "n", "type": "int" }, { "name": "a", "type": "int" }, { "name": "b", "type": "int" } ], "return_typ...
879
profitable-schemes
Hard
There is a group of n members, and a list of various crimes they could commit. The i^th crime generates a profit[i] and requires group[i] members to participate in it. If a member participates in one crime, that member can't participate in another crime. Let's call a profitable scheme any subset of these crimes that g...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 4,minProfit = 4,group = [4],profit = [5]) == 1\n assert candidate(n = 3,minProfit = 0,group = [1, 2],profit = [0, 0]) == 4\n assert candidate(n = 100,minProfit = 100,group = [100],profit = [100]) == 1\n assert candidate(n = ...
[ "5\n3\n[2,2]\n[2,3]", "10\n5\n[2,3,5]\n[6,7,8]" ]
[]
{ "canonical_parameter_names": [ "n", "minProfit", "group", "profit" ], "leetcode_dataset_entry_point": "Solution().profitableSchemes", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-3...
cpp
{ "raw_signature": "int profitableSchemes(int n, int minProfit, vector<int>& group, vector<int>& profit) {", "container": "Solution", "callable": "profitableSchemes", "parameters": [ { "name": "n", "type": "int" }, { "name": "minProfit", "type": "int" }, { "name...
880
decoded-string-at-index
Medium
You are given an encoded string s. To decode the string to a tape, the encoded string is read one character at a time and the following steps are taken: - If the character read is a letter, that letter is written onto the tape. - If the character read is a digit d, the entire current tape is repeatedly written d - 1 m...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"x5\",k = 15) == \"x\"\n assert candidate(s = \"y959q969u3hb22\",k = 200) == \"y\"\n assert candidate(s = \"abc2d3\",k = 7) == \"d\"\n assert candidate(s = \"y959q969u3hb22\",k = 94921609) == \"y\"\n assert candidate(s =...
[ "\"leet2code3\"\n10", "\"ha22\"\n5", "\"a2345678999999999999999\"\n1" ]
[]
{ "canonical_parameter_names": [ "s", "k" ], "leetcode_dataset_entry_point": "Solution().decodeAtIndex", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:02:56", "tests_total": 101, "t...
cpp
{ "raw_signature": "string decodeAtIndex(string s, int k) {", "container": "Solution", "callable": "decodeAtIndex", "parameters": [ { "name": "s", "type": "string" }, { "name": "k", "type": "int" } ], "return_type": "string", "signature_source": "leetcode/codeSnippe...
881
boats-to-save-people
Medium
You are given an array people where people[i] is the weight of the i^th person, and an infinite number of boats where each boat can carry a maximum weight of limit. Each boat carries at most two people at the same time, provided the sum of the weight of those people is at most limit. Return the minimum number of boats...
{ "language": "python", "source": "def check(candidate):\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],limit = 11) == 5\n assert candidate(people = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],limit = 15) == 5\n assert candidate(people = [3, 2, 2, 1],limit = 3) == 3\n assert candidate(people = [5, 5, 5...
[ "[1,2]\n3", "[3,2,2,1]\n3", "[3,5,3,4]\n5" ]
[]
{ "canonical_parameter_names": [ "people", "limit" ], "leetcode_dataset_entry_point": "Solution().numRescueBoats", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:02:59", "tests_total":...
cpp
{ "raw_signature": "int numRescueBoats(vector<int>& people, int limit) {", "container": "Solution", "callable": "numRescueBoats", "parameters": [ { "name": "people", "type": "vector<int>&" }, { "name": "limit", "type": "int" } ], "return_type": "int", "signature_sou...
882
reachable-nodes-in-subdivided-graph
Hard
You are given an undirected graph (the "original graph") with n nodes labeled from 0 to n - 1. You decide to subdivide each edge in the graph into a chain of nodes, with the number of new nodes varying between each edge. The graph is given as a 2D array of edges where edges[i] = [u_i, v_i, cnt_i] indicates that there ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(edges = [[0, 1, 4], [1, 2, 6], [0, 2, 8], [1, 3, 1]],maxMoves = 10,n = 4) == 23\n assert candidate(edges = [[0, 1, 0], [1, 2, 0]],maxMoves = 3,n = 3) == 3\n assert candidate(edges = [[0, 1, 5]],maxMoves = 5,n = 2) == 6\n assert ...
[ "[[0,1,10],[0,2,1],[1,2,2]]\n6\n3", "[[0,1,4],[1,2,6],[0,2,8],[1,3,1]]\n10\n4", "[[1,2,4],[1,4,5],[1,3,1],[2,3,4],[3,4,5]]\n17\n5" ]
[]
{ "canonical_parameter_names": [ "edges", "maxMoves", "n" ], "leetcode_dataset_entry_point": "Solution().reachableNodes", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:01", "te...
cpp
{ "raw_signature": "int reachableNodes(vector<vector<int>>& edges, int maxMoves, int n) {", "container": "Solution", "callable": "reachableNodes", "parameters": [ { "name": "edges", "type": "vector<vector<int>>&" }, { "name": "maxMoves", "type": "int" }, { "name...
883
projection-area-of-3d-shapes
Easy
You are given an n x n grid where we place some 1 x 1 x 1 cubes that are axis-aligned with the x, y, and z axes. Each value v = grid[i][j] represents a tower of v cubes placed on top of the cell (i, j). We view the projection of these cubes onto the xy, yz, and zx planes. A projection is like a shadow, that maps our...
{ "language": "python", "source": "def check(candidate):\n assert candidate(grid = [[2, 2, 2], [2, 1, 2], [2, 2, 2]]) == 21\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 14\n assert candidate(grid = [[2]]) == 5\n assert candidate(grid = [[1, 2], [3, 4]]) == 17\n assert candidate(gri...
[ "[[1,2],[3,4]]", "[[2]]", "[[1,0],[0,2]]" ]
[]
{ "canonical_parameter_names": [ "grid" ], "leetcode_dataset_entry_point": "Solution().projectionArea", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:03", "tests_total": 72, "tests_d...
cpp
{ "raw_signature": "int projectionArea(vector<vector<int>>& grid) {", "container": "Solution", "callable": "projectionArea", "parameters": [ { "name": "grid", "type": "vector<vector<int>>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetco...
884
uncommon-words-from-two-sentences
Easy
A sentence is a string of single-space separated words where each word consists only of lowercase letters. A word is uncommon if it appears exactly once in one of the sentences, and does not appear in the other sentence. Given two sentences s1 and s2, return a list of all the uncommon words. You may return the answer...
{ "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 ...
[ "\"this apple is sweet\"\n\"this apple is sour\"", "\"apple apple\"\n\"banana\"" ]
[]
{ "canonical_parameter_names": [ "s1", "s2" ], "leetcode_dataset_entry_point": "Solution().uncommonFromSentences", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:05", "tests_total":...
cpp
{ "raw_signature": "vector<string> uncommonFromSentences(string s1, string s2) {", "container": "Solution", "callable": "uncommonFromSentences", "parameters": [ { "name": "s1", "type": "string" }, { "name": "s2", "type": "string" } ], "return_type": "vector<string>", ...
885
spiral-matrix-iii
Medium
You start at the cell (rStart, cStart) of an rows x cols grid facing east. The northwest corner is at the first row and column in the grid, and the southeast corner is at the last row and column. You will walk in a clockwise spiral shape to visit every position in this grid. Whenever you move outside the grid's bounda...
{ "language": "python", "source": "def check(candidate):\n assert candidate(rows = 5,cols = 6,rStart = 1,cStart = 4) == [[1, 4], [1, 5], [2, 5], [2, 4], [2, 3], [1, 3], [0, 3], [0, 4], [0, 5], [3, 5], [3, 4], [3, 3], [3, 2], [2, 2], [1, 2], [0, 2], [4, 5], [4, 4], [4, 3], [4, 2], [4, 1], [3, 1], [2, 1], [1, 1], ...
[ "1\n4\n0\n0", "5\n6\n1\n4" ]
[]
{ "canonical_parameter_names": [ "rows", "cols", "rStart", "cStart" ], "leetcode_dataset_entry_point": "Solution().spiralMatrixIII", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T2...
cpp
{ "raw_signature": "vector<vector<int>> spiralMatrixIII(int rows, int cols, int rStart, int cStart) {", "container": "Solution", "callable": "spiralMatrixIII", "parameters": [ { "name": "rows", "type": "int" }, { "name": "cols", "type": "int" }, { "name": "rStar...
886
possible-bipartition
Medium
We want to split a group of n people (labeled from 1 to n) into two groups of any size. Each person may dislike some other people, and they should not go into the same group. Given the integer n and the array dislikes where dislikes[i] = [a_i, b_i] indicates that the person labeled a_i does not like the person labeled...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 4,dislikes = [[1, 2], [1, 3], [2, 4]]) == True\n assert candidate(n = 5,dislikes = [[1, 2], [2, 3], [3, 4], [4, 5], [1, 5]]) == False\n assert candidate(n = 3,dislikes = [[1, 2]]) == True\n assert candidate(n = 3,dislikes = ...
[ "4\n[[1,2],[1,3],[2,4]]", "3\n[[1,2],[1,3],[2,3]]" ]
[]
{ "canonical_parameter_names": [ "n", "dislikes" ], "leetcode_dataset_entry_point": "Solution().possibleBipartition", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:09", "tests_tota...
cpp
{ "raw_signature": "bool possibleBipartition(int n, vector<vector<int>>& dislikes) {", "container": "Solution", "callable": "possibleBipartition", "parameters": [ { "name": "n", "type": "int" }, { "name": "dislikes", "type": "vector<vector<int>>&" } ], "return_type": ...
887
super-egg-drop
Hard
You are given k identical eggs and you have access to a building with n floors labeled from 1 to n. You know that there exists a floor f where 0 <= f <= n such that any egg dropped at a floor higher than f will break, and any egg dropped at or below floor f will not break. Each move, you may take an unbroken egg and ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(k = 2,n = 1) == 1\n assert candidate(k = 5,n = 1000) == 11\n assert candidate(k = 1,n = 100) == 100\n assert candidate(k = 1,n = 2) == 2\n assert candidate(k = 2,n = 6) == 3\n assert candidate(k = 50,n = 10000) == 14\n ...
[ "1\n2", "2\n6", "3\n14" ]
[]
{ "canonical_parameter_names": [ "k", "n" ], "leetcode_dataset_entry_point": "Solution().superEggDrop", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:12", "tests_total": 92, "tes...
cpp
{ "raw_signature": "int superEggDrop(int k, int n) {", "container": "Solution", "callable": "superEggDrop", "parameters": [ { "name": "k", "type": "int" }, { "name": "n", "type": "int" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_s...
888
fair-candy-swap
Easy
Alice and Bob have a different total number of candies. You are given two integer arrays aliceSizes and bobSizes where aliceSizes[i] is the number of candies of the i^th box of candy that Alice has and bobSizes[j] is the number of candies of the j^th box of candy that Bob has. Since they are friends, they would like t...
{ "language": "python", "source": "def check(candidate):\n assert candidate(aliceSizes = [3, 7],bobSizes = [1, 9]) == None\n assert candidate(aliceSizes = [10, 20, 30],bobSizes = [5, 15, 25]) == None\n assert candidate(aliceSizes = [1, 1],bobSizes = [2, 2]) == [1, 2]\n assert candidate(aliceSizes = [5, ...
[ "[1,1]\n[2,2]", "[1,2]\n[2,3]", "[2]\n[1,3]" ]
[]
{ "canonical_parameter_names": [ "aliceSizes", "bobSizes" ], "leetcode_dataset_entry_point": "Solution().fairCandySwap", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:14", "tests_t...
cpp
{ "raw_signature": "vector<int> fairCandySwap(vector<int>& aliceSizes, vector<int>& bobSizes) {", "container": "Solution", "callable": "fairCandySwap", "parameters": [ { "name": "aliceSizes", "type": "vector<int>&" }, { "name": "bobSizes", "type": "vector<int>&" } ], ...
890
find-and-replace-pattern
Medium
Given a list of strings words and a string pattern, return a list of words[i] that match pattern. You may return the answer in any order. A word matches the pattern if there exists a permutation of letters p so that after replacing every letter x in the pattern with p(x), we get the desired word. Recall that a permut...
{ "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 ...
[ "[\"abc\",\"deq\",\"mee\",\"aqq\",\"dkd\",\"ccc\"]\n\"abb\"", "[\"a\",\"b\",\"c\"]\n\"a\"" ]
[]
{ "canonical_parameter_names": [ "words", "pattern" ], "leetcode_dataset_entry_point": "Solution().findAndReplacePattern", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:18", "tests...
cpp
{ "raw_signature": "vector<string> findAndReplacePattern(vector<string>& words, string pattern) {", "container": "Solution", "callable": "findAndReplacePattern", "parameters": [ { "name": "words", "type": "vector<string>&" }, { "name": "pattern", "type": "string" } ], ...
891
sum-of-subsequence-widths
Hard
The width of a sequence is the difference between the maximum and minimum elements in the sequence. Given an array of integers nums, return the sum of the widths of all the non-empty subsequences of nums. Since the answer may be very large, return it modulo 10^9 + 7. A subsequence is a sequence that can be derived fr...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 20, 30]) == 60\n assert candidate(nums = [9, 7, 5, 3, 1]) == 144\n assert candidate(nums = [1, 2, 4, 8, 16]) == 261\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1]) == 3084\n assert candidate(nums = [1, 3, 5...
[ "[2,1,3]", "[2]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().sumSubseqWidths", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:21", "tests_total": 86, "tests_...
cpp
{ "raw_signature": "int sumSubseqWidths(vector<int>& nums) {", "container": "Solution", "callable": "sumSubseqWidths", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippet...
892
surface-area-of-3d-shapes
Easy
You are given an n x n grid where you have placed some 1 x 1 x 1 cubes. Each value v = grid[i][j] represents a tower of v cubes placed on top of cell (i, j). After placing these cubes, you have decided to glue any directly adjacent cubes to each other, forming several irregular 3D shapes. Return the total surface are...
{ "language": "python", "source": "def check(candidate):\n assert candidate(grid = [[3, 3, 3], [3, 3, 3], [3, 3, 3]]) == 54\n assert candidate(grid = [[2, 2, 2], [2, 1, 2], [2, 2, 2]]) == 46\n assert candidate(grid = [[1, 1, 1], [1, 0, 1], [1, 1, 1]]) == 32\n assert candidate(grid = [[50, 50, 50], [50, ...
[ "[[1,2],[3,4]]", "[[1,1,1],[1,0,1],[1,1,1]]", "[[2,2,2],[2,1,2],[2,2,2]]" ]
[]
{ "canonical_parameter_names": [ "grid" ], "leetcode_dataset_entry_point": "Solution().surfaceArea", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:23", "tests_total": 78, "tests_drop...
cpp
{ "raw_signature": "int surfaceArea(vector<vector<int>>& grid) {", "container": "Solution", "callable": "surfaceArea", "parameters": [ { "name": "grid", "type": "vector<vector<int>>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/cod...
893
groups-of-special-equivalent-strings
Medium
You are given an array of strings of the same length words. In one move, you can swap any two even indexed characters or any two odd indexed characters of a string words[i]. Two strings words[i] and words[j] are special-equivalent if after any number of moves, words[i] == words[j]. - For example, words[i] = "zzxy" a...
{ "language": "python", "source": "def check(candidate):\n assert candidate(words = ['abcd', 'abdc', 'cdab', 'cdba', 'dcba', 'bacd']) == 4\n assert candidate(words = ['abcd', 'abdc', 'cdab', 'cdba']) == 3\n assert candidate(words = ['abc', 'def', 'ghi', 'jkl', 'mno', 'pqr']) == 6\n assert candidate(word...
[ "[\"abcd\",\"cdab\",\"cbad\",\"xyzz\",\"zzxy\",\"zzyx\"]", "[\"abc\",\"acb\",\"bac\",\"bca\",\"cab\",\"cba\"]" ]
[]
{ "canonical_parameter_names": [ "words" ], "leetcode_dataset_entry_point": "Solution().numSpecialEquivGroups", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:25", "tests_total": 81, ...
cpp
{ "raw_signature": "int numSpecialEquivGroups(vector<string>& words) {", "container": "Solution", "callable": "numSpecialEquivGroups", "parameters": [ { "name": "words", "type": "vector<string>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "...
896
monotonic-array
Easy
An array is monotonic if it is either monotone increasing or monotone decreasing. An array nums is monotone increasing if for all i <= j, nums[i] <= nums[j]. An array nums is monotone decreasing if for all i <= j, nums[i] >= nums[j]. Given an integer array nums, return true if the given array is monotonic, or false o...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 2, 3]) == True\n assert candidate(nums = [1, 2, 4, 5]) == True\n assert candidate(nums = [-1, -2, -2, -3]) == True\n assert candidate(nums = [1, 1, 1, 1]) == True\n assert candidate(nums = [1, 1, 1]) == True\n ...
[ "[1,2,2,3]", "[6,5,4,4]", "[1,3,2]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().isMonotonic", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:27", "tests_total": 151, "tests_dro...
cpp
{ "raw_signature": "bool isMonotonic(vector<int>& nums) {", "container": "Solution", "callable": "isMonotonic", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "bool", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
898
bitwise-ors-of-subarrays
Medium
Given an integer array arr, return the number of distinct bitwise ORs of all the non-empty subarrays of arr. The bitwise OR of a subarray is the bitwise OR of each integer in the subarray. The bitwise OR of a subarray of one integer is that integer. A subarray is a contiguous non-empty sequence of elements within an ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [0, 1, 1, 3]) == 3\n assert candidate(arr = [2, 1, 0, 3, 2]) == 4\n assert candidate(arr = [5, 5, 5, 5, 5, 5]) == 1\n assert candidate(arr = [8, 16, 32]) == 6\n assert candidate(arr = [1, 1, 2]) == 3\n assert candida...
[ "[0]", "[1,1,2]", "[1,2,4]" ]
[ "Consider the the subarrays that end at index i. The number of unique bitwise OR for these subarrays is limited." ]
{ "canonical_parameter_names": [ "arr" ], "leetcode_dataset_entry_point": "Solution().subarrayBitwiseORs", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:32", "tests_total": 93, "test...
cpp
{ "raw_signature": "int subarrayBitwiseORs(vector<int>& arr) {", "container": "Solution", "callable": "subarrayBitwiseORs", "parameters": [ { "name": "arr", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSni...
899
orderly-queue
Hard
You are given a string s and an integer k. You can choose one of the first k letters of s and append it at the end of the string. Return the lexicographically smallest string you could have after applying the mentioned step any number of moves. Example 1: Input: s = "cba", k = 1 Output: "acb" Explanation: In the fir...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"aaab\",k = 1) == \"aaab\"\n assert candidate(s = \"aaa\",k = 3) == \"aaa\"\n assert candidate(s = \"zxy\",k = 3) == \"xyz\"\n assert candidate(s = \"zxy\",k = 1) == \"xyz\"\n assert candidate(s = \"ccccc\",k = 4) == \"c...
[ "\"cba\"\n1", "\"baaca\"\n3" ]
[]
{ "canonical_parameter_names": [ "s", "k" ], "leetcode_dataset_entry_point": "Solution().orderlyQueue", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:34", "tests_total": 118, "te...
cpp
{ "raw_signature": "string orderlyQueue(string s, int k) {", "container": "Solution", "callable": "orderlyQueue", "parameters": [ { "name": "s", "type": "string" }, { "name": "k", "type": "int" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets...
902
numbers-at-most-n-given-digit-set
Hard
Given an array of digits which is sorted in non-decreasing order. You can write numbers using each digits[i] as many times as we want. For example, if digits = ['1','3','5'], we may write numbers such as '13', '551', and '1351315'. Return the number of positive integers that can be generated that are less than or equa...
{ "language": "python", "source": "def check(candidate):\n assert candidate(digits = ['1', '4', '9'],n = 1000000000) == 29523\n assert candidate(digits = ['7'],n = 8) == 1\n assert candidate(digits = ['1', '2', '3'],n = 123) == 18\n assert candidate(digits = ['2', '3', '5'],n = 250) == 18\n assert ca...
[ "[\"1\",\"3\",\"5\",\"7\"]\n100", "[\"1\",\"4\",\"9\"]\n1000000000", "[\"7\"]\n8" ]
[]
{ "canonical_parameter_names": [ "digits", "n" ], "leetcode_dataset_entry_point": "Solution().atMostNGivenDigitSet", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:36", "tests_total...
cpp
{ "raw_signature": "int atMostNGivenDigitSet(vector<string>& digits, int n) {", "container": "Solution", "callable": "atMostNGivenDigitSet", "parameters": [ { "name": "digits", "type": "vector<string>&" }, { "name": "n", "type": "int" } ], "return_type": "int", "sig...
903
valid-permutations-for-di-sequence
Hard
You are given a string s of length n where s[i] is either: - 'D' means decreasing, or - 'I' means increasing. A permutation perm of n + 1 integers of all the integers in the range [0, n] is called a valid permutation if for all valid i: - If s[i] == 'D', then perm[i] > perm[i + 1], and - If s[i] == 'I', then perm[i]...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"DDDDDDDDDDDD\") == 1\n assert candidate(s = \"DII\") == 3\n assert candidate(s = \"IIDII\") == 19\n assert candidate(s = \"DIDDDDDD\") == 35\n assert candidate(s = \"IIIIIIIIIIII\") == 1\n assert candidate(s = \"DDI\...
[ "\"DID\"", "\"D\"" ]
[]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().numPermsDISequence", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:38", "tests_total": 247, "tests...
cpp
{ "raw_signature": "int numPermsDISequence(string s) {", "container": "Solution", "callable": "numPermsDISequence", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
904
fruit-into-baskets
Medium
You are visiting a farm that has a single row of fruit trees arranged from left to right. The trees are represented by an integer array fruits where fruits[i] is the type of fruit the i^th tree produces. You want to collect as much fruit as possible. However, the owner has some strict rules that you must follow: - Yo...
{ "language": "python", "source": "def check(candidate):\n assert candidate(fruits = [0]) == 1\n assert candidate(fruits = [1, 2, 3, 2, 2]) == 4\n assert candidate(fruits = [1, 0, 1, 4, 1, 4, 1, 2, 3]) == 5\n assert candidate(fruits = [0, 0, 1, 1]) == 4\n assert candidate(fruits = [1, 2, 2, 3, 3, 3, ...
[ "[1,2,1]", "[0,1,2,2]", "[1,2,3,2,2]" ]
[]
{ "canonical_parameter_names": [ "fruits" ], "leetcode_dataset_entry_point": "Solution().totalFruit", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:40", "tests_total": 98, "tests_dro...
cpp
{ "raw_signature": "int totalFruit(vector<int>& fruits) {", "container": "Solution", "callable": "totalFruit", "parameters": [ { "name": "fruits", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
905
sort-array-by-parity
Easy
Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array that satisfies this condition. Example 1: Input: nums = [3,1,2,4] Output: [2,4,3,1] Explanation: The outputs [4,2,3,1], [2,4,1,3], and [4,2,1,3] would also be accepted. Example 2:...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]) == [0, 8, 6, 4, 2, 9, 7, 5, 3, 1]\n assert candidate(nums = [5, 3, 2, 8, 6, 7, 1, 4]) == [4, 6, 2, 8, 3, 7, 1, 5]\n assert candidate(nums = [2, 1]) == [2, 1]\n assert candidate(nums = [2, 4...
[ "[3,1,2,4]", "[0]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().sortArrayByParity", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:42", "tests_total": 98, "test...
cpp
{ "raw_signature": "vector<int> sortArrayByParity(vector<int>& nums) {", "container": "Solution", "callable": "sortArrayByParity", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "vector<int>", "signature_source": "leetcode/codeSnippets", "type_source": "...
906
super-palindromes
Hard
Let's say a positive integer is a super-palindrome if it is a palindrome, and it is also the square of a palindrome. Given two positive integers left and right represented as strings, return the number of super-palindromes integers in the inclusive range [left, right]. Example 1: Input: left = "4", right = "1000" Ou...
{ "language": "python", "source": "def check(candidate):\n assert candidate(left = \"123\",right = \"456\") == 0\n assert candidate(left = \"50\",right = \"10000\") == 2\n assert candidate(left = \"4\",right = \"1000\") == 4\n assert candidate(left = \"1\",right = \"2\") == 1\n assert candidate(left ...
[ "\"4\"\n\"1000\"", "\"1\"\n\"2\"" ]
[]
{ "canonical_parameter_names": [ "left", "right" ], "leetcode_dataset_entry_point": "Solution().superpalindromesInRange", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:45", "tests_...
cpp
{ "raw_signature": "int superpalindromesInRange(string left, string right) {", "container": "Solution", "callable": "superpalindromesInRange", "parameters": [ { "name": "left", "type": "string" }, { "name": "right", "type": "string" } ], "return_type": "int", "signa...
907
sum-of-subarray-minimums
Medium
Given an array of integers arr, find the sum of min(b), where b ranges over every (contiguous) subarray of arr. Since the answer may be large, return the answer modulo 10^9 + 7. Example 1: Input: arr = [3,1,2,4] Output: 17 Explanation: Subarrays are [3], [1], [2], [4], [3,1], [1,2], [2,4], [3,1,2], [1,2,4], [3,1,2,4]...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [5, 4, 3, 2, 1]) == 35\n assert candidate(arr = [1, 3, 2, 4, 5, 7, 6, 8, 9]) == 157\n assert candidate(arr = [9, 7, 5, 3, 1]) == 55\n assert candidate(arr = [10, 20, 30, 40, 50]) == 350\n assert candidate(arr = [1, 2, 2...
[ "[3,1,2,4]", "[50]" ]
[]
{ "canonical_parameter_names": [ "arr" ], "leetcode_dataset_entry_point": "Solution().sumSubarrayMins", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:47", "tests_total": 93, "tests_d...
cpp
{ "raw_signature": "int sumSubarrayMins(vector<int>& arr) {", "container": "Solution", "callable": "sumSubarrayMins", "parameters": [ { "name": "arr", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"...
908
smallest-range-i
Easy
You are given an integer array nums and an integer k. In one operation, you can choose any index i where 0 <= i < nums.length and change nums[i] to nums[i] + x where x is an integer from the range [-k, k]. You can apply this operation at most once for each index i. The score of nums is the difference between the maxi...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [100, 200, 300, 400],k = 100) == 100\n assert candidate(nums = [100, 4, 200, 1, 3, 2],k = 3) == 193\n assert candidate(nums = [1, 10000],k = 10000) == 0\n assert candidate(nums = [5, 5, 5, 5],k = 1) == 0\n assert candi...
[ "[1]\n0", "[0,10]\n2", "[1,3,6]\n3" ]
[]
{ "canonical_parameter_names": [ "nums", "k" ], "leetcode_dataset_entry_point": "Solution().smallestRangeI", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:49", "tests_total": 126, ...
cpp
{ "raw_signature": "int smallestRangeI(vector<int>& nums, int k) {", "container": "Solution", "callable": "smallestRangeI", "parameters": [ { "name": "nums", "type": "vector<int>&" }, { "name": "k", "type": "int" } ], "return_type": "int", "signature_source": "leetc...
909
snakes-and-ladders
Medium
You are given an n x n integer matrix board where the cells are labeled from 1 to n^2 in a Boustrophedon style starting from the bottom left of the board (i.e. board[n - 1][0]) and alternating direction each row. You start on square 1 of the board. In each move, starting from square curr, do the following: - Choose a...
{ "language": "python", "source": "def check(candidate):\n assert candidate(board = [[-1, -1], [-1, 3]]) == 1\n assert candidate(board = [[-1, 2, 15, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, 34, 3, -1, -1, -1], [-1, -1, -1, -1, -1, -1], [-1, 15, -1, -1, -1, -1]]) == 4\n assert ...
[ "[[-1,-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1,-1],[-1,35,-1,-1,13,-1],[-1,-1,-1,-1,-1,-1],[-1,15,-1,-1,-1,-1]]", "[[-1,-1],[-1,3]]" ]
[]
{ "canonical_parameter_names": [ "board" ], "leetcode_dataset_entry_point": "Solution().snakesAndLadders", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:51", "tests_total": 72, "test...
cpp
{ "raw_signature": "int snakesAndLadders(vector<vector<int>>& board) {", "container": "Solution", "callable": "snakesAndLadders", "parameters": [ { "name": "board", "type": "vector<vector<int>>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "...
910
smallest-range-ii
Medium
You are given an integer array nums and an integer k. For each index i where 0 <= i < nums.length, change nums[i] to be either nums[i] + k or nums[i] - k. The score of nums is the difference between the maximum and minimum elements in nums. Return the minimum score of nums after changing the values at each index. E...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [0, 10],k = 2) == 6\n assert candidate(nums = [1, 5, 8],k = 2) == 3\n assert candidate(nums = [6, 3, 4, 7],k = 3) == 4\n assert candidate(nums = [6, 3, 2, 18, 9, 12, 3, 6, 5, 0],k = 6) == 9\n assert candidate(nums = [4...
[ "[1]\n0", "[0,10]\n2", "[1,3,6]\n3" ]
[]
{ "canonical_parameter_names": [ "nums", "k" ], "leetcode_dataset_entry_point": "Solution().smallestRangeII", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:54", "tests_total": 107,...
cpp
{ "raw_signature": "int smallestRangeII(vector<int>& nums, int k) {", "container": "Solution", "callable": "smallestRangeII", "parameters": [ { "name": "nums", "type": "vector<int>&" }, { "name": "k", "type": "int" } ], "return_type": "int", "signature_source": "lee...
913
cat-and-mouse
Hard
A game on an undirected graph is played by two players, Mouse and Cat, who alternate turns. The graph is given as follows: graph[a] is a list of all nodes b such that ab is an edge of the graph. The mouse starts at node 1 and goes first, the cat starts at node 2 and goes second, and there is a hole at node 0. During...
{ "language": "python", "source": "def check(candidate):\n assert candidate(graph = [[3, 4], [3, 5], [3], [0, 1, 2], [0], [1]]) == 2\n assert candidate(graph = [[2, 3, 4], [3, 4], [0, 3, 4], [0, 1, 2], [0, 1, 2]]) == 2\n assert candidate(graph = [[6], [4], [9, 6], [5, 6, 7, 9], [1, 5], [3, 4], [0, 2, 3, 7]...
[ "[[2,5],[3],[0,4,5],[1,4,5],[2,3],[0,2,3]]", "[[1,3],[0],[3],[0,2]]" ]
[]
{ "canonical_parameter_names": [ "graph" ], "leetcode_dataset_entry_point": "Solution().catMouseGame", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:03:58", "tests_total": 63, "tests_dr...
cpp
{ "raw_signature": "int catMouseGame(vector<vector<int>>& graph) {", "container": "Solution", "callable": "catMouseGame", "parameters": [ { "name": "graph", "type": "vector<vector<int>>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode...
914
x-of-a-kind-in-a-deck-of-cards
Easy
You are given an integer array deck where deck[i] represents the number written on the i^th card. Partition the cards into one or more groups such that: - Each group has exactly x cards where x > 1, and - All the cards in one group have the same integer written on them. Return true if such partition is possible, or ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(deck = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == True\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 2, 2]) == True\n assert candidate(deck = [1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3]) == True\n assert candidate(deck = [1, 1, 2, 2...
[ "[1,2,3,4,4,3,2,1]", "[1,1,1,2,2,2,3,3]" ]
[]
{ "canonical_parameter_names": [ "deck" ], "leetcode_dataset_entry_point": "Solution().hasGroupsSizeX", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:00", "tests_total": 113, "tests_...
cpp
{ "raw_signature": "bool hasGroupsSizeX(vector<int>& deck) {", "container": "Solution", "callable": "hasGroupsSizeX", "parameters": [ { "name": "deck", "type": "vector<int>&" } ], "return_type": "bool", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippet...
915
partition-array-into-disjoint-intervals
Medium
Given an integer array nums, partition it into two (contiguous) subarrays left and right so that: - Every element in left is less than or equal to every element in right. - left and right are non-empty. - left has the smallest possible size. Return the length of left after such a partitioning. Test cases are generat...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 2, 4, 5]) == 1\n assert candidate(nums = [1, 2, 3, 0, 4, 5, 6, 7, 8, 9]) == 4\n assert candidate(nums = [1, 2, 1, 2, 1, 2, 1, 2]) == 1\n assert candidate(nums = [1, 1, 1, 0, 6, 12]) == 4\n assert candidate(nums ...
[ "[5,0,3,8,6]", "[1,1,1,0,6,12]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().partitionDisjoint", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:02", "tests_total": 95, "test...
cpp
{ "raw_signature": "int partitionDisjoint(vector<int>& nums) {", "container": "Solution", "callable": "partitionDisjoint", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSni...
916
word-subsets
Medium
You are given two string arrays words1 and words2. A string b is a subset of string a if every letter in b occurs in a including multiplicity. - For example, "wrr" is a subset of "warrior" but is not a subset of "world". A string a from words1 is universal if for every string b in words2, b is a subset of a. Return...
{ "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 ...
[ "[\"amazon\",\"apple\",\"facebook\",\"google\",\"leetcode\"]\n[\"e\",\"o\"]", "[\"amazon\",\"apple\",\"facebook\",\"google\",\"leetcode\"]\n[\"lc\",\"eo\"]", "[\"acaac\",\"cccbb\",\"aacbb\",\"caacc\",\"bcbbb\"]\n[\"c\",\"cc\",\"b\"]" ]
[]
{ "canonical_parameter_names": [ "words1", "words2" ], "leetcode_dataset_entry_point": "Solution().wordSubsets", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:04", "tests_total": 6...
cpp
{ "raw_signature": "vector<string> wordSubsets(vector<string>& words1, vector<string>& words2) {", "container": "Solution", "callable": "wordSubsets", "parameters": [ { "name": "words1", "type": "vector<string>&" }, { "name": "words2", "type": "vector<string>&" } ], "...
917
reverse-only-letters
Easy
Given a string s, reverse the string according to the following rules: - All the characters that are not English letters remain in the same position. - All the English letters (lowercase or uppercase) should be reversed. Return s after reversing it. Example 1: Input: s = "ab-cd" Output: "dc-ba" Example 2: Input: ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"s-123-p\") == \"p-123-s\"\n assert candidate(s = \"Test1ng-Leet=code-Q!\") == \"Qedo1ct-eeLg=ntse-T!\"\n assert candidate(s = \"-a-b-\") == \"-b-a-\"\n assert candidate(s = \"a-bC-dEf-ghIj\") == \"j-Ih-gfE-dCba\"\n asse...
[ "\"ab-cd\"", "\"a-bC-dEf-ghIj\"", "\"Test1ng-Leet=code-Q!\"" ]
[ "This problem is exactly like reversing a normal string except that there are certain characters that we have to simply skip. That should be easy enough to do if you know how to reverse a string using the two-pointer approach." ]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().reverseOnlyLetters", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:07", "tests_total": 98, "tests_...
cpp
{ "raw_signature": "string reverseOnlyLetters(string s) {", "container": "Solution", "callable": "reverseOnlyLetters", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
918
maximum-sum-circular-subarray
Medium
Given a circular integer array nums of length n, return the maximum possible sum of a non-empty subarray of nums. A circular array means the end of the array connects to the beginning of the array. Formally, the next element of nums[i] is nums[(i + 1) % n] and the previous element of nums[i] is nums[(i - 1 + n) % n]. ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, -2, 3, -2]) == 3\n assert candidate(nums = [10, -2, 5, 1, -4, 3, -1]) == 16\n assert candidate(nums = [2, 3, -4, 5, 7]) == 17\n assert candidate(nums = [5, -3, 5]) == 10\n assert candidate(nums = [3, -1, 2, -1]) ==...
[ "[1,-2,3,-2]", "[5,-3,5]", "[-3,-2,-3]" ]
[ "For those of you who are familiar with the Kadane's algorithm, think in terms of that. For the newbies, Kadane's algorithm is used to finding the maximum sum subarray from a given array. This problem is a twist on that idea and it is advisable to read up on that algorithm first before starting this problem. Unless...
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().maxSubarraySumCircular", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:09", "tests_total": 117, ...
cpp
{ "raw_signature": "int maxSubarraySumCircular(vector<int>& nums) {", "container": "Solution", "callable": "maxSubarraySumCircular", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetco...
920
number-of-music-playlists
Hard
Your music player contains n different songs. You want to listen to goal songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that: - Every song is played at least once. - A song can only be played again only if k other songs have been played. Given n, goal, and k, retur...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 5,goal = 5,k = 2) == 120\n assert candidate(n = 3,goal = 4,k = 1) == 18\n assert candidate(n = 4,goal = 6,k = 2) == 168\n assert candidate(n = 3,goal = 3,k = 1) == 6\n assert candidate(n = 2,goal = 3,k = 1) == 2\n asse...
[ "3\n3\n1", "2\n3\n0", "2\n3\n1" ]
[]
{ "canonical_parameter_names": [ "n", "goal", "k" ], "leetcode_dataset_entry_point": "Solution().numMusicPlaylists", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:11", "tests_t...
cpp
{ "raw_signature": "int numMusicPlaylists(int n, int goal, int k) {", "container": "Solution", "callable": "numMusicPlaylists", "parameters": [ { "name": "n", "type": "int" }, { "name": "goal", "type": "int" }, { "name": "k", "type": "int" } ], "re...
921
minimum-add-to-make-parentheses-valid
Medium
A parentheses string is valid if and only if: - It is the empty string, - It can be written as AB (A concatenated with B), where A and B are valid strings, or - It can be written as (A), where A is a valid string. You are given a parentheses string s. In one move, you can insert a parenthesis at any position of the s...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"(()))\") == 1\n assert candidate(s = \"())\") == 1\n assert candidate(s = \"()\") == 0\n assert candidate(s = \"((((((()))\") == 4\n assert candidate(s = \"())(()\") == 2\n assert candidate(s = \"((()))\") == 0\n ...
[ "\"())\"", "\"(((\"" ]
[]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().minAddToMakeValid", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:13", "tests_total": 115, "tests_...
cpp
{ "raw_signature": "int minAddToMakeValid(string s) {", "container": "Solution", "callable": "minAddToMakeValid", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
922
sort-array-by-parity-ii
Easy
Given an array of integers nums, half of the integers in nums are odd, and the other half are even. Sort the array so that whenever nums[i] is odd, i is odd, and whenever nums[i] is even, i is even. Return any answer array that satisfies this condition. Example 1: Input: nums = [4,2,5,7] Output: [4,5,2,7] Explanati...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 3, 6, 7]) == [2, 3, 6, 7]\n assert candidate(nums = [2, 3]) == [2, 3]\n assert candidate(nums = [0, 1, 2, 3, 4, 5, 6, 7]) == [0, 1, 2, 3, 4, 5, 6, 7]\n assert candidate(nums = [8, 11, 6, 9, 5, 10, 7, 2]) == [8, 11, 6,...
[ "[4,2,5,7]", "[2,3]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().sortArrayByParityII", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:15", "tests_total": 81, "te...
cpp
{ "raw_signature": "vector<int> sortArrayByParityII(vector<int>& nums) {", "container": "Solution", "callable": "sortArrayByParityII", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "vector<int>", "signature_source": "leetcode/codeSnippets", "type_source...
923
3sum-with-multiplicity
Medium
Given an integer array arr, and an integer target, return the number of tuples i, j, k such that i < j < k and arr[i] + arr[j] + arr[k] == target. As the answer can be very large, return it modulo 10^9 + 7. Example 1: Input: arr = [1,1,2,2,3,3,4,4,5,5], target = 8 Output: 20 Explanation: Enumerating by the values (a...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],target = 18) == 11\n assert candidate(arr = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5],target = 10) == 74\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9],target = 15) == 8\n asser...
[ "[1,1,2,2,3,3,4,4,5,5]\n8", "[1,1,2,2,2,2]\n5", "[2,1,3]\n6" ]
[]
{ "canonical_parameter_names": [ "arr", "target" ], "leetcode_dataset_entry_point": "Solution().threeSumMulti", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:18", "tests_total": 87...
cpp
{ "raw_signature": "int threeSumMulti(vector<int>& arr, int target) {", "container": "Solution", "callable": "threeSumMulti", "parameters": [ { "name": "arr", "type": "vector<int>&" }, { "name": "target", "type": "int" } ], "return_type": "int", "signature_source": ...
924
minimize-malware-spread
Hard
You are given a network of n nodes represented as an n x n adjacency matrix graph, where the i^th node is directly connected to the j^th node if graph[i][j] == 1. Some nodes initial are initially infected by malware. Whenever two nodes are directly connected, and at least one of those two nodes is infected by malware,...
{ "language": "python", "source": "def check(candidate):\n assert candidate(graph = [[1, 1, 1, 1], [1, 1, 0, 0], [1, 0, 1, 1], [1, 0, 1, 1]],initial = [0, 1, 2, 3]) == 0\n assert candidate(graph = [[1, 1, 0, 0], [1, 1, 1, 0], [0, 1, 1, 1], [0, 0, 1, 1]],initial = [0, 1]) == 0\n assert candidate(graph = [[1...
[ "[[1,1,0],[1,1,0],[0,0,1]]\n[0,1]", "[[1,0,0],[0,1,0],[0,0,1]]\n[0,2]", "[[1,1,1],[1,1,1],[1,1,1]]\n[1,2]" ]
[]
{ "canonical_parameter_names": [ "graph", "initial" ], "leetcode_dataset_entry_point": "Solution().minMalwareSpread", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:20", "tests_tota...
cpp
{ "raw_signature": "int minMalwareSpread(vector<vector<int>>& graph, vector<int>& initial) {", "container": "Solution", "callable": "minMalwareSpread", "parameters": [ { "name": "graph", "type": "vector<vector<int>>&" }, { "name": "initial", "type": "vector<int>&" } ], ...
925
long-pressed-name
Easy
Your friend is typing his name into a keyboard. Sometimes, when typing a character c, the key might get long pressed, and the character will be typed 1 or more times. You examine the typed characters of the keyboard. Return True if it is possible that it was your friends name, with some characters (possibly none) bein...
{ "language": "python", "source": "def check(candidate):\n assert candidate(name = \"zzzzzzzz\",typed = \"zzzzzzzz\") == True\n assert candidate(name = \"abcd\",typed = \"abcde\") == False\n assert candidate(name = \"test\",typed = \"ttest\") == True\n assert candidate(name = \"dfuyalc\",typed = \"fuuya...
[ "\"alex\"\n\"aaleex\"", "\"saeed\"\n\"ssaaedd\"" ]
[]
{ "canonical_parameter_names": [ "name", "typed" ], "leetcode_dataset_entry_point": "Solution().isLongPressedName", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:22", "tests_total"...
cpp
{ "raw_signature": "bool isLongPressedName(string name, string typed) {", "container": "Solution", "callable": "isLongPressedName", "parameters": [ { "name": "name", "type": "string" }, { "name": "typed", "type": "string" } ], "return_type": "bool", "signature_sourc...
926
flip-string-to-monotone-increasing
Medium
A binary string is monotone increasing if it consists of some number of 0's (possibly none), followed by some number of 1's (also possibly none). You are given a binary string s. You can flip s[i] changing it from 0 to 1 or from 1 to 0. Return the minimum number of flips to make s monotone increasing. Example 1: In...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"1100110\") == 3\n assert candidate(s = \"1111000011110000\") == 8\n assert candidate(s = \"101010101\") == 4\n assert candidate(s = \"111000111000\") == 6\n assert candidate(s = \"000100110\") == 2\n assert candidate...
[ "\"00110\"", "\"010110\"", "\"00011000\"" ]
[]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().minFlipsMonoIncr", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:24", "tests_total": 143, "tests_d...
cpp
{ "raw_signature": "int minFlipsMonoIncr(string s) {", "container": "Solution", "callable": "minFlipsMonoIncr", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
927
three-equal-parts
Hard
You are given an array arr which consists of only zeros and ones, divide the array into three non-empty parts such that all of these parts represent the same binary value. If it is possible, return any [i, j] with i + 1 < j, such that: - arr[0], arr[1], ..., arr[i] is the first part, - arr[i + 1], arr[i + 2], ..., ar...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 0, 1, 0, 1]) == [0, 3]\n assert candidate(arr = [0, 0, 0]) == [0, 2]\n assert candidate(arr = [1, 1, 0, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, 1, 1, 0, 0, 1, 1, 1]) == [-1, -1]\n assert candidate(arr = [1, ...
[ "[1,0,1,0,1]", "[1,1,0,1,1]", "[1,1,0,0,1]" ]
[]
{ "canonical_parameter_names": [ "arr" ], "leetcode_dataset_entry_point": "Solution().threeEqualParts", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:26", "tests_total": 99, "tests_d...
cpp
{ "raw_signature": "vector<int> threeEqualParts(vector<int>& arr) {", "container": "Solution", "callable": "threeEqualParts", "parameters": [ { "name": "arr", "type": "vector<int>&" } ], "return_type": "vector<int>", "signature_source": "leetcode/codeSnippets", "type_source": "leetco...
928
minimize-malware-spread-ii
Hard
You are given a network of n nodes represented as an n x n adjacency matrix graph, where the i^th node is directly connected to the j^th node if graph[i][j] == 1. Some nodes initial are initially infected by malware. Whenever two nodes are directly connected, and at least one of those two nodes is infected by malware,...
{ "language": "python", "source": "def check(candidate):\n assert candidate(graph = [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 1, 0], [0, 0, 1, 1, 1], [0, 0, 0, 1, 1]],initial = [3, 4]) == 3\n assert candidate(graph = [[1, 1, 0, 0], [1, 1, 1, 0], [0, 1, 1, 1], [0, 0, 1, 1]],initial = [0, 1]) == 1\n asser...
[ "[[1,1,0],[1,1,0],[0,0,1]]\n[0,1]", "[[1,1,0],[1,1,1],[0,1,1]]\n[0,1]", "[[1,1,0,0],[1,1,1,0],[0,1,1,1],[0,0,1,1]]\n[0,1]" ]
[]
{ "canonical_parameter_names": [ "graph", "initial" ], "leetcode_dataset_entry_point": "Solution().minMalwareSpread", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:29", "tests_tota...
cpp
{ "raw_signature": "int minMalwareSpread(vector<vector<int>>& graph, vector<int>& initial) {", "container": "Solution", "callable": "minMalwareSpread", "parameters": [ { "name": "graph", "type": "vector<vector<int>>&" }, { "name": "initial", "type": "vector<int>&" } ], ...
929
unique-email-addresses
Easy
Every valid email consists of a local name and a domain name, separated by the '@' sign. Besides lowercase letters, the email may contain one or more '.' or '+'. - For example, in "alice@leetcode.com", "alice" is the local name, and "leetcode.com" is the domain name. If you add periods '.' between some characters in ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(emails = ['user.name+foo@hostname.com', 'user.name+bar@hostname.com', 'user.name@hostname.com']) == 1\n assert candidate(emails = ['m.y+name@email.com', 'my.name@email.com', 'myname@email.com']) == 2\n assert candidate(emails = ['m...
[ "[\"test.email+alex@leetcode.com\",\"test.e.mail+bob.cathy@leetcode.com\",\"testemail+david@lee.tcode.com\"]", "[\"a@leetcode.com\",\"b@leetcode.com\",\"c@leetcode.com\"]" ]
[]
{ "canonical_parameter_names": [ "emails" ], "leetcode_dataset_entry_point": "Solution().numUniqueEmails", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:31", "tests_total": 104, "tes...
cpp
{ "raw_signature": "int numUniqueEmails(vector<string>& emails) {", "container": "Solution", "callable": "numUniqueEmails", "parameters": [ { "name": "emails", "type": "vector<string>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/c...
930
binary-subarrays-with-sum
Medium
Given a binary array nums and an integer goal, return the number of non-empty subarrays with a sum goal. A subarray is a contiguous part of the array. Example 1: Input: nums = [1,0,1,0,1], goal = 2 Output: 4 Explanation: The 4 subarrays are bolded and underlined below: [1,0,1,0,1] [1,0,1,0,1] [1,0,1,0,1] [1,0,1,0,1]...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 0, 1, 1, 0],goal = 1) == 6\n assert candidate(nums = [1, 0, 1, 0, 1, 0, 1],goal = 2) == 8\n assert candidate(nums = [0, 0, 0, 0, 0],goal = 0) == 15\n assert candidate(nums = [1, 0, 1, 0, 1],goal = 2) == 4\n assert ...
[ "[1,0,1,0,1]\n2", "[0,0,0,0,0]\n0" ]
[ "Can you transform the problem into finding two prefix sums whose difference equals goal?", "While iterating through the array, keep track of how many times each prefix sum has appeared so far.", "If the current prefix sum is curr, how many previous prefix sums equal to curr - goal exist?" ]
{ "canonical_parameter_names": [ "nums", "goal" ], "leetcode_dataset_entry_point": "Solution().numSubarraysWithSum", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:33", "tests_total...
cpp
{ "raw_signature": "int numSubarraysWithSum(vector<int>& nums, int goal) {", "container": "Solution", "callable": "numSubarraysWithSum", "parameters": [ { "name": "nums", "type": "vector<int>&" }, { "name": "goal", "type": "int" } ], "return_type": "int", "signature...
931
minimum-falling-path-sum
Medium
Given an n x n array of integers matrix, return the minimum sum of any falling path through matrix. A falling path starts at any element in the first row and chooses the element in the next row that is either directly below or diagonally left/right. Specifically, the next element from position (row, col) will be (row ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(matrix = [[100, -100, 100], [-100, 100, -100], [100, -100, 100]]) == -300\n assert candidate(matrix = [[-1, -2, -3], [-4, -5, -6], [-7, -8, -9]]) == -18\n assert candidate(matrix = [[-19, 57], [-40, -5]]) == -59\n assert candida...
[ "[[2,1,3],[6,5,4],[7,8,9]]", "[[-19,57],[-40,-5]]" ]
[]
{ "canonical_parameter_names": [ "matrix" ], "leetcode_dataset_entry_point": "Solution().minFallingPathSum", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:35", "tests_total": 79, "te...
cpp
{ "raw_signature": "int minFallingPathSum(vector<vector<int>>& matrix) {", "container": "Solution", "callable": "minFallingPathSum", "parameters": [ { "name": "matrix", "type": "vector<vector<int>>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source...
932
beautiful-array
Medium
An array nums of length n is beautiful if: - nums is a permutation of the integers in the range [1, n]. - For every 0 <= i < j < n, there is no index k with i < k < j where 2 * nums[k] == nums[i] + nums[j]. Given the integer n, return any beautiful array nums of length n. There will be at least one valid answer for t...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 11) == [1, 9, 5, 3, 11, 7, 2, 10, 6, 4, 8]\n assert candidate(n = 15) == [1, 9, 5, 13, 3, 11, 7, 15, 2, 10, 6, 14, 4, 12, 8]\n assert candidate(n = 4) == [1, 3, 2, 4]\n assert candidate(n = 64) == [1, 33, 17, 49, 9, 41, 25, ...
[ "4", "5" ]
[]
{ "canonical_parameter_names": [ "n" ], "leetcode_dataset_entry_point": "Solution().beautifulArray", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:37", "tests_total": 58, "tests_drop...
cpp
{ "raw_signature": "vector<int> beautifulArray(int n) {", "container": "Solution", "callable": "beautifulArray", "parameters": [ { "name": "n", "type": "int" } ], "return_type": "vector<int>", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
934
shortest-bridge
Medium
You are given an n x n binary matrix grid where 1 represents land and 0 represents water. An island is a 4-directionally connected group of 1's not connected to any other 1's. There are exactly two islands in grid. You may change 0's to 1's to connect the two islands to form one island. Return the smallest number of...
{ "language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 1], [1, 0]]) == 1\n assert candidate(grid = [[0, 1, 0], [0, 0, 0], [0, 0, 1]]) == 2\n assert candidate(grid = [[0, 0, 0, 1, 1], [0, 0, 0, 1, 0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0], [1, 0, 0, 0, 0]]) == 1\n assert candi...
[ "[[0,1],[1,0]]", "[[0,1,0],[0,0,0],[0,0,1]]", "[[1,1,1,1,1],[1,0,0,0,1],[1,0,1,0,1],[1,0,0,0,1],[1,1,1,1,1]]" ]
[]
{ "canonical_parameter_names": [ "grid" ], "leetcode_dataset_entry_point": "Solution().shortestBridge", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:40", "tests_total": 52, "tests_d...
cpp
{ "raw_signature": "int shortestBridge(vector<vector<int>>& grid) {", "container": "Solution", "callable": "shortestBridge", "parameters": [ { "name": "grid", "type": "vector<vector<int>>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetco...
935
knight-dialer
Medium
The chess knight has a unique movement, it may move two squares vertically and one square horizontally, or two squares horizontally and one square vertically (with both forming the shape of an L). The possible movements of chess knight are shown in this diagram: A chess knight can move as indicated in the chess diagra...
{ "language": "python", "source": "def check(candidate):\n assert candidate(n = 3) == 46\n assert candidate(n = 100) == 540641702\n assert candidate(n = 50) == 267287516\n assert candidate(n = 2500) == 851996060\n assert candidate(n = 5000) == 406880451\n assert candidate(n = 2) == 20\n assert ...
[ "1", "2", "3131" ]
[]
{ "canonical_parameter_names": [ "n" ], "leetcode_dataset_entry_point": "Solution().knightDialer", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:42", "tests_total": 42, "tests_droppe...
cpp
{ "raw_signature": "int knightDialer(int n) {", "container": "Solution", "callable": "knightDialer", "parameters": [ { "name": "n", "type": "int" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
936
stamping-the-sequence
Hard
You are given two strings stamp and target. Initially, there is a string s of length target.length with all s[i] == '?'. In one turn, you can place stamp over s and replace every letter in the s with the corresponding letter from stamp. - For example, if stamp = "abc" and target = "abcba", then s is "?????" initially...
{ "language": "python", "source": "def check(candidate):\n assert candidate(stamp = \"world\",target = \"worldworldworld\") == [9, 8, 7, 6, 4, 3, 2, 1, 10, 5, 0]\n assert candidate(stamp = \"abc\",target = \"abcababcbcababc\") == [11, 9, 8, 6, 4, 2, 1, 10, 7, 3, 12, 5, 0]\n assert candidate(stamp = \"abcde...
[ "\"abc\"\n\"ababc\"", "\"abca\"\n\"aabcaca\"" ]
[]
{ "canonical_parameter_names": [ "stamp", "target" ], "leetcode_dataset_entry_point": "Solution().movesToStamp", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:44", "tests_total": 8...
cpp
{ "raw_signature": "vector<int> movesToStamp(string stamp, string target) {", "container": "Solution", "callable": "movesToStamp", "parameters": [ { "name": "stamp", "type": "string" }, { "name": "target", "type": "string" } ], "return_type": "vector<int>", "signatu...
937
reorder-data-in-log-files
Medium
You are given an array of logs. Each log is a space-delimited string of words, where the first word is the identifier. There are two types of logs: - Letter-logs: All words (except the identifier) consist of lowercase English letters. - Digit-logs: All words (except the identifier) consist of digits. Reorder these l...
{ "language": "python", "source": "def check(candidate):\n assert candidate(logs = ['dig1 8 1 5 1', 'let1 art can', 'dig2 3 6', 'let2 own kit dig', 'let3 art zero']) == ['let1 art can', 'let3 art zero', 'let2 own kit dig', 'dig1 8 1 5 1', 'dig2 3 6']\n assert candidate(logs = ['a1 9 2 3 1', 'g1 act car', 'zo4...
[ "[\"0 pmz\", \"4 q j\", \"g 89\", \"t v p\", \"w ugr\"]", "[\"2 08\", \"f 09\", \"v wc\", \"o z c\", \"u 14\"]" ]
[]
{ "canonical_parameter_names": [ "logs" ], "leetcode_dataset_entry_point": "Solution().reorderLogFiles", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:46", "tests_total": 53, "tests_...
cpp
{ "raw_signature": "vector<string> reorderLogFiles(vector<string>& logs) {", "container": "Solution", "callable": "reorderLogFiles", "parameters": [ { "name": "logs", "type": "vector<string>&" } ], "return_type": "vector<string>", "signature_source": "leetcode/codeSnippets", "type_so...
939
minimum-area-rectangle
Medium
You are given an array of points in the X-Y plane points where points[i] = [x_i, y_i]. Return the minimum area of a rectangle formed from these points, with sides parallel to the X and Y axes. If there is not any such rectangle, return 0. Example 1: Input: points = [[1,1],[1,3],[3,1],[3,3],[2,2]] Output: 4 Example ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(points = [[0, 0], [0, 1], [1, 0], [1, 1], [2, 2], [2, 3]]) == 1\n assert candidate(points = [[1, 1], [1, 3], [3, 1], [3, 3], [4, 1], [4, 3]]) == 2\n assert candidate(points = [[1, 1], [1, 3], [3, 1], [3, 3], [2, 2]]) == 4\n asse...
[ "[[1,1],[1,3],[3,1],[3,3],[2,2]]", "[[1,1],[1,3],[3,1],[3,3],[4,1],[4,3]]" ]
[]
{ "canonical_parameter_names": [ "points" ], "leetcode_dataset_entry_point": "Solution().minAreaRect", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:50", "tests_total": 81, "tests_dr...
cpp
{ "raw_signature": "int minAreaRect(vector<vector<int>>& points) {", "container": "Solution", "callable": "minAreaRect", "parameters": [ { "name": "points", "type": "vector<vector<int>>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode...
940
distinct-subsequences-ii
Hard
Given a string s, return the number of distinct non-empty subsequences of s. Since the answer may be very large, return it modulo 10^9 + 7. A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"abcdefghijklmnopqrstuvwxyz\") == 67108863\n assert candidate(s = \"abac\") == 13\n assert candidate(s = \"abababababababababab\") == 28655\n assert candidate(s = \"a\") == 1\n assert candidate(s = \"abracadabra\") == 13...
[ "\"abc\"", "\"aba\"", "\"aaa\"" ]
[]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().distinctSubseqII", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:53", "tests_total": 53, "tests_dr...
cpp
{ "raw_signature": "int distinctSubseqII(string s) {", "container": "Solution", "callable": "distinctSubseqII", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
941
valid-mountain-array
Easy
Given an array of integers arr, return true if and only if it is a valid mountain array. Recall that arr is a mountain array if and only if: - arr.length >= 3 - There exists some i with 0 < i < arr.length - 1 such that: - arr[0] < arr[1] < ... < arr[i - 1] < arr[i] - arr[i] > arr[i + 1] > ... > arr[arr.length - 1...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [5, 4, 3, 2, 1]) == False\n assert candidate(arr = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) == False\n assert candidate(arr = [3, 1, 2]) == False\n assert candidate(arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1]) == True...
[ "[2,1]", "[3,5,5]", "[0,3,2,1]" ]
[ "It's very easy to keep track of a monotonically increasing or decreasing ordering of elements. You just need to be able to determine the start of the valley in the mountain and from that point onwards, it should be a valley i.e. no mini-hills after that. Use this information in regards to the values in the array a...
{ "canonical_parameter_names": [ "arr" ], "leetcode_dataset_entry_point": "Solution().validMountainArray", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:55", "tests_total": 141, "tes...
cpp
{ "raw_signature": "bool validMountainArray(vector<int>& arr) {", "container": "Solution", "callable": "validMountainArray", "parameters": [ { "name": "arr", "type": "vector<int>&" } ], "return_type": "bool", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeS...
942
di-string-match
Easy
A permutation perm of n + 1 integers of all the integers in the range [0, n] can be represented as a string s of length n where: - s[i] == 'I' if perm[i] < perm[i + 1], and - s[i] == 'D' if perm[i] > perm[i + 1]. Given a string s, reconstruct the permutation perm and return it. If there are multiple valid permutation...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"DDI\") == [3, 2, 0, 1]\n assert candidate(s = \"DDIDDI\") == [6, 5, 0, 4, 3, 1, 2]\n assert candidate(s = \"IDDD\") == [0, 4, 3, 2, 1]\n assert candidate(s = \"DDDDDDDD\") == [8, 7, 6, 5, 4, 3, 2, 1, 0]\n assert candida...
[ "\"IDID\"", "\"III\"", "\"DDI\"" ]
[]
{ "canonical_parameter_names": [ "s" ], "leetcode_dataset_entry_point": "Solution().diStringMatch", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:57", "tests_total": 157, "tests_drop...
cpp
{ "raw_signature": "vector<int> diStringMatch(string s) {", "container": "Solution", "callable": "diStringMatch", "parameters": [ { "name": "s", "type": "string" } ], "return_type": "vector<int>", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
943
find-the-shortest-superstring
Hard
Given an array of strings words, return the smallest string that contains each string in words as a substring. If there are multiple valid strings of the smallest length, return any of them. You may assume that no string in words is a substring of another string in words. Example 1: Input: words = ["alex","loves","l...
{ "language": "python", "source": "def check(candidate):\n assert candidate(words = ['a', 'ab', 'abc']) == \"abc\"\n assert candidate(words = ['abcde', 'bcdef', 'cdefg']) == \"abcdefg\"\n assert candidate(words = ['a', 'b', 'c']) == \"abc\"\n assert candidate(words = ['shortest', 'superstring', 'string'...
[ "[\"alex\",\"loves\",\"leetcode\"]", "[\"catg\",\"ctaagt\",\"gcta\",\"ttca\",\"atgcatc\"]" ]
[]
{ "canonical_parameter_names": [ "words" ], "leetcode_dataset_entry_point": "Solution().shortestSuperstring", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:04:59", "tests_total": 96, "t...
cpp
{ "raw_signature": "string shortestSuperstring(vector<string>& words) {", "container": "Solution", "callable": "shortestSuperstring", "parameters": [ { "name": "words", "type": "vector<string>&" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source":...
944
delete-columns-to-make-sorted
Easy
You are given an array of n strings strs, all of the same length. The strings can be arranged such that there is one on each line, making a grid. - For example, strs = ["abc", "bce", "cae"] can be arranged as follows: abc bce cae You want to delete the columns that are not sorted lexicographically. In the above exa...
{ "language": "python", "source": "def check(candidate):\n assert candidate(strs = ['zaz', 'zbz', 'zcz']) == 0\n assert candidate(strs = ['a', 'b']) == 0\n assert candidate(strs = ['zzz', 'zzz', 'zzz']) == 0\n assert candidate(strs = ['xyz', 'yza', 'zab']) == 2\n assert candidate(strs = ['abc', 'bcd'...
[ "[\"cba\",\"daf\",\"ghi\"]", "[\"a\",\"b\"]", "[\"zyx\",\"wvu\",\"tsr\"]" ]
[]
{ "canonical_parameter_names": [ "strs" ], "leetcode_dataset_entry_point": "Solution().minDeletionSize", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:01", "tests_total": 99, "tests_...
cpp
{ "raw_signature": "int minDeletionSize(vector<string>& strs) {", "container": "Solution", "callable": "minDeletionSize", "parameters": [ { "name": "strs", "type": "vector<string>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeS...
945
minimum-increment-to-make-array-unique
Medium
You are given an integer array nums. In one move, you can pick an index i where 0 <= i < nums.length and increment nums[i] by 1. Return the minimum number of moves to make every value in nums unique. The test cases are generated so that the answer fits in a 32-bit integer. Example 1: Input: nums = [1,2,2] Output: 1...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 1, 2, 2, 3, 3, 4, 4]) == 16\n assert candidate(nums = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]) == 45\n assert candidate(nums = [5, 3, 5, 3, 5]) == 4\n assert candidate(nums = [1, 2, 2]) == 1\n assert candidate(num...
[ "[1,2,2]", "[3,2,1,2,1,7]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().minIncrementForUnique", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:04", "tests_total": 104, ...
cpp
{ "raw_signature": "int minIncrementForUnique(vector<int>& nums) {", "container": "Solution", "callable": "minIncrementForUnique", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode...
946
validate-stack-sequences
Medium
Given two integer arrays pushed and popped each with distinct values, return true if this could have been the result of a sequence of push and pop operations on an initially empty stack, or false otherwise. Example 1: Input: pushed = [1,2,3,4,5], popped = [4,5,3,2,1] Output: true Explanation: We might do the followin...
{ "language": "python", "source": "def check(candidate):\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [4, 5, 3, 2, 1]) == True\n assert candidate(pushed = [2, 1, 0],popped = [0, 1, 2]) == True\n assert candidate(pushed = [1, 2, 3, 4, 5],popped = [1, 3, 2, 5, 4]) == True\n assert candidate(pushed...
[ "[1,2,3,4,5]\n[4,5,3,2,1]", "[1,2,3,4,5]\n[4,3,5,1,2]" ]
[]
{ "canonical_parameter_names": [ "pushed", "popped" ], "leetcode_dataset_entry_point": "Solution().validateStackSequences", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:06", "test...
cpp
{ "raw_signature": "bool validateStackSequences(vector<int>& pushed, vector<int>& popped) {", "container": "Solution", "callable": "validateStackSequences", "parameters": [ { "name": "pushed", "type": "vector<int>&" }, { "name": "popped", "type": "vector<int>&" } ], "...
947
most-stones-removed-with-same-row-or-column
Medium
On a 2D plane, we place n stones at some integer coordinate points. Each coordinate point may have at most one stone. A stone can be removed if it shares either the same row or the same column as another stone that has not been removed. Given an array stones of length n where stones[i] = [x_i, y_i] represents the loc...
{ "language": "python", "source": "def check(candidate):\n assert candidate(stones = [[4, 8], [4, 4], [4, 4], [9, 2], [3, 8], [8, 0], [7, 5], [0, 8], [5, 7], [6, 9], [3, 0], [4, 7], [8, 5], [5, 9], [7, 4], [6, 0], [6, 4], [4, 2], [6, 3]]) == 18\n assert candidate(stones = [[0, 0], [0, 2], [1, 1], [2, 0], [2, ...
[ "[[0,0],[0,1],[1,0],[1,2],[2,1],[2,2]]", "[[0,0],[0,2],[1,1],[2,0],[2,2]]", "[[0,0]]" ]
[]
{ "canonical_parameter_names": [ "stones" ], "leetcode_dataset_entry_point": "Solution().removeStones", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:08", "tests_total": 100, "tests_...
cpp
{ "raw_signature": "int removeStones(vector<vector<int>>& stones) {", "container": "Solution", "callable": "removeStones", "parameters": [ { "name": "stones", "type": "vector<vector<int>>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetco...
948
bag-of-tokens
Medium
You start with an initial power of power, an initial score of 0, and a bag of tokens given as an integer array tokens, where each tokens[i] denotes the value of token_i. Your goal is to maximize the total score by strategically playing these tokens. In one move, you can play an unplayed token in one of the two ways (b...
{ "language": "python", "source": "def check(candidate):\n assert candidate(tokens = [100, 200, 300, 400],power = 200) == 2\n assert candidate(tokens = [100, 200, 300, 400],power = 100) == 1\n assert candidate(tokens = [71, 55, 82],power = 54) == 0\n assert candidate(tokens = [100, 200, 300, 400],power ...
[ "[100]\n50", "[200,100]\n150", "[100,200,300,400]\n200" ]
[]
{ "canonical_parameter_names": [ "tokens", "power" ], "leetcode_dataset_entry_point": "Solution().bagOfTokensScore", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:10", "tests_total...
cpp
{ "raw_signature": "int bagOfTokensScore(vector<int>& tokens, int power) {", "container": "Solution", "callable": "bagOfTokensScore", "parameters": [ { "name": "tokens", "type": "vector<int>&" }, { "name": "power", "type": "int" } ], "return_type": "int", "signature...
949
largest-time-for-given-digits
Medium
Given an array arr of 4 digits, find the latest 24-hour time that can be made using each digit exactly once. 24-hour times are formatted as "HH:MM", where HH is between 00 and 23, and MM is between 00 and 59. The earliest 24-hour time is 00:00, and the latest is 23:59. Return the latest 24-hour time in "HH:MM" format...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [2, 9, 0, 3]) == \"23:09\"\n assert candidate(arr = [1, 9, 6, 0]) == \"19:06\"\n assert candidate(arr = [0, 2, 6, 6]) == \"06:26\"\n assert candidate(arr = [4, 2, 4, 4]) == \"\"\n assert candidate(arr = [2, 2, 9, 6]) ==...
[ "[1,2,3,4]", "[5,5,5,5]" ]
[]
{ "canonical_parameter_names": [ "arr" ], "leetcode_dataset_entry_point": "Solution().largestTimeFromDigits", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:13", "tests_total": 123, "...
cpp
{ "raw_signature": "string largestTimeFromDigits(vector<int>& arr) {", "container": "Solution", "callable": "largestTimeFromDigits", "parameters": [ { "name": "arr", "type": "vector<int>&" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets", "type_source": "leet...
950
reveal-cards-in-increasing-order
Medium
You are given an integer array deck. There is a deck of cards where every card has a unique integer. The integer on the i^th card is deck[i]. You can order the deck in any order you want. Initially, all the cards start face down (unrevealed) in one deck. You will do the following steps repeatedly until all cards are ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(deck = [10, 1, 6, 7, 8, 2, 3, 4, 5, 9]) == [1, 6, 2, 10, 3, 7, 4, 9, 5, 8]\n assert candidate(deck = [5, 2, 3, 1, 4]) == [1, 5, 2, 4, 3]\n assert candidate(deck = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 6, 2, 10, 3, 7, 4, 9, 5, 8]\...
[ "[17,13,11,2,3,5,7]", "[1,1000]" ]
[]
{ "canonical_parameter_names": [ "deck" ], "leetcode_dataset_entry_point": "Solution().deckRevealedIncreasing", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:15", "tests_total": 78, ...
cpp
{ "raw_signature": "vector<int> deckRevealedIncreasing(vector<int>& deck) {", "container": "Solution", "callable": "deckRevealedIncreasing", "parameters": [ { "name": "deck", "type": "vector<int>&" } ], "return_type": "vector<int>", "signature_source": "leetcode/codeSnippets", "type_...
952
largest-component-size-by-common-factor
Hard
You are given an integer array of unique positive integers nums. Consider the following graph: - There are nums.length nodes, labeled nums[0] to nums[nums.length - 1], - There is an undirected edge between nums[i] and nums[j] if nums[i] and nums[j] share a common factor greater than 1. Return the size of the largest ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [20, 50, 9, 63]) == 2\n assert candidate(nums = [2, 3, 6, 7, 4, 12, 21, 39]) == 8\n assert candidate(nums = [30, 60, 20, 5, 15]) == 5\n assert candidate(nums = [5, 7, 11, 13]) == 1\n assert candidate(nums = [30, 42, 70...
[ "[4,6,15,35]", "[20,50,9,63]", "[2,3,6,7,4,12,21,39]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().largestComponentSize", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:19", "tests_total": 98, "t...
cpp
{ "raw_signature": "int largestComponentSize(vector<int>& nums) {", "container": "Solution", "callable": "largestComponentSize", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/c...
953
verifying-an-alien-dictionary
Easy
In an alien language, surprisingly, they also use English lowercase letters, but possibly in a different order. The order of the alphabet is some permutation of lowercase letters. Given a sequence of words written in the alien language, and the order of the alphabet, return true if and only if the given words are sort...
{ "language": "python", "source": "def check(candidate):\n assert candidate(words = ['a', 'b', 'c', 'd', 'e'],order = \"abcdefghijklmnopqrstuvwxyz\") == True\n assert candidate(words = ['kuvp', 'q'],order = \"ngxlkthsjuoqcpavbfdermiyzw\") == True\n assert candidate(words = ['zzz', 'zzzz'],order = \"zyxwvut...
[ "[\"hello\",\"leetcode\"]\n\"hlabcdefgijkmnopqrstuvwxyz\"", "[\"word\",\"world\",\"row\"]\n\"worldabcefghijkmnpqstuvxyz\"", "[\"apple\",\"app\"]\n\"abcdefghijklmnopqrstuvwxyz\"" ]
[]
{ "canonical_parameter_names": [ "words", "order" ], "leetcode_dataset_entry_point": "Solution().isAlienSorted", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:22", "tests_total": 1...
cpp
{ "raw_signature": "bool isAlienSorted(vector<string>& words, string order) {", "container": "Solution", "callable": "isAlienSorted", "parameters": [ { "name": "words", "type": "vector<string>&" }, { "name": "order", "type": "string" } ], "return_type": "bool", "sig...
954
array-of-doubled-pairs
Medium
Given an integer array of even length arr, return true if it is possible to reorder arr such that arr[2 * i + 1] = 2 * arr[2 * i] for every 0 <= i < len(arr) / 2, or false otherwise. Example 1: Input: arr = [3,1,3,6] Output: false Example 2: Input: arr = [2,1,2,6] Output: false Example 3: Input: arr = [4,-2,2,-4]...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [1, 4, 2, 2]) == True\n assert candidate(arr = [1, 2, 4, 16, 8, 4]) == False\n assert candidate(arr = [-5, -2, -10, -1, -1, -5]) == False\n assert candidate(arr = [5, -3, 3, -2, 2, -4]) == False\n assert candidate(arr =...
[ "[3,1,3,6]", "[2,1,2,6]", "[4,-2,2,-4]" ]
[]
{ "canonical_parameter_names": [ "arr" ], "leetcode_dataset_entry_point": "Solution().canReorderDoubled", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:24", "tests_total": 112, "test...
cpp
{ "raw_signature": "bool canReorderDoubled(vector<int>& arr) {", "container": "Solution", "callable": "canReorderDoubled", "parameters": [ { "name": "arr", "type": "vector<int>&" } ], "return_type": "bool", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSni...
955
delete-columns-to-make-sorted-ii
Medium
You are given an array of n strings strs, all of the same length. We may choose any deletion indices, and we delete all the characters in those indices for each string. For example, if we have strs = ["abcdef","uvwxyz"] and deletion indices {0, 2, 3}, then the final array after deletions is ["bef", "vyz"]. Suppose w...
{ "language": "python", "source": "def check(candidate):\n assert candidate(strs = ['ppp', 'qqq', 'rrr']) == 0\n assert candidate(strs = ['az', 'za']) == 0\n assert candidate(strs = ['xc', 'yb', 'za']) == 0\n assert candidate(strs = ['dog', 'cat', 'bat']) == 2\n assert candidate(strs = ['abcdef', 'uv...
[ "[\"ca\",\"bb\",\"ac\"]", "[\"xc\",\"yb\",\"za\"]", "[\"zyx\",\"wvu\",\"tsr\"]" ]
[]
{ "canonical_parameter_names": [ "strs" ], "leetcode_dataset_entry_point": "Solution().minDeletionSize", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:26", "tests_total": 205, "tests...
cpp
{ "raw_signature": "int minDeletionSize(vector<string>& strs) {", "container": "Solution", "callable": "minDeletionSize", "parameters": [ { "name": "strs", "type": "vector<string>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeS...
956
tallest-billboard
Hard
You are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel support must be an equal height. You are given a collection of rods that can be welded together. For example, if you have rods of lengths 1, 2, and 3, you can weld them togeth...
{ "language": "python", "source": "def check(candidate):\n assert candidate(rods = [10, 20, 30, 40]) == 50\n assert candidate(rods = [100, 200, 300]) == 300\n assert candidate(rods = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]) == 10\n assert candidate(rods = [10, 20, 30, 40, 50]) == 70...
[ "[1,2,3,6]", "[1,2,3,4,5,6]", "[1,2]" ]
[]
{ "canonical_parameter_names": [ "rods" ], "leetcode_dataset_entry_point": "Solution().tallestBillboard", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:28", "tests_total": 98, "tests...
cpp
{ "raw_signature": "int tallestBillboard(vector<int>& rods) {", "container": "Solution", "callable": "tallestBillboard", "parameters": [ { "name": "rods", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnipp...
957
prison-cells-after-n-days
Medium
There are 8 prison cells in a row and each cell is either occupied or vacant. Each day, whether the cell is occupied or vacant changes according to the following rules: - If a cell has two adjacent neighbors that are both occupied or both vacant, then the cell becomes occupied. - Otherwise, it becomes vacant. Note t...
{ "language": "python", "source": "def check(candidate):\n assert candidate(cells = [0, 0, 0, 0, 0, 0, 0, 0],n = 5) == [0, 1, 0, 1, 1, 0, 1, 0]\n assert candidate(cells = [1, 1, 1, 1, 1, 1, 1, 1],n = 2) == [0, 0, 1, 1, 1, 1, 0, 0]\n assert candidate(cells = [1, 1, 1, 1, 1, 1, 1, 1],n = 15) == [0, 1, 1, 1, ...
[ "[0,1,0,1,1,0,0,1]\n7", "[1,0,0,1,0,0,1,0]\n1000000000" ]
[]
{ "canonical_parameter_names": [ "cells", "n" ], "leetcode_dataset_entry_point": "Solution().prisonAfterNDays", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:30", "tests_total": 10...
cpp
{ "raw_signature": "vector<int> prisonAfterNDays(vector<int>& cells, int n) {", "container": "Solution", "callable": "prisonAfterNDays", "parameters": [ { "name": "cells", "type": "vector<int>&" }, { "name": "n", "type": "int" } ], "return_type": "vector<int>", "sig...
959
regions-cut-by-slashes
Medium
An n x n grid is composed of 1 x 1 squares where each 1 x 1 square consists of a '/', '\', or blank space ' '. These characters divide the square into contiguous regions. Given the grid grid represented as a string array, return the number of regions. Note that backslash characters are escaped, so a '\' is represente...
{ "language": "python", "source": "def check(candidate):\n assert candidate(grid = ['///', '///', '///']) == 6\n assert candidate(grid = [' /', '/ ']) == 2\n assert candidate(grid = ['/\\\\', '\\\\/']) == 5\n assert candidate(grid = [' /', ' ']) == 1\n assert candidate(grid = [' ', ' ', ' ']) ...
[ "[\" /\",\"/ \"]", "[\" /\",\" \"]", "[\"/\\\\\",\"\\\\/\"]" ]
[]
{ "canonical_parameter_names": [ "grid" ], "leetcode_dataset_entry_point": "Solution().regionsBySlashes", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:50", "tests_total": 89, "tests...
cpp
{ "raw_signature": "int regionsBySlashes(vector<string>& grid) {", "container": "Solution", "callable": "regionsBySlashes", "parameters": [ { "name": "grid", "type": "vector<string>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/cod...
960
delete-columns-to-make-sorted-iii
Hard
You are given an array of n strings strs, all of the same length. We may choose any deletion indices, and we delete all the characters in those indices for each string. For example, if we have strs = ["abcdef","uvwxyz"] and deletion indices {0, 2, 3}, then the final array after deletions is ["bef", "vyz"]. Suppose w...
{ "language": "python", "source": "def check(candidate):\n assert candidate(strs = ['zyx', 'zyx', 'zyx']) == 2\n assert candidate(strs = ['rrjk', 'furt', 'guzm']) == 2\n assert candidate(strs = ['axx', 'ggs', 'zzz']) == 0\n assert candidate(strs = ['ghi', 'def', 'abc']) == 0\n assert candidate(strs =...
[ "[\"babca\",\"bbazb\"]", "[\"edcba\"]", "[\"ghi\",\"def\",\"abc\"]" ]
[]
{ "canonical_parameter_names": [ "strs" ], "leetcode_dataset_entry_point": "Solution().minDeletionSize", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:52", "tests_total": 100, "tests...
cpp
{ "raw_signature": "int minDeletionSize(vector<string>& strs) {", "container": "Solution", "callable": "minDeletionSize", "parameters": [ { "name": "strs", "type": "vector<string>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeS...
961
n-repeated-element-in-size-2n-array
Easy
You are given an integer array nums with the following properties: - nums.length == 2 * n. - nums contains n + 1 unique values, n of which occur exactly once in the array. - Exactly one element of nums is repeated n times. Return the element that is repeated n times. Example 1: Input: nums = [1,2,3,3] Output: 3 Ex...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 20, 30, 10, 40, 50]) == 10\n assert candidate(nums = [9, 8, 7, 6, 5, 4, 3, 2, 1, 9]) == 9\n assert candidate(nums = [21, 22, 23, 24, 21, 25, 26, 27]) == 21\n assert candidate(nums = [14, 15, 16, 17, 18, 19, 14, 20]) ...
[ "[1,2,3,3]", "[2,1,2,5,3,2]", "[5,1,5,2,5,3,5,4]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().repeatedNTimes", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:54", "tests_total": 93, "tests_d...
cpp
{ "raw_signature": "int repeatedNTimes(vector<int>& nums) {", "container": "Solution", "callable": "repeatedNTimes", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets"...
962
maximum-width-ramp
Medium
A ramp in an integer array nums is a pair (i, j) for which i < j and nums[i] <= nums[j]. The width of such a ramp is j - i. Given an integer array nums, return the maximum width of a ramp in nums. If there is no ramp in nums, return 0. Example 1: Input: nums = [6,0,8,2,1,5] Output: 4 Explanation: The maximum width r...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 3, 2, 2, 3, 3, 7, 5, 2, 4]) == 9\n assert candidate(nums = [1, 5, 2, 5, 6, 3, 5, 4]) == 7\n assert candidate(nums = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) == 9\n assert candidate(nums = [1, 5, 5, 5, 5, 5]) == 5\n assert c...
[ "[6,0,8,2,1,5]", "[9,8,1,0,1,9,4,0,4,1]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().maxWidthRamp", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:56", "tests_total": 69, "tests_dro...
cpp
{ "raw_signature": "int maxWidthRamp(vector<int>& nums) {", "container": "Solution", "callable": "maxWidthRamp", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
963
minimum-area-rectangle-ii
Medium
You are given an array of points in the X-Y plane points where points[i] = [x_i, y_i]. Return the minimum area of any rectangle formed from these points, with sides not necessarily parallel to the X and Y axes. If there is not any such rectangle, return 0. Answers within 10^-5 of the actual answer will be accepted. ...
{ "language": "python", "source": "def answers_match(result, expected):\n \"\"\"Decimal answers are accepted within 1e-5 (absolute or relative), as on LeetCode.\"\"\"\n import math\n if isinstance(result, list) and isinstance(expected, list):\n return len(result) == len(expected) and all(answers_mat...
[ "[[1,2],[2,1],[1,0],[0,1]]", "[[0,1],[2,1],[1,1],[1,0],[2,0]]", "[[0,3],[1,2],[3,1],[1,3],[2,1]]" ]
[]
{ "canonical_parameter_names": [ "points" ], "leetcode_dataset_entry_point": "Solution().minAreaFreeRect", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:05:58", "tests_total": 100, "tes...
cpp
{ "raw_signature": "double minAreaFreeRect(vector<vector<int>>& points) {", "container": "Solution", "callable": "minAreaFreeRect", "parameters": [ { "name": "points", "type": "vector<vector<int>>&" } ], "return_type": "double", "signature_source": "leetcode/codeSnippets", "type_sour...
964
least-operators-to-express-number
Hard
Given a single positive integer x, we will write an expression of the form x (op1) x (op2) x (op3) x ... where each operator op1, op2, etc. is either addition, subtraction, multiplication, or division (+, -, *, or /). For example, with x = 3, we might write 3 * 3 / 3 + 3 - 3 which is a value of 3. When writing such an...
{ "language": "python", "source": "def check(candidate):\n assert candidate(x = 2,target = 123456) == 44\n assert candidate(x = 2,target = 3) == 2\n assert candidate(x = 3,target = 81) == 3\n assert candidate(x = 10,target = 1001) == 4\n assert candidate(x = 2,target = 10) == 3\n assert candidate(...
[ "3\n19", "5\n501", "100\n100000000" ]
[]
{ "canonical_parameter_names": [ "x", "target" ], "leetcode_dataset_entry_point": "Solution().leastOpsExpressTarget", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:01", "tests_tota...
cpp
{ "raw_signature": "int leastOpsExpressTarget(int x, int target) {", "container": "Solution", "callable": "leastOpsExpressTarget", "parameters": [ { "name": "x", "type": "int" }, { "name": "target", "type": "int" } ], "return_type": "int", "signature_source": "leetc...
966
vowel-spellchecker
Medium
Given a wordlist, we want to implement a spellchecker that converts a query word into a correct word. For a given query word, the spell checker handles two categories of spelling mistakes: - Capitalization: If the query matches a word in the wordlist (case-insensitive), then the query word is returned with the same c...
{ "language": "python", "source": "def check(candidate):\n assert candidate(wordlist = ['aeiou', 'AEIOU'],queries = ['aeio', 'aeiou', 'AEIOU', 'eioua']) == ['', 'aeiou', 'AEIOU', 'aeiou']\n assert candidate(wordlist = ['aaaaa', 'Aaaaa'],queries = ['Aaaaa', 'aaaaa', 'aaAaa', 'aAaaa', 'AaAaa']) == ['Aaaaa', 'aa...
[ "[\"KiTe\",\"kite\",\"hare\",\"Hare\"]\n[\"kite\",\"Kite\",\"KiTe\",\"Hare\",\"HARE\",\"Hear\",\"hear\",\"keti\",\"keet\",\"keto\"]", "[\"yellow\"]\n[\"YellOw\"]" ]
[]
{ "canonical_parameter_names": [ "wordlist", "queries" ], "leetcode_dataset_entry_point": "Solution().spellchecker", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:05", "tests_total...
cpp
{ "raw_signature": "vector<string> spellchecker(vector<string>& wordlist, vector<string>& queries) {", "container": "Solution", "callable": "spellchecker", "parameters": [ { "name": "wordlist", "type": "vector<string>&" }, { "name": "queries", "type": "vector<string>&" } ...
967
numbers-with-same-consecutive-differences
Medium
Given two integers n and k, return an array of all the integers of length n where the difference between every two consecutive digits is k. You may return the answer in any order. Note that the integers should not have leading zeros. Integers as 02 and 043 are not allowed. Example 1: Input: n = 3, k = 7 Output: [181...
{ "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 ...
[ "3\n7", "2\n1" ]
[]
{ "canonical_parameter_names": [ "n", "k" ], "leetcode_dataset_entry_point": "Solution().numsSameConsecDiff", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:07", "tests_total": 61, ...
cpp
{ "raw_signature": "vector<int> numsSameConsecDiff(int n, int k) {", "container": "Solution", "callable": "numsSameConsecDiff", "parameters": [ { "name": "n", "type": "int" }, { "name": "k", "type": "int" } ], "return_type": "vector<int>", "signature_source": "leetc...
969
pancake-sorting
Medium
Given an array of integers arr, sort the array by performing a series of pancake flips. In one pancake flip we do the following steps: - Choose an integer k where 1 <= k <= arr.length. - Reverse the sub-array arr[0...k-1] (0-indexed). For example, if arr = [3,2,1,4] and we performed a pancake flip choosing k = 3, we...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [2, 1, 3, 4, 5]) == [2]\n assert candidate(arr = [4, 3, 2, 1]) == [4]\n assert candidate(arr = [5, 4, 3, 2, 1]) == [5]\n assert candidate(arr = [3, 1, 2]) == [3, 2]\n assert candidate(arr = [1, 5, 3, 4, 2]) == [2, 5, 2,...
[ "[3,2,4,1]", "[1,2,3]" ]
[]
{ "canonical_parameter_names": [ "arr" ], "leetcode_dataset_entry_point": "Solution().pancakeSort", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:12", "tests_total": 99, "tests_dropp...
cpp
{ "raw_signature": "vector<int> pancakeSort(vector<int>& arr) {", "container": "Solution", "callable": "pancakeSort", "parameters": [ { "name": "arr", "type": "vector<int>&" } ], "return_type": "vector<int>", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeS...
970
powerful-integers
Medium
Given three integers x, y, and bound, return a list of all the powerful integers that have a value less than or equal to bound. An integer is powerful if it can be represented as x^i + y^j for some integers i >= 0 and j >= 0. You may return the answer in any order. In your answer, each value should occur at most once...
{ "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 ...
[ "2\n3\n10", "3\n5\n15" ]
[]
{ "canonical_parameter_names": [ "x", "y", "bound" ], "leetcode_dataset_entry_point": "Solution().powerfulIntegers", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:14", "tests_t...
cpp
{ "raw_signature": "vector<int> powerfulIntegers(int x, int y, int bound) {", "container": "Solution", "callable": "powerfulIntegers", "parameters": [ { "name": "x", "type": "int" }, { "name": "y", "type": "int" }, { "name": "bound", "type": "int" } ...
972
equal-rational-numbers
Hard
Given two strings s and t, each of which represents a non-negative rational number, return true if and only if they represent the same number. The strings may use parentheses to denote the repeating part of the rational number. A rational number can be represented using up to three parts: <IntegerPart>, <NonRepeatingP...
{ "language": "python", "source": "def check(candidate):\n assert candidate(s = \"0.123\",t = \"0.123\") == True\n assert candidate(s = \"0.(9)\",t = \"1\") == True\n assert candidate(s = \"0.0(0)\",t = \"0\") == True\n assert candidate(s = \"0.9(99)\",t = \"1.0\") == True\n assert candidate(s = \"0....
[ "\"0.(52)\"\n\"0.5(25)\"", "\"0.1666(6)\"\n\"0.166(66)\"", "\"0.9(9)\"\n\"1.\"" ]
[]
{ "canonical_parameter_names": [ "s", "t" ], "leetcode_dataset_entry_point": "Solution().isRationalEqual", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:18", "tests_total": 155, ...
cpp
{ "raw_signature": "bool isRationalEqual(string s, string t) {", "container": "Solution", "callable": "isRationalEqual", "parameters": [ { "name": "s", "type": "string" }, { "name": "t", "type": "string" } ], "return_type": "bool", "signature_source": "leetcode/code...
973
k-closest-points-to-origin
Medium
Given an array of points where points[i] = [x_i, y_i] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0). The distance between two points on the X-Y plane is the Euclidean distance (i.e., √(x_1 - x_2)^2 + (y_1 - y_2)^2). You may return the answer in any order. The a...
{ "language": "python", "source": "def answers_match(result, expected):\n \"\"\"The answer may list its items in any order (only the top-level order is free).\"\"\"\n if isinstance(result, list) and isinstance(expected, list):\n return sorted(result, key=repr) == sorted(expected, key=repr)\n return ...
[ "[[1,3],[-2,2]]\n1", "[[3,3],[5,-1],[-2,4]]\n2" ]
[]
{ "canonical_parameter_names": [ "points", "k" ], "leetcode_dataset_entry_point": "Solution().kClosest", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:21", "tests_total": 98, "te...
cpp
{ "raw_signature": "vector<vector<int>> kClosest(vector<vector<int>>& points, int k) {", "container": "Solution", "callable": "kClosest", "parameters": [ { "name": "points", "type": "vector<vector<int>>&" }, { "name": "k", "type": "int" } ], "return_type": "vector<vec...
974
subarray-sums-divisible-by-k
Medium
Given an integer array nums and an integer k, return the number of non-empty subarrays that have a sum divisible by k. A subarray is a contiguous part of an array. Example 1: Input: nums = [4,5,0,-2,-3,1], k = 5 Output: 7 Explanation: There are 7 subarrays with a sum divisible by k = 5: [4, 5, 0, -2, -3, 1], [5], [5...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 2, 2, 2, 2],k = 6) == 3\n assert candidate(nums = [0, 0, 0, 0],k = 2) == 10\n assert candidate(nums = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],k = 2) == 25\n assert candidate(nums = [-1, 2, -3, 4, -5],k = 2) == 6\n assert ca...
[ "[4,5,0,-2,-3,1]\n5", "[5]\n9" ]
[]
{ "canonical_parameter_names": [ "nums", "k" ], "leetcode_dataset_entry_point": "Solution().subarraysDivByK", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:23", "tests_total": 108,...
cpp
{ "raw_signature": "int subarraysDivByK(vector<int>& nums, int k) {", "container": "Solution", "callable": "subarraysDivByK", "parameters": [ { "name": "nums", "type": "vector<int>&" }, { "name": "k", "type": "int" } ], "return_type": "int", "signature_source": "lee...
975
odd-even-jump
Hard
You are given an integer array arr. From some starting index, you can make a series of jumps. The (1^st, 3^rd, 5^th, ...) jumps in the series are called odd-numbered jumps, and the (2^nd, 4^th, 6^th, ...) jumps in the series are called even-numbered jumps. Note that the jumps are numbered, not the indices. You may jum...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [11, 9, 7, 5, 3, 1]) == 1\n assert candidate(arr = [5, 4, 3, 2, 1]) == 1\n assert candidate(arr = [7, 10, 5, 8, 4, 2, 6, 3, 9, 1]) == 8\n assert candidate(arr = [0, 10, 8, 9, 3, 5, 7, 6, 2, 4, 1, 11]) == 11\n assert can...
[ "[10,13,12,14,15]", "[2,3,1,1,4]", "[5,1,3,4,2]" ]
[]
{ "canonical_parameter_names": [ "arr" ], "leetcode_dataset_entry_point": "Solution().oddEvenJumps", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:25", "tests_total": 205, "tests_dro...
cpp
{ "raw_signature": "int oddEvenJumps(vector<int>& arr) {", "container": "Solution", "callable": "oddEvenJumps", "parameters": [ { "name": "arr", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
976
largest-perimeter-triangle
Easy
Given an integer array nums, return the largest perimeter of a triangle with a non-zero area, formed from three of these lengths. If it is impossible to form any triangle of a non-zero area, return 0. Example 1: Input: nums = [2,1,2] Output: 5 Explanation: You can form a triangle with three side lengths: 1, 2, and 2....
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [10, 5, 7]) == 22\n assert candidate(nums = [10, 5, 1, 8, 12, 10, 5, 15]) == 37\n assert candidate(nums = [7, 10, 5, 2, 8, 7]) == 25\n assert candidate(nums = [1, 1, 1, 1]) == 3\n assert candidate(nums = [1, 1, 1]) == ...
[ "[2,1,2]", "[1,2,1,10]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().largestPerimeter", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:27", "tests_total": 114, "test...
cpp
{ "raw_signature": "int largestPerimeter(vector<int>& nums) {", "container": "Solution", "callable": "largestPerimeter", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnipp...
977
squares-of-a-sorted-array
Easy
Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order. Example 1: Input: nums = [-4,-1,0,3,10] Output: [0,1,9,16,100] Explanation: After squaring, the array becomes [16,1,0,9,100]. After sorting, it becomes [0,1,9,16,100]. Example 2: ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [-2, -1, 0, 1, 2]) == [0, 1, 1, 4, 4]\n assert candidate(nums = [0, 1, 2, 3, 4, 5]) == [0, 1, 4, 9, 16, 25]\n assert candidate(nums = [-1, -1, 0, 0, 1, 1]) == [0, 0, 1, 1, 1, 1]\n assert candidate(nums = [-1]) == [1]\n ...
[ "[-4,-1,0,3,10]", "[-7,-3,2,3,11]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().sortedSquares", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:29", "tests_total": 119, "tests_d...
cpp
{ "raw_signature": "vector<int> sortedSquares(vector<int>& nums) {", "container": "Solution", "callable": "sortedSquares", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "vector<int>", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode...
978
longest-turbulent-subarray
Medium
Given an integer array arr, return the length of a maximum size turbulent subarray of arr. A subarray is turbulent if the comparison sign flips between each adjacent pair of elements in the subarray. More formally, a subarray [arr[i], arr[i + 1], ..., arr[j]] of arr is said to be turbulent if and only if: - For i <=...
{ "language": "python", "source": "def check(candidate):\n assert candidate(arr = [9, 9]) == 1\n assert candidate(arr = [9, 4, 2, 10, 7, 8, 8, 1, 9]) == 5\n assert candidate(arr = [9, 8, 7, 6, 7, 8, 9, 8, 7, 6]) == 3\n assert candidate(arr = [1, 2, 1, 2, 1, 2, 1, 2, 3]) == 8\n assert candidate(arr = ...
[ "[9,4,2,10,7,8,8,1,9]", "[4,8,12,16]", "[100]" ]
[]
{ "canonical_parameter_names": [ "arr" ], "leetcode_dataset_entry_point": "Solution().maxTurbulenceSize", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:31", "tests_total": 150, "test...
cpp
{ "raw_signature": "int maxTurbulenceSize(vector<int>& arr) {", "container": "Solution", "callable": "maxTurbulenceSize", "parameters": [ { "name": "arr", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnipp...
980
unique-paths-iii
Hard
You are given an m x n integer array grid where grid[i][j] could be: - 1 representing the starting square. There is exactly one starting square. - 2 representing the ending square. There is exactly one ending square. - 0 representing empty squares we can walk over. - -1 representing obstacles that we cannot walk over....
{ "language": "python", "source": "def check(candidate):\n assert candidate(grid = [[0, 1], [2, 0]]) == 0\n assert candidate(grid = [[0, 0, 0], [1, 0, 0], [0, 2, -1]]) == 0\n assert candidate(grid = [[1, 0, -1, 0, 2]]) == 0\n assert candidate(grid = [[1, 0, 2], [-1, 0, 0], [0, 0, 0]]) == 0\n assert c...
[ "[[1,0,0,0],[0,0,0,0],[0,0,2,-1]]", "[[1,0,0,0],[0,0,0,0],[0,0,0,2]]", "[[0,1],[2,0]]" ]
[]
{ "canonical_parameter_names": [ "grid" ], "leetcode_dataset_entry_point": "Solution().uniquePathsIII", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:36", "tests_total": 85, "tests_d...
cpp
{ "raw_signature": "int uniquePathsIII(vector<vector<int>>& grid) {", "container": "Solution", "callable": "uniquePathsIII", "parameters": [ { "name": "grid", "type": "vector<vector<int>>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetco...
982
triples-with-bitwise-and-equal-to-zero
Hard
Given an integer array nums, return the number of AND triples. An AND triple is a triple of indices (i, j, k) such that: - 0 <= i < nums.length - 0 <= j < nums.length - 0 <= k < nums.length - nums[i] & nums[j] & nums[k] == 0, where & represents the bitwise-AND operator. Example 1: Input: nums = [2,1,3] Output: 12 E...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [0, 0, 0]) == 27\n assert candidate(nums = [5, 3, 7, 10]) == 18\n assert candidate(nums = [15, 15, 15, 15]) == 0\n assert candidate(nums = [5, 3, 0, 1, 4]) == 91\n assert candidate(nums = [1, 2, 3, 4]) == 48\n asser...
[ "[2,1,3]", "[0,0,0]" ]
[]
{ "canonical_parameter_names": [ "nums" ], "leetcode_dataset_entry_point": "Solution().countTriplets", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:38", "tests_total": 91, "tests_dr...
cpp
{ "raw_signature": "int countTriplets(vector<int>& nums) {", "container": "Solution", "callable": "countTriplets", "parameters": [ { "name": "nums", "type": "vector<int>&" } ], "return_type": "int", "signature_source": "leetcode/codeSnippets", "type_source": "leetcode/codeSnippets" }
983
minimum-cost-for-tickets
Medium
You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array days. Each day is an integer from 1 to 365. Train tickets are sold in three different ways: - a 1-day pass is sold for costs[0] dollars, - a 7-day pass is sold for costs[1] dollars, a...
{ "language": "python", "source": "def check(candidate):\n assert candidate(days = [1, 50, 100, 200, 300, 365],costs = [5, 10, 20]) == 30\n assert candidate(days = [1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 20, 22, 23, 25, 26, 28, 29, 31],costs = [4, 12, 30]) == 34\n assert candidate(days = [1, 100, 20...
[ "[1,4,6,7,8,20]\n[2,7,15]", "[1,2,3,4,5,6,7,8,9,10,30,31]\n[2,7,15]" ]
[]
{ "canonical_parameter_names": [ "days", "costs" ], "leetcode_dataset_entry_point": "Solution().mincostTickets", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:40", "tests_total": 7...
cpp
{ "raw_signature": "int mincostTickets(vector<int>& days, vector<int>& costs) {", "container": "Solution", "callable": "mincostTickets", "parameters": [ { "name": "days", "type": "vector<int>&" }, { "name": "costs", "type": "vector<int>&" } ], "return_type": "int", ...
984
string-without-aaa-or-bbb
Medium
Given two integers a and b, return any string s such that: - s has length a + b and contains exactly a 'a' letters, and exactly b 'b' letters, - The substring 'aaa' does not occur in s, and - The substring 'bbb' does not occur in s. Example 1: Input: a = 1, b = 2 Output: "abb" Explanation: "abb", "bab" and "bba" are...
{ "language": "python", "source": "def check(candidate):\n assert candidate(a = 0,b = 5) == \"bbbbb\"\n assert candidate(a = 10,b = 10) == \"abababababababababab\"\n assert candidate(a = 6,b = 4) == \"aabaababab\"\n assert candidate(a = 7,b = 7) == \"ababababababab\"\n assert candidate(a = 4,b = 1) =...
[ "1\n2", "4\n1" ]
[]
{ "canonical_parameter_names": [ "a", "b" ], "leetcode_dataset_entry_point": "Solution().strWithout3a3b", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:43", "tests_total": 64, "t...
cpp
{ "raw_signature": "string strWithout3a3b(int a, int b) {", "container": "Solution", "callable": "strWithout3a3b", "parameters": [ { "name": "a", "type": "int" }, { "name": "b", "type": "int" } ], "return_type": "string", "signature_source": "leetcode/codeSnippets",...
985
sum-of-even-numbers-after-queries
Medium
You are given an integer array nums and an array queries where queries[i] = [val_i, index_i]. For each query i, first, apply nums[index_i] = nums[index_i] + val_i, then print the sum of the even values of nums. Return an integer array answer where answer[i] is the answer to the i^th query. Example 1: Input: nums = ...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [2, 4, 6, 8],queries = [[1, 0], [2, 1], [3, 2], [4, 3]]) == [18, 20, 14, 18]\n assert candidate(nums = [2, 4, 6, 8],queries = [[-2, 0], [2, 1], [-4, 2], [4, 3]]) == [18, 20, 16, 20]\n assert candidate(nums = [0, 0, 0, 0],que...
[ "[1,2,3,4]\n[[1,0],[-3,1],[-4,0],[2,3]]", "[1]\n[[4,0]]" ]
[]
{ "canonical_parameter_names": [ "nums", "queries" ], "leetcode_dataset_entry_point": "Solution().sumEvenAfterQueries", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:45", "tests_to...
cpp
{ "raw_signature": "vector<int> sumEvenAfterQueries(vector<int>& nums, vector<vector<int>>& queries) {", "container": "Solution", "callable": "sumEvenAfterQueries", "parameters": [ { "name": "nums", "type": "vector<int>&" }, { "name": "queries", "type": "vector<vector<int>>&"...
986
interval-list-intersections
Medium
You are given two lists of closed intervals, firstList and secondList, where firstList[i] = [start_i, end_i] and secondList[j] = [start_j, end_j]. Each list of intervals is pairwise disjoint and in sorted order. Return the intersection of these two interval lists. A closed interval [a, b] (with a <= b) denotes the se...
{ "language": "python", "source": "def check(candidate):\n assert candidate(firstList = [[1, 2], [3, 5], [6, 7]],secondList = [[2, 3], [5, 6]]) == [[2, 2], [3, 3], [5, 5], [6, 6]]\n assert candidate(firstList = [[1, 5]],secondList = [[2, 3]]) == [[2, 3]]\n assert candidate(firstList = [],secondList = [[1, ...
[ "[[0,2],[5,10],[13,23],[24,25]]\n[[1,5],[8,12],[15,24],[25,26]]", "[[1,3],[5,9]]\n[]" ]
[]
{ "canonical_parameter_names": [ "firstList", "secondList" ], "leetcode_dataset_entry_point": "Solution().intervalIntersection", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:47", ...
cpp
{ "raw_signature": "vector<vector<int>> intervalIntersection(vector<vector<int>>& firstList, vector<vector<int>>& secondList) {", "container": "Solution", "callable": "intervalIntersection", "parameters": [ { "name": "firstList", "type": "vector<vector<int>>&" }, { "name": "secondL...
989
add-to-array-form-of-integer
Easy
The array-form of an integer num is an array representing its digits in left to right order. - For example, for num = 1321, the array form is [1,3,2,1]. Given num, the array-form of an integer, and an integer k, return the array-form of the integer num + k. Example 1: Input: num = [1,2,0,0], k = 34 Output: [1,2,3,4...
{ "language": "python", "source": "def check(candidate):\n assert candidate(num = [1],k = 9) == [1, 0]\n assert candidate(num = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],k = 1) == [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]\n assert candidate(num = [0],k = 10000) == [1, ...
[ "[1,2,0,0]\n34", "[2,7,4]\n181", "[2,1,5]\n806" ]
[]
{ "canonical_parameter_names": [ "num", "k" ], "leetcode_dataset_entry_point": "Solution().addToArrayForm", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:54", "tests_total": 75, ...
cpp
{ "raw_signature": "vector<int> addToArrayForm(vector<int>& num, int k) {", "container": "Solution", "callable": "addToArrayForm", "parameters": [ { "name": "num", "type": "vector<int>&" }, { "name": "k", "type": "int" } ], "return_type": "vector<int>", "signature_s...
990
satisfiability-of-equality-equations
Medium
You are given an array of strings equations that represent relationships between variables where each string equations[i] is of length 4 and takes one of two different forms: "x_i==y_i" or "x_i!=y_i".Here, x_i and y_i are lowercase letters (not necessarily different) that represent one-letter variable names. Return tr...
{ "language": "python", "source": "def check(candidate):\n assert candidate(equations = ['a!=a']) == False\n assert candidate(equations = ['a==b', 'c==d', 'e==f', 'g==h']) == True\n assert candidate(equations = ['c==c', 'b==d', 'x!=z']) == True\n assert candidate(equations = ['a==b', 'b==c', 'a!=c']) ==...
[ "[\"a==b\",\"b!=a\"]", "[\"b==a\",\"a==b\"]" ]
[]
{ "canonical_parameter_names": [ "equations" ], "leetcode_dataset_entry_point": "Solution().equationsPossible", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:56", "tests_total": 83, ...
cpp
{ "raw_signature": "bool equationsPossible(vector<string>& equations) {", "container": "Solution", "callable": "equationsPossible", "parameters": [ { "name": "equations", "type": "vector<string>&" } ], "return_type": "bool", "signature_source": "leetcode/codeSnippets", "type_source":...
991
broken-calculator
Medium
There is a broken calculator that has the integer startValue on its display initially. In one operation, you can: - multiply the number on display by 2, or - subtract 1 from the number on display. Given two integers startValue and target, return the minimum number of operations needed to display target on the calcula...
{ "language": "python", "source": "def check(candidate):\n assert candidate(startValue = 2,target = 3) == 2\n assert candidate(startValue = 1000000000,target = 1) == 999999999\n assert candidate(startValue = 7,target = 15) == 6\n assert candidate(startValue = 2,target = 1) == 1\n assert candidate(sta...
[ "2\n3", "5\n8", "3\n10" ]
[]
{ "canonical_parameter_names": [ "startValue", "target" ], "leetcode_dataset_entry_point": "Solution().brokenCalc", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:06:58", "tests_total"...
cpp
{ "raw_signature": "int brokenCalc(int startValue, int target) {", "container": "Solution", "callable": "brokenCalc", "parameters": [ { "name": "startValue", "type": "int" }, { "name": "target", "type": "int" } ], "return_type": "int", "signature_source": "leetcode/...
992
subarrays-with-k-different-integers
Hard
Given an integer array nums and an integer k, return the number of good subarrays of nums. A good array is an array where the number of different integers in that array is exactly k. - For example, [1,2,3,1,2] has 3 different integers: 1, 2, and 3. A subarray is a contiguous part of an array. Example 1: Input: num...
{ "language": "python", "source": "def check(candidate):\n assert candidate(nums = [1, 2, 1, 3, 4],k = 3) == 3\n assert candidate(nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],k = 10) == 1\n assert candidate(nums = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5],k = 1) == 55\n assert candidate(nums = [1, 2, 2, 1, 1, 3],k = 2) ...
[ "[1,2,1,2,3]\n2", "[1,2,1,3,4]\n3" ]
[ "Try generating all possible subarrays and check for the number of unique integers. Increment the count accordingly.", "How about using a map to store the count of integers?", "Think about the Sliding Window and 2-pointer approach." ]
{ "canonical_parameter_names": [ "nums", "k" ], "leetcode_dataset_entry_point": "Solution().subarraysWithKDistinct", "problem_source": "newfacade/LeetCodeDataset", "description_source": "leetcode.com", "interface_source": "leetcode/codeSnippets", "fetched_at": "2026-09-30T20:07:00", "tests_total...
cpp
{ "raw_signature": "int subarraysWithKDistinct(vector<int>& nums, int k) {", "container": "Solution", "callable": "subarraysWithKDistinct", "parameters": [ { "name": "nums", "type": "vector<int>&" }, { "name": "k", "type": "int" } ], "return_type": "int", "signature...