Dodomeki
Sign in

115. Count Queen Placements

Hard

On an n by n board, count how many ways there are to place n queens so that no two share a row, column, or diagonal. Return only the count. For n = 0, there is one configuration: the empty board.

Example 1
Input: n = 4
Output: 2
Example 2
Input: n = 1
Output: 1
Constraints
  • 0 <= n <= 12
BacktrackingRecursion
Caso 1
n =
4
Expected =
2
Caso 2
n =
1
Expected =
1

Run checks these 2 cases. Submit runs all 6, including hidden ones.