The n-queens puzzle places n queens on an n × n board so that no two attack each other.
n
n × n
Return the number of distinct solutions.
n = 1
1
n = 4
2
1 <= n <= 9
Topics
Implement totalNQueens in the editor and return the answer — printing it is never graded.
totalNQueens
Problem 107 of 1146 in the arena