Ever wondered how those classic number puzzle games validate their boards? Welcome to the world of Sudoku validation!
You're given a 9 ร 9 Sudoku board that may be partially filled. Your mission is to determine whether the current state follows all Sudoku rules - but here's the catch: you only need to validate the filled cells, not solve the entire puzzle.
The Three Sacred Rules of Sudoku:
- ๐ด Each row must contain digits 1-9 without repetition
- ๐ต Each column must contain digits 1-9 without repetition
- ๐ข Each 3ร3 sub-box must contain digits 1-9 without repetition
Empty cells are represented by '.' and should be ignored during validation. A valid board doesn't need to be solvable - it just needs to follow the rules for existing numbers.
Input: A 9ร9 matrix representing the Sudoku board
Output: true if valid, false if any rule is violated
Input & Output
Constraints
-
board.length == 9 -
board[i].length == 9 -
board[i][j]is a digit1-9or'.' - Only filled cells need to be validated