// 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 numSolutions = 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; jjavac nque.java D:\>java nQueens nQueens loaded nQueens: N=8 nQueens: numSolutions=92 nQueens done D:\>java nQueens 10 nQueens loaded nQueens: N=10 nQueens: numSolutions=724 nQueens done ... end of example run(s) */