// Generate all possible solutions to the N queens problem. // The board is represented by board[1:N], which records // for each column whether there is a queen in that column, // and if so, which row it occupies. In particular, // board[j] = i if there is a queen in row i of column j // = 0 otherwise class nQueens { static int N = 8; static int solution = 0; static boolean safe(int row, int column, int board[]) { // Check whether it is safe to place a queen at row, column; // i.e., is board[column]=row a safe configuration? for (int j=1; j