Description
The n-queens puzzle is the problem of placing n queens on an n×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.
Example:
1 | Input: 4 |
Difficulty: Hard
Code:
1 | class Solution { |
题意
N皇后问题,将n个皇后放在nxn的棋盘上,保证任意两个皇后不能相互攻击。
给定正整数n,求不重复的N皇后问题答案的个数。