You are given a 9 x 9 Sudoku board encoded as int[][] board, where 0 denotes an empty cell (instead of '.') and the integers 1 through 9 represent filled digits. Determine whether the board is valid by checking only the filled cells.
A Sudoku board is valid if:
1 to 9 (ignoring 0s)1 to 93 x 3 sub-box contains no repeated digit from 1 to 9The board does not need to be solvable. You only need to verify that the currently filled cells do not violate the rules.
Input / output
board: int[][] where board.length == 9 and board[i].length == 9boolean — true if the filled cells form a valid Sudoku state, otherwise falseboard.length == 9board[i].length == 90 <= board[i][j] <= 90 means the cell is emptyCan you solve it in a single pass over the board by tracking used digits for each row, column, and 3 x 3 box as you go?