(int row, Integer[] columns, ArrayList<Integer[]> results)
| 33 | } |
| 34 | |
| 35 | public static void placeQueens(int row, Integer[] columns, ArrayList<Integer[]> results) { |
| 36 | if (row == GRID_SIZE) { // Found valid placement |
| 37 | results.add(columns.clone()); |
| 38 | } else { |
| 39 | for (int col = 0; col < GRID_SIZE; col++) { |
| 40 | if (checkValid(columns, row, col)) { |
| 41 | columns[row] = col; // Place queen |
| 42 | placeQueens(row + 1, columns, results); |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | public static void clear(Integer[] columns) { |
| 49 | for (int i = 0; i < GRID_SIZE; i++) { |
no test coverage detected