Check if a 9 x 9 Sudoku board is valid. Only the filled
cells need to follow these rules:
1. Each row must contain digits 1-9 without duplicates.
2. Each column must contain digits 1-9 without duplicates.
3. Each 3 x 3 sub-grid must contain digits 1-9 without duplicates.
Note: The board may be partially filled. You only need to check for validity,
not solve the puzzle.
Input: board = [ ["6","1",".",".","7",".",".",".","."], ["2",".",".","8","4","9",".",".","."], [".","5","3",".",".",".",".","2","."], [".",".",".",".","6",".",".",".","1"], ["3",".",".","2",".","7",".",".","5"], [".",".",".",".","9",".",".",".","4"], [".","2",".",".",".",".","5","3","."], [".",".",".","6","1","8",".",".","2"], [".",".",".",".","5",".",".","7","6"] ]
Output: true
Input: board = [ ["7","1",".",".","7",".",".",".","."], ["2",".",".","8","4","9",".",".","."], [".","5","3",".",".",".",".","2","."], [".",".",".",".","6",".",".",".","1"], ["3",".",".","2",".","7",".",".","5"], [".",".",".",".","9",".",".",".","4"], [".","2",".",".",".",".","5","3","."], [".",".",".","6","1","8",".",".","2"], [".",".",".",".","5",".",".","7","6"] ]
Output: false
Accepted:
Submission: