N-Queens II

The n-queens puzzle is the problem of placing n queens on an n x n chessboard so that no two queens threaten each other. Given an integer n, return the total number of distinct solutions to the n-queens puzzle.

Constraints

  • 1 <= n <= 9
Saving… · 3 lines
class Solution:
def totalNQueens(self, n: int) -> int:
pass
Console

Click Run to execute sample tests.