(int[][] board, int n, List<List<String>> ans)
| 29 | } |
| 30 | |
| 31 | public void addSol(int[][] board, int n, List<List<String>> ans) { |
| 32 | List<String> arr = new ArrayList<>(); |
| 33 | for (int i = 0; i < n; i++) { |
| 34 | StringBuilder str = new StringBuilder(); |
| 35 | for (int j = 0; j < n; j++) { |
| 36 | if (board[i][j] == 1) |
| 37 | str.append('Q'); |
| 38 | else |
| 39 | str.append('.'); |
| 40 | } |
| 41 | arr.add(str.toString()); |
| 42 | } |
| 43 | ans.add(arr); |
| 44 | } |
| 45 | |
| 46 | public void solve(int[][] board, int n, int col, List<String> v, List<List<String>> ans) { |
| 47 | if (col == n) { |