Sudoku validity
Your task
Given a 9x9 Sudoku board where '.' marks an empty cell, determine whether the currently filled cells are valid: no row, column, or 3x3 box contains a repeated digit '1'-'9'. You only validate the partial state; you do not solve it. Return True if valid, else False.
Examples
is_valid_sudoku(board: list[list[str]]) -> boolExample 1
Input
is_valid_sudoku([["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"]])Output
True