← instacart / Principal Product Manager, Agentic Commerce
coding_drills / art_qg3hRU_xpSA
Content
{"kind": "coding_drills", "role_id": "role_avFKaCiO9Ss", "source": "leetcode_graphql", "generated_at": "2026-05-21T22:40:30.249212+00:00", "difficulty_mix": {"Easy": 3, "Medium": 5, "Hard": 2}, "topics_filter": [], "questions": [{"index": 0, "category": "coding_two_pointers", "question": "[Easy] LC #28 \u00b7 Find the Index of the First Occurrence in a String \u2014 solve on leetcode.com", "why": "Topic tags: two-pointers, string, string-matching. AC rate 46.6%. Open the editor at https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/, 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-the-index-of-the-first-occurrence-in-a-string", "frontend_id": "28", "difficulty": "Easy", "ac_rate": 46.646679248066825, "topics": ["two-pointers", "string", "string-matching"], "url": "https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/", "problem_html": "<p>Given two strings <code>needle</code> and <code>haystack</code>, return the index of the first occurrence of <code>needle</code> in <code>haystack</code>, or <code>-1</code> if <code>needle</code> is not part of <code>haystack</code>.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> haystack = "sadbutsad", needle = "sad"\n<strong>Output:</strong> 0\n<strong>Explanation:</strong> "sad" occurs at index 0 and 6.\nThe first occurrence is at index 0, so we return 0.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> haystack = "leetcode", needle = "leeto"\n<strong>Output:</strong> -1\n<strong>Explanation:</strong> "leeto" did not occur in "leetcode", so we return -1.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= haystack.length, needle.length <= 10<sup>4</sup></code></li>\n\t<li><code>haystack</code> and <code>needle</code> consist of only lowercase English characters.</li>\n</ul>\n", "hints": []}}, {"index": 1, "category": "coding_array", "question": "[Easy] LC #35 \u00b7 Search Insert Position \u2014 solve on leetcode.com", "why": "Topic tags: array, binary-search. AC rate 51.3%. Open the editor at https://leetcode.com/problems/search-insert-position/, 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": "search-insert-position", "frontend_id": "35", "difficulty": "Easy", "ac_rate": 51.25739858897139, "topics": ["array", "binary-search"], "url": "https://leetcode.com/problems/search-insert-position/", "problem_html": "<p>Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.</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\n<pre>\n<strong>Input:</strong> nums = [1,3,5,6], target = 5\n<strong>Output:</strong> 2\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [1,3,5,6], target = 2\n<strong>Output:</strong> 1\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [1,3,5,6], target = 7\n<strong>Output:</strong> 4\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>-10<sup>4</sup> <= nums[i] <= 10<sup>4</sup></code></li>\n\t<li><code>nums</code> contains <strong>distinct</strong> values sorted in <strong>ascending</strong> order.</li>\n\t<li><code>-10<sup>4</sup> <= target <= 10<sup>4</sup></code></li>\n</ul>\n", "hints": []}}, {"index": 2, "category": "coding_string", "question": "[Easy] LC #20 \u00b7 Valid Parentheses \u2014 solve on leetcode.com", "why": "Topic tags: string, stack. AC rate 44.2%. Open the editor at https://leetcode.com/problems/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": "valid-parentheses", "frontend_id": "20", "difficulty": "Easy", "ac_rate": 44.1741531650066, "topics": ["string", "stack"], "url": "https://leetcode.com/problems/valid-parentheses/", "problem_html": "<p>Given a string <code>s</code> containing just the characters <code>'('</code>, <code>')'</code>, <code>'{'</code>, <code>'}'</code>, <code>'['</code> and <code>']'</code>, determine if the input string is valid.</p>\n\n<p>An input string is valid if:</p>\n\n<ol>\n\t<li>Open brackets must be closed by the same type of brackets.</li>\n\t<li>Open brackets must be closed in the correct order.</li>\n\t<li>Every close bracket has a corresponding open bracket of the same type.</li>\n</ol>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">s = "()"</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">true</span></p>\n</div>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">s = "()[]{}"</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">true</span></p>\n</div>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">s = "(]"</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">false</span></p>\n</div>\n\n<p><strong class=\"example\">Example 4:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">s = "([])"</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">true</span></p>\n</div>\n\n<p><strong class=\"example\">Example 5:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">s = "([)]"</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">false</span></p>\n</div>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 10<sup>4</sup></code></li>\n\t<li><code>s</code> consists of parentheses only <code>'()[]{}'</code>.</li>\n</ul>\n", "hints": ["Use a stack of characters.", "When you encounter an opening bracket, push it to the top of the stack.", "When you encounter a closing bracket, check if the top of the stack was the opening for it. If yes, pop it from the stack. Otherwise, return false."]}}, {"index": 3, "category": "coding_linked_list", "question": "[Medium] LC #2 \u00b7 Add Two Numbers \u2014 solve on leetcode.com", "why": "Topic tags: linked-list, math, recursion. AC rate 48.5%. Open the editor at https://leetcode.com/problems/add-two-numbers/, 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": "add-two-numbers", "frontend_id": "2", "difficulty": "Medium", "ac_rate": 48.46758391189911, "topics": ["linked-list", "math", "recursion"], "url": "https://leetcode.com/problems/add-two-numbers/", "problem_html": "<p>You are given two <strong>non-empty</strong> linked lists representing two non-negative integers. The digits are stored in <strong>reverse order</strong>, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.</p>\n\n<p>You may assume the two numbers do not contain any leading zero, except the number 0 itself.</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/02/addtwonumber1.jpg\" style=\"width: 483px; height: 342px;\" />\n<pre>\n<strong>Input:</strong> l1 = [2,4,3], l2 = [5,6,4]\n<strong>Output:</strong> [7,0,8]\n<strong>Explanation:</strong> 342 + 465 = 807.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> l1 = [0], l2 = [0]\n<strong>Output:</strong> [0]\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]\n<strong>Output:</strong> [8,9,9,9,0,0,0,1]\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li>The number of nodes in each linked list is in the range <code>[1, 100]</code>.</li>\n\t<li><code>0 <= Node.val <= 9</code></li>\n\t<li>It is guaranteed that the list represents a number that does not have leading zeros.</li>\n</ul>\n", "hints": []}}, {"index": 4, "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": 5, "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": 6, "category": "coding_hash_table", "question": "[Medium] LC #3 \u00b7 Longest Substring Without Repeating Characters \u2014 solve on leetcode.com", "why": "Topic tags: hash-table, string, sliding-window. AC rate 39.1%. Open the editor at https://leetcode.com/problems/longest-substring-without-repeating-characters/, 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-substring-without-repeating-characters", "frontend_id": "3", "difficulty": "Medium", "ac_rate": 39.05112220358377, "topics": ["hash-table", "string", "sliding-window"], "url": "https://leetcode.com/problems/longest-substring-without-repeating-characters/", "problem_html": "<p>Given a string <code>s</code>, find the length of the <strong>longest</strong> <span data-keyword=\"substring-nonempty\"><strong>substring</strong></span> without duplicate characters.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "abcabcbb"\n<strong>Output:</strong> 3\n<strong>Explanation:</strong> The answer is "abc", with the length of 3. Note that <code>"bca"</code> and <code>"cab"</code> are also correct answers.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "bbbbb"\n<strong>Output:</strong> 1\n<strong>Explanation:</strong> The answer is "b", with the length of 1.\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> s = "pwwkew"\n<strong>Output:</strong> 3\n<strong>Explanation:</strong> The answer is "wke", with the length of 3.\nNotice that the answer must be a substring, "pwke" is a subsequence and not a substring.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>0 <= s.length <= 5 * 10<sup>4</sup></code></li>\n\t<li><code>s</code> consists of English letters, digits, symbols and spaces.</li>\n</ul>\n", "hints": ["Since maximum string size is at most 26, generate and check all possible substrings with length at most 26."]}}, {"index": 7, "category": "coding_array", "question": "[Medium] LC #11 \u00b7 Container With Most Water \u2014 solve on leetcode.com", "why": "Topic tags: array, two-pointers, greedy. AC rate 60.0%. Open the editor at https://leetcode.com/problems/container-with-most-water/, 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": "container-with-most-water", "frontend_id": "11", "difficulty": "Medium", "ac_rate": 60.02891996726984, "topics": ["array", "two-pointers", "greedy"], "url": "https://leetcode.com/problems/container-with-most-water/", "problem_html": "<p>You are given an integer array <code>height</code> of length <code>n</code>. There are <code>n</code> vertical lines drawn such that the two endpoints of the <code>i<sup>th</sup></code> line are <code>(i, 0)</code> and <code>(i, height[i])</code>.</p>\n\n<p>Find two lines that together with the x-axis form a container, such that the container contains the most water.</p>\n\n<p>Return <em>the maximum amount of water a container can store</em>.</p>\n\n<p><strong>Notice</strong> that you may not slant the container.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n<img alt=\"\" src=\"https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/17/question_11.jpg\" style=\"width: 600px; height: 287px;\" />\n<pre>\n<strong>Input:</strong> height = [1,8,6,2,5,4,8,3,7]\n<strong>Output:</strong> 49\n<strong>Explanation:</strong> The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case, the max area of water (blue section) the container can contain is 49.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> height = [1,1]\n<strong>Output:</strong> 1\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>n == height.length</code></li>\n\t<li><code>2 <= n <= 10<sup>5</sup></code></li>\n\t<li><code>0 <= height[i] <= 10<sup>4</sup></code></li>\n</ul>\n", "hints": ["If you simulate the problem, it will be O(n^2) which is not efficient.", "Try to use two-pointers. Set one pointer to the left and one to the right of the array. Always move the pointer that points to the lower line.", "How can you calculate the amount of water at each step?"]}}, {"index": 8, "category": "coding_hash_table", "question": "[Hard] LC #30 \u00b7 Substring with Concatenation of All Words \u2014 solve on leetcode.com", "why": "Topic tags: hash-table, string, sliding-window. AC rate 34.4%. Open the editor at https://leetcode.com/problems/substring-with-concatenation-of-all-words/, 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": "substring-with-concatenation-of-all-words", "frontend_id": "30", "difficulty": "Hard", "ac_rate": 34.42470954226348, "topics": ["hash-table", "string", "sliding-window"], "url": "https://leetcode.com/problems/substring-with-concatenation-of-all-words/", "problem_html": "<p>You are given a string <code>s</code> and an array of strings <code>words</code>. All the strings of <code>words</code> are of <strong>the same length</strong>.</p>\n\n<p>A <strong>concatenated string</strong> is a string that exactly contains all the strings of any permutation of <code>words</code> concatenated.</p>\n\n<ul>\n\t<li>For example, if <code>words = ["ab","cd","ef"]</code>, then <code>"abcdef"</code>, <code>"abefcd"</code>, <code>"cdabef"</code>, <code>"cdefab"</code>, <code>"efabcd"</code>, and <code>"efcdab"</code> are all concatenated strings. <code>"acdbef"</code> is not a concatenated string because it is not the concatenation of any permutation of <code>words</code>.</li>\n</ul>\n\n<p>Return an array of <em>the starting indices</em> of all the concatenated substrings in <code>s</code>. You can return the answer in <strong>any order</strong>.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">s = "barfoothefoobarman", words = ["foo","bar"]</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">[0,9]</span></p>\n\n<p><strong>Explanation:</strong></p>\n\n<p>The substring starting at 0 is <code>"barfoo"</code>. It is the concatenation of <code>["bar","foo"]</code> which is a permutation of <code>words</code>.<br />\nThe substring starting at 9 is <code>"foobar"</code>. It is the concatenation of <code>["foo","bar"]</code> which is a permutation of <code>words</code>.</p>\n</div>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">s = "wordgoodgoodgoodbestword", words = ["word","good","best","word"]</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">[]</span></p>\n\n<p><strong>Explanation:</strong></p>\n\n<p>There is no concatenated substring.</p>\n</div>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong> <span class=\"example-io\">s = "barfoofoobarthefoobarman", words = ["bar","foo","the"]</span></p>\n\n<p><strong>Output:</strong> <span class=\"example-io\">[6,9,12]</span></p>\n\n<p><strong>Explanation:</strong></p>\n\n<p>The substring starting at 6 is <code>"foobarthe"</code>. It is the concatenation of <code>["foo","bar","the"]</code>.<br />\nThe substring starting at 9 is <code>"barthefoo"</code>. It is the concatenation of <code>["bar","the","foo"]</code>.<br />\nThe substring starting at 12 is <code>"thefoobar"</code>. It is the concatenation of <code>["the","foo","bar"]</code>.</p>\n</div>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>1 <= s.length <= 10<sup>4</sup></code></li>\n\t<li><code>1 <= words.length <= 5000</code></li>\n\t<li><code>1 <= words[i].length <= 30</code></li>\n\t<li><code>s</code> and <code>words[i]</code> consist of lowercase English letters.</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."]}}]}