Sudoku Solver (Backtracking)

Problem Write a program that solves a 9×9 Sudoku puzzle by filling the empty cells. A completed grid must satisfy the standard Sudoku rules: every row, every column, and each of the nine 3×3 sub-boxes contains the digits 1–9 exactly once.

Input / Output

  • Input: a 9×9 grid where filled cells hold digits '1'–'9' and empty cells are marked with '.' (or 0).
  • Output: the same grid with every empty cell filled so all Sudoku constraints hold.

Constraints

  • The board is exactly 9×9.
  • The given puzzle is valid and has at least one solution (classic puzzles have a unique solution).
  • The solution should modify the board in place.

Example

  • A partially filled board with 30–40 clues is completed so that no digit repeats in any row, column, or 3×3 box.
added …
LeaderboardSalaryAccount