Count all solutions in N-Queen Problem
Back Tracking
hard
Score: 70
The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return the number of distinct solutions to the n-queens puzzle.
Input Format
The first line contains an integer N, denoting the size of the board in NxN format.
Output Format
Print the number of discrete solutions to the n-queens puzzle.
Example 1:
Input:
1
Output:
1
Explanation:
For a 1x1 board, there can only be one queen.
Example 2:
Input:
10
Output:
724
Explanation:
For a 10x10 board there can be 724 distinct solutions.
Constraints:
- 1 <= n <= 15