#52
N-Queens II
specialist · 895 · lc hard +31 · verified · 78.2% accepted · 4,258 likes · top 89%
Description
Return the total number of distinct arrangements for placing n non-attacking queens on an n x n chessboard.
Example 1:
Input: n = 4
Output: 2
Explanation: There are two distinct solutions to the 4-queens puzzle as shown.
Example 2:
Input: n = 1
Output: 1
Code
1
2
3