Sudoku Solver

Try to solve the Sudoku Solver problem.

Statement

Given a 9 x 9 sudoku board, solve the puzzle by completing the empty cells. The sudoku board is only considered valid if the rules below are satisfied:

  • Each row must contain digits between 1–9, and there should be no repetition of digits within a row.

  • Each column must contain digits between 1–9, and there should be no repetition of digits within a column.

  • The board consists of 9 non-overlapping sub-boxes, each containing 3 rows and 3 columns. Each of these 3 x 3 sub-boxes must contain digits between 1–9, and there should be no repetition of digits within a sub-box.

Constraints:

  • board.length =9= 9
  • board[i].length =9= 9
  • board[i][j] is a digit or ..
  • The input board is guaranteed to have one solution.

Example

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy