(int n)
| 5 | int res = 0; |
| 6 | |
| 7 | public int nQueens(int n) { |
| 8 | dfs(0, new HashSet<>(), new HashSet<>(), new HashSet<>(), n); |
| 9 | return res; |
| 10 | } |
| 11 | |
| 12 | private void dfs(int r, Set<Integer> diagonalsSet, Set<Integer> antiDiagonalsSet, Set<Integer> colsSet, int n) { |
| 13 | // Termination condition: If we have reached the end of the rows, |