public class Solution {
    
    public void solveSudoku(char[][] board) {
        process(board);
    }

    public boolean isValid(char[][] board, int row, int column, char k) {
        for (int i = 0; i < 9; i++) {
            if (board[i][column] == k) return false;
            if (board[row][i] == k) return false;
            if (board[3 * (row / 3) + i / 3][3 * (column / 3) + i % 3] == k) return false;
        }
        return true;
    }

    public boolean process(char[][] board) {
        for (int i = 0; i < 9; i++) {
            for (int j = 0; j < 9; j++) {
                if (board[i][j] == '.') {
                    for (char k = '1'; k <= '9'; k++) {
                        if (isValid(board, i, j, k)) {
                            board[i][j] = k;
                            if (process(board)) {
                                return true;
                            }
                            board[i][j] = '.';
                        }
                    }
                    return false;
                }
            }
        }
        return true;
    }
    
}