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.
Click Run to execute sample tests.