Valid Sudoku

Determine if a 9 x 9 Sudoku board is valid. A valid Sudoku board requires each row, column, and 3 x 3 sub-boxes to contain the digits 1-9 without repetition. Only filled cells need validation according to these rules. A board could be valid as a partial completion, but not necessarily solvable.

Constraints

  • board.length == 9
  • board[i].length == 9
  • board[i][j] is a digit '1-9' or '.'
Saving… · 2 lines
class Solution:
def isValidSudoku(self, board: List[List[str]]) -> bool:
Console

Click Run to execute sample tests.