public boolean isValidSudoku(char[][] board) {
        for (int i = 0; i < 9; i++) {
            boolean[] pos1 = new boolean[board.length];
            boolean[] pos2 = new boolean[board.length];
            for (int j = 0; j < 9; j++) {
                char c1 = board[i][j];
                char c2 = board[j][i];
                if (!isValid(c1, pos1) || !isValid(c2, pos2)) {
                    return false;
                }
            }
        }

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                boolean[] pos = new boolean[board.length];
                for (int u = i * 3; u < i * 3 + 3; u++) {
                    for (int v = j * 3; v < j * 3 + 3; v++) {
                        char c = board[u][v];
                        if (!isValid(c, pos)) {
                            return false;
                        }
                    }
                }
            }
        }
        return true;
    }