algorythms
Backtracking
LC #37Hard

Sudoku Solver

Backtracking
AmazonGoogleMeta

Problem

Solve a Sudoku puzzle by filling in the empty cells.

backtrackingmatrix

Constraints

  • board.length == 9, board[i].length == 9
  • board[i][j] is a digit 1–9 or '.'
  • Exactly one valid solution guaranteed

Example

Input9×9 board with some cells filled (see LeetCode)
OutputBoard with all cells filled correctly
Why

Each row, column, and 3×3 sub-box must contain 1–9 exactly once

Hints — reveal one at a time