36. Valid Sudoku
Practice Valid Sudoku for free on NudgeCode: Medium, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
board is a partly filled 9 x 9 Sudoku grid; empty cells are ".". Return true if no digit repeats within any row, any column, or any of the nine 3 x 3 boxes. Only the filled cells matter: you don't need to check whether the puzzle can be solved.
Example
board = [["5","3",".",".","7",".",".",".","."],
["6",".",".","1","9","5",".",".","."],
[".","9","8",".",".",".",".","6","."],
["8",".",".",".","6",".",".",".","3"],
["4",".",".","8",".","3",".",".","1"],
["7",".",".",".","2",".",".",".","6"],
[".","6",".",".",".",".","2","8","."],
[".",".",".","4","1","9",".",".","5"],
[".",".",".",".","8",".",".","7","9"]]
-> true
Change the top-left "5" to "8" and column 0 has two "8"s -> false
Constraints
boardis 9 x 9- board[i][j] is a digit
"1"-"9"or"."