← robinhood / Staff Product Manager, Cortex
coding_drills / art_lNBMmJ96Wlw
Content
{"kind": "coding_drills", "role_id": "role_OKzipRSR7zY", "source": "leetcode_graphql", "generated_at": "2026-05-21T22:40:32.583956+00:00", "difficulty_mix": {"Easy": 3, "Medium": 5, "Hard": 2}, "topics_filter": [], "questions": [{"index": 0, "category": "coding_array", "question": "[Easy] LC #14 \u00b7 Longest Common Prefix \u2014 solve on leetcode.com", "why": "Topic tags: array, string, trie. AC rate 47.6%. Open the editor at https://leetcode.com/problems/longest-common-prefix/, talk through your approach, then sketch the algorithm here (whiteboard) or write a plain-English solution (typed).", "how_to_prepare": "Clarify constraints, propose a brute-force, refine to an optimal time/space, walk through 2 example inputs (including an edge case), then trace your final code by hand.", "leetcode": {"title_slug": "longest-common-prefix", "frontend_id": "14", "difficulty": "Easy", "ac_rate": 47.5629941623571, "topics": ["array", "string", "trie"], "url": "https://leetcode.com/problems/longest-common-prefix/", "problem_html": "<p>Write a function to find the longest common prefix string amongst an array of strings.</p>\n\n<p>If there is no common prefix, return an empty string <code>""</code>.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> strs = ["flower","flow","flight"]\n<strong>Output:</strong> "fl"\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> strs = ["dog","racecar","car"]\n<strong>Output:</strong> ""\n<strong>Explanation:</strong> There is no common prefix among the input strings.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= strs.length <= 200</code></li>\n\t<li><code>0 <= strs[i].length <= 200</code></li>\n\t<li><code>strs[i]</code> consists of only lowercase English letters if it is non-empty.</li>\n</ul>\n", "hints": []}}, {"index": 1, "category": "coding_math", "question": "[Easy] LC #9 \u00b7 Palindrome Number \u2014 solve on leetcode.com", "why": "Topic tags: math. AC rate 60.6%. Open the editor at https://leetcode.com/problems/palindrome-number/, talk through your approach, then sketch the algorithm here (whiteboard) or write a plain-English solution (typed).", "how_to_prepare": "Clarify constraints, propose a brute-force, refine to an optimal time/space, walk through 2 example inputs (including an edge case), then trace your final code by hand.", "leetcode": {"title_slug": "palindrome-number", "frontend_id": "9", "difficulty": "Easy", "ac_rate": 60.558116308243, "topics": ["math"], "url": "https://leetcode.com/problems/palindrome-number/", "problem_html": "<p>Given an integer <code>x</code>, return <code>true</code><em> if </em><code>x</code><em> is a </em><span data-keyword=\"palindrome-integer\"><em><strong>palindrome</strong></em></span><em>, and </em><code>false</code><em> otherwise</em>.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> x = 121\n<strong>Output:</strong> true\n<strong>Explanation:</strong> 121 reads as 121 from left to right and from right to left.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> x = -121\n<strong>Output:</strong> false\n<strong>Explanation:</strong> From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> x = 10\n<strong>Output:</strong> false\n<strong>Explanation:</strong> Reads 01 from right to left. Therefore it is not a palindrome.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>-2<sup>31</sup> <= x <= 2<sup>31</sup> - 1</code></li>\n</ul>\n\n<p> </p>\n<strong>Follow up:</strong> Could you solve it without converting the integer to a string?", "hints": ["Beware of overflow when you reverse the integer."]}}, {"index": 2, "category": "coding_hash_table", "question": "[Easy] LC #13 \u00b7 Roman to Integer \u2014 solve on leetcode.com", "why": "Topic tags: hash-table, math, string. AC rate 66.6%. Open the editor at https://leetcode.com/problems/roman-to-integer/, talk through your approach, then sketch the algorithm here (whiteboard) or write a plain-English solution (typed).", "how_to_prepare": "Clarify constraints, propose a brute-force, refine to an optimal time/space, walk through 2 example inputs (including an edge case), then trace your final code by hand.", "leetcode": {"title_slug": "roman-to-integer", "frontend_id": "13", "difficulty": "Easy", "ac_rate": 66.6294901822322, "topics": ["hash-table", "math", "string"], "url": "https://leetcode.com/problems/roman-to-integer/", "problem_html": "<p>Roman numerals are represented by seven different symbols: <code>I</code>, <code>V</code>, <code>X</code>, <code>L</code>, <code>C</code>, <code>D</code> and <code>M</code>.</p>\n\n<pre>\n<strong>Symbol</strong> <strong>Value</strong>\nI 1\nV 5\nX 10\nL 50\nC 100\nD 500\nM 1000</pre>\n\n<p>For example, <code>2</code> is written as <code>II</code> in Roman numeral, just two ones added together. <code>12</code> is written as <code>XII</code>, which is simply <code>X + II</code>. The number <code>27</code> is written as <code>XXVII</code>, which is <code>XX + V + II</code>.</p>\n\n<p>Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not <code>IIII</code>. Instead, the number four is written as <code>IV</code>. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as <code>IX</code>. There are six instances where subtraction is used:</p>\n\n<ul>\n\t<li><code>I</code> can be placed before <code>V</code> (5) and <code>X</code> (10) to make 4 and 9. </li>\n\t<li><code>X</code> can be placed before <code>L</code> (50) and <code>C</code> (100) to make 40 and 90. </li>\n\t<li><code>C</code> can be placed before <code>D</code> (500) and <code>M</code> (1000) to make 400 and 900.</li>\n</ul>\n\n<p>Given a roman numeral, convert it to an integer.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "III"\n<strong>Output:</strong> 3\n<strong>Explanation:</strong> III = 3.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "LVIII"\n<strong>Output:</strong> 58\n<strong>Explanation:</strong> L = 50, V= 5, III = 3.\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "MCMXCIV"\n<strong>Output:</strong> 1994\n<strong>Explanation:</strong> M = 1000, CM = 900, XC = 90 and IV = 4.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 15</code></li>\n\t<li><code>s</code> contains only the characters <code>('I', 'V', 'X', 'L', 'C', 'D', 'M')</code>.</li>\n\t<li>It is <strong>guaranteed</strong> that <code>s</code> is a valid roman numeral in the range <code>[1, 3999]</code>.</li>\n</ul>\n", "hints": ["Problem is simpler to solve by working the string from back to front and using a map."]}}, {"index": 3, "category": "coding_array", "question": "[Medium] LC #47 \u00b7 Permutations II \u2014 solve on leetcode.com", "why": "Topic tags: array, backtracking, sorting. AC rate 63.4%. Open the editor at https://leetcode.com/problems/permutations-ii/, talk through your approach, then sketch the algorithm here (whiteboard) or write a plain-English solution (typed).", "how_to_prepare": "Clarify constraints, propose a brute-force, refine to an optimal time/space, walk through 2 example inputs (including an edge case), then trace your final code by hand.", "leetcode": {"title_slug": "permutations-ii", "frontend_id": "47", "difficulty": "Medium", "ac_rate": 63.442757384313076, "topics": ["array", "backtracking", "sorting"], "url": "https://leetcode.com/problems/permutations-ii/", "problem_html": "<p>Given a collection of numbers, <code>nums</code>, that might contain duplicates, return <em>all possible unique permutations <strong>in any order</strong>.</em></p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [1,1,2]\n<strong>Output:</strong>\n[[1,1,2],\n [1,2,1],\n [2,1,1]]\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [1,2,3]\n<strong>Output:</strong> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 8</code></li>\n\t<li><code>-10 <= nums[i] <= 10</code></li>\n</ul>\n", "hints": []}}, {"index": 4, "category": "coding_math", "question": "[Medium] LC #7 \u00b7 Reverse Integer \u2014 solve on leetcode.com", "why": "Topic tags: math. AC rate 31.9%. Open the editor at https://leetcode.com/problems/reverse-integer/, talk through your approach, then sketch the algorithm here (whiteboard) or write a plain-English solution (typed).", "how_to_prepare": "Clarify constraints, propose a brute-force, refine to an optimal time/space, walk through 2 example inputs (including an edge case), then trace your final code by hand.", "leetcode": {"title_slug": "reverse-integer", "frontend_id": "7", "difficulty": "Medium", "ac_rate": 31.89247723855643, "topics": ["math"], "url": "https://leetcode.com/problems/reverse-integer/", "problem_html": "<p>Given a signed 32-bit integer <code>x</code>, return <code>x</code><em> with its digits reversed</em>. If reversing <code>x</code> causes the value to go outside the signed 32-bit integer range <code>[-2<sup>31</sup>, 2<sup>31</sup> - 1]</code>, then return <code>0</code>.</p>\n\n<p><strong>Assume the environment does not allow you to store 64-bit integers (signed or unsigned).</strong></p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> x = 123\n<strong>Output:</strong> 321\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> x = -123\n<strong>Output:</strong> -321\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> x = 120\n<strong>Output:</strong> 21\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>-2<sup>31</sup> <= x <= 2<sup>31</sup> - 1</code></li>\n</ul>\n", "hints": []}}, {"index": 5, "category": "coding_array", "question": "[Medium] LC #45 \u00b7 Jump Game II \u2014 solve on leetcode.com", "why": "Topic tags: array, dynamic-programming, greedy. AC rate 42.9%. Open the editor at https://leetcode.com/problems/jump-game-ii/, talk through your approach, then sketch the algorithm here (whiteboard) or write a plain-English solution (typed).", "how_to_prepare": "Clarify constraints, propose a brute-force, refine to an optimal time/space, walk through 2 example inputs (including an edge case), then trace your final code by hand.", "leetcode": {"title_slug": "jump-game-ii", "frontend_id": "45", "difficulty": "Medium", "ac_rate": 42.87065640212856, "topics": ["array", "dynamic-programming", "greedy"], "url": "https://leetcode.com/problems/jump-game-ii/", "problem_html": "<p>You are given a <strong>0-indexed</strong> array of integers <code>nums</code> of length <code>n</code>. You are initially positioned at index 0.</p>\n\n<p>Each element <code>nums[i]</code> represents the maximum length of a forward jump from index <code>i</code>. In other words, if you are at index <code>i</code>, you can jump to any index <code>(i + j)</code> where:</p>\n\n<ul>\n\t<li><code>0 <= j <= nums[i]</code> and</li>\n\t<li><code>i + j < n</code></li>\n</ul>\n\n<p>Return <em>the minimum number of jumps to reach index </em><code>n - 1</code>. The test cases are generated such that you can reach index <code>n - 1</code>.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [2,3,1,1,4]\n<strong>Output:</strong> 2\n<strong>Explanation:</strong> The minimum number of jumps to reach the last index is 2. Jump 1 step from index 0 to 1, then 3 steps to the last index.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [2,3,0,1,4]\n<strong>Output:</strong> 2\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 10<sup>4</sup></code></li>\n\t<li><code>0 <= nums[i] <= 1000</code></li>\n\t<li>It's guaranteed that you can reach <code>nums[n - 1]</code>.</li>\n</ul>\n", "hints": []}}, {"index": 6, "category": "coding_linked_list", "question": "[Medium] LC #19 \u00b7 Remove Nth Node From End of List \u2014 solve on leetcode.com", "why": "Topic tags: linked-list, two-pointers. AC rate 51.6%. Open the editor at https://leetcode.com/problems/remove-nth-node-from-end-of-list/, talk through your approach, then sketch the algorithm here (whiteboard) or write a plain-English solution (typed).", "how_to_prepare": "Clarify constraints, propose a brute-force, refine to an optimal time/space, walk through 2 example inputs (including an edge case), then trace your final code by hand.", "leetcode": {"title_slug": "remove-nth-node-from-end-of-list", "frontend_id": "19", "difficulty": "Medium", "ac_rate": 51.57655214337792, "topics": ["linked-list", "two-pointers"], "url": "https://leetcode.com/problems/remove-nth-node-from-end-of-list/", "problem_html": "<p>Given the <code>head</code> of a linked list, remove the <code>n<sup>th</sup></code> node from the end of the list and return its head.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n<img alt=\"\" src=\"https://assets.leetcode.com/uploads/2020/10/03/remove_ex1.jpg\" style=\"width: 542px; height: 222px;\" />\n<pre>\n<strong>Input:</strong> head = [1,2,3,4,5], n = 2\n<strong>Output:</strong> [1,2,3,5]\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> head = [1], n = 1\n<strong>Output:</strong> []\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> head = [1,2], n = 1\n<strong>Output:</strong> [1]\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li>The number of nodes in the list is <code>sz</code>.</li>\n\t<li><code>1 <= sz <= 30</code></li>\n\t<li><code>0 <= Node.val <= 100</code></li>\n\t<li><code>1 <= n <= sz</code></li>\n</ul>\n\n<p> </p>\n<p><strong>Follow up:</strong> Could you do this in one pass?</p>\n", "hints": ["Maintain two pointers and update one with a delay of n steps."]}}, {"index": 7, "category": "coding_array", "question": "[Medium] LC #34 \u00b7 Find First and Last Position of Element in Sorted Array \u2014 solve on leetcode.com", "why": "Topic tags: array, binary-search. AC rate 48.9%. Open the editor at https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/, talk through your approach, then sketch the algorithm here (whiteboard) or write a plain-English solution (typed).", "how_to_prepare": "Clarify constraints, propose a brute-force, refine to an optimal time/space, walk through 2 example inputs (including an edge case), then trace your final code by hand.", "leetcode": {"title_slug": "find-first-and-last-position-of-element-in-sorted-array", "frontend_id": "34", "difficulty": "Medium", "ac_rate": 48.88231611755927, "topics": ["array", "binary-search"], "url": "https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/", "problem_html": "<p>Given an array of integers <code>nums</code> sorted in non-decreasing order, find the starting and ending position of a given <code>target</code> value.</p>\n\n<p>If <code>target</code> is not found in the array, return <code>[-1, -1]</code>.</p>\n\n<p>You must write an algorithm with <code>O(log n)</code> runtime complexity.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n<pre><strong>Input:</strong> nums = [5,7,7,8,8,10], target = 8\n<strong>Output:</strong> [3,4]\n</pre><p><strong class=\"example\">Example 2:</strong></p>\n<pre><strong>Input:</strong> nums = [5,7,7,8,8,10], target = 6\n<strong>Output:</strong> [-1,-1]\n</pre><p><strong class=\"example\">Example 3:</strong></p>\n<pre><strong>Input:</strong> nums = [], target = 0\n<strong>Output:</strong> [-1,-1]\n</pre>\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>0 <= nums.length <= 10<sup>5</sup></code></li>\n\t<li><code>-10<sup>9</sup> <= nums[i] <= 10<sup>9</sup></code></li>\n\t<li><code>nums</code> is a non-decreasing array.</li>\n\t<li><code>-10<sup>9</sup> <= target <= 10<sup>9</sup></code></li>\n</ul>\n", "hints": []}}, {"index": 8, "category": "coding_string", "question": "[Hard] LC #32 \u00b7 Longest Valid Parentheses \u2014 solve on leetcode.com", "why": "Topic tags: string, dynamic-programming, stack. AC rate 38.8%. Open the editor at https://leetcode.com/problems/longest-valid-parentheses/, talk through your approach, then sketch the algorithm here (whiteboard) or write a plain-English solution (typed).", "how_to_prepare": "Clarify constraints, propose a brute-force, refine to an optimal time/space, walk through 2 example inputs (including an edge case), then trace your final code by hand.", "leetcode": {"title_slug": "longest-valid-parentheses", "frontend_id": "32", "difficulty": "Hard", "ac_rate": 38.79922084932445, "topics": ["string", "dynamic-programming", "stack"], "url": "https://leetcode.com/problems/longest-valid-parentheses/", "problem_html": "<p>Given a string containing just the characters <code>'('</code> and <code>')'</code>, return <em>the length of the longest valid (well-formed) parentheses </em><span data-keyword=\"substring-nonempty\"><em>substring</em></span>.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "(()"\n<strong>Output:</strong> 2\n<strong>Explanation:</strong> The longest valid parentheses substring is "()".\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = ")()())"\n<strong>Output:</strong> 4\n<strong>Explanation:</strong> The longest valid parentheses substring is "()()".\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = ""\n<strong>Output:</strong> 0\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>0 <= s.length <= 3 * 10<sup>4</sup></code></li>\n\t<li><code>s[i]</code> is <code>'('</code>, or <code>')'</code>.</li>\n</ul>\n", "hints": []}}, {"index": 9, "category": "coding_array", "question": "[Hard] LC #37 \u00b7 Sudoku Solver \u2014 solve on leetcode.com", "why": "Topic tags: array, hash-table, backtracking, matrix. AC rate 65.5%. Open the editor at https://leetcode.com/problems/sudoku-solver/, talk through your approach, then sketch the algorithm here (whiteboard) or write a plain-English solution (typed).", "how_to_prepare": "Clarify constraints, propose a brute-force, refine to an optimal time/space, walk through 2 example inputs (including an edge case), then trace your final code by hand.", "leetcode": {"title_slug": "sudoku-solver", "frontend_id": "37", "difficulty": "Hard", "ac_rate": 65.47220302782839, "topics": ["array", "hash-table", "backtracking", "matrix"], "url": "https://leetcode.com/problems/sudoku-solver/", "problem_html": "<p>Write a program to solve a Sudoku puzzle by filling the empty cells.</p>\n\n<p>A sudoku solution must satisfy <strong>all of the following rules</strong>:</p>\n\n<ol>\n\t<li>Each of the digits <code>1-9</code> must occur exactly once in each row.</li>\n\t<li>Each of the digits <code>1-9</code> must occur exactly once in each column.</li>\n\t<li>Each of the digits <code>1-9</code> must occur exactly once in each of the 9 <code>3x3</code> sub-boxes of the grid.</li>\n</ol>\n\n<p>The <code>'.'</code> character indicates empty cells.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/f/ff/Sudoku-by-L2G-20050714.svg/250px-Sudoku-by-L2G-20050714.svg.png\" style=\"height:250px; width:250px\" />\n<pre>\n<strong>Input:</strong> board = [["5","3",".",".","7",".",".",".","."],["6",".",".","1","9","5",".",".","."],[".","9","8",".",".",".",".","6","."],["8",".",".",".","6",".",".",".","3"],["4",".",".","8",".","3",".",".","1"],["7",".",".",".","2",".",".",".","6"],[".","6",".",".",".",".","2","8","."],[".",".",".","4","1","9",".",".","5"],[".",".",".",".","8",".",".","7","9"]]\n<strong>Output:</strong> [["5","3","4","6","7","8","9","1","2"],["6","7","2","1","9","5","3","4","8"],["1","9","8","3","4","2","5","6","7"],["8","5","9","7","6","1","4","2","3"],["4","2","6","8","5","3","7","9","1"],["7","1","3","9","2","4","8","5","6"],["9","6","1","5","3","7","2","8","4"],["2","8","7","4","1","9","6","3","5"],["3","4","5","2","8","6","1","7","9"]]\n<strong>Explanation:</strong> The input board is shown above and the only valid solution is shown below:\n\n<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/31/Sudoku-by-L2G-20050714_solution.svg/250px-Sudoku-by-L2G-20050714_solution.svg.png\" style=\"height:250px; width:250px\" />\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>board.length == 9</code></li>\n\t<li><code>board[i].length == 9</code></li>\n\t<li><code>board[i][j]</code> is a digit or <code>'.'</code>.</li>\n\t<li>It is <strong>guaranteed</strong> that the input board has only one solution.</li>\n</ul>\n", "hints": ["For each cell, place a valid number and try solving for the remaining empty cells.", "If stuck, undo (backtrack) and try another valid number."]}}]}