Valid Sudoku

Medium
ArrayMatrixHash TableAmazonUber
Determine whether a 9 x 9 Sudoku board is valid. Only the filled cells must be checked: each row, each column, and each of the nine 3 x 3 sub-boxes must contain no repeated digit. The board may be incomplete. Input format: - 9 lines, each with 9 characters. A digit `1`-`9` is a filled cell and `.` is empty. Print `true` or `false`.

Constraints

The board is always 9 x 9.
Each cell is a digit 1-9 or the character `.`.

Sample tests

Sample 1

Sample 2

Sign in to submit