Valid Sudoku

Medium · Hashing · about 15 minutes

Asked at Apple, Amazon, Bloomberg, Meta, Microsoft, Google, Uber.

Check a 9 × 9 Sudoku grid that is only partly filled in. Ignore the blanks and confirm that no digit from 1 to 9 repeats

  • within any row,
  • within any column, or
  • within any of the nine 3 × 3 boxes.

Each row of the grid arrives as a 9-character string, and '.' marks a blank. The grid only has to obey these rules; it does not have to be solvable.

Related guides