Sudoku Solver | Backtracking (opens in new tab)
leetcode.com Problem Statement Given a partially filled Sudoku board, fill all empty cells so that: Every row contains digits 1-9 Every column contains digits 1-9 Every 3×3 box contains digits 1-9 Return the solved board. Brute Force Intuition For every empty cell: Try digits 1 to 9 After filling the board: Check if Sudoku is valid This leads to enormous possibilities. Moving Towards the Optimal Approach Instead of filling everything first: For every empty cell: Try digits 1 to 9 Immediately ...
Read the original article