26. [matrix] Sudoku Solver
Last updated
Last updated
37. Sudoku Solver
Hard
8.2K
212
Companies
Write a program to solve a Sudoku puzzle by filling the empty cells.
A sudoku solution must satisfy all of the following rules:
Each of the digits 1-9
must occur exactly once in each row.
Each of the digits 1-9
must occur exactly once in each column.
Each of the digits 1-9
must occur exactly once in each of the 9 3x3
sub-boxes of the grid.
The '.'
character indicates empty cells.
Example 1:
!
!
Constraints:
board.length == 9
board[i].length == 9
board[i][j]
is a digit or '.'
.
It is guaranteed that the input board has only one solution.