254. Sudoku Solver — Backtracking

Hard · Backtracking

Write a program to solve a Sudoku puzzle by filling the empty cells (marked as '.' in a 9×9 grid). Each row, column, and 3×3 box must contain digits 1–9 with no repetition.

Examples

Example 1
Input: 9×9 board with empty cells as "."
Output: Completed 9×9 board
Explanation: Fill all cells while satisfying constraints

Constraints