public boolean isValidSudoku(char[][] board) {
        if (board == null || board.length != 9) {
            return false;
        }
        boolean check[] = new boolean[9];
        for (int i = 0; i < 9; i ++) {
            Arrays.fill(check, false); // check row
            for (int j = 0; j < 9; j ++) {
                if (!check(check, board[i][j])) {
                    return false;
                }
            }
            Arrays.fill(check, false); // check column
            for (int j = 0; j < 9; j ++) {
                if (!check(check, board[j][i])) {
                    return false;
                }
            }
            Arrays.fill(check, false); // check 3x3
            for (int j = 0; j < 9; j ++) {
                if (!check(check, board[i - i % 3 + j / 3][i * 3 % 9 + j % 3])) {
                    return false;
                }
            }
        }
        return true;
    }