Problem
Place n queens on an n by n chessboard so that no two queens attack each other (no shared row, column or diagonal). Return every distinct board, in any order. Each board is a list of n strings, one per row, with "Q" for a queen and "." for an empty square.
Example 1
- Input
- n = 4
- Output
- [[".Q..",
Example 2
"...Q",
Example 3
"Q...",
Example 4
"..Q."],
Example 5
["..Q.",
Example 6
"Q...",
Example 7
"...Q",
Example 8
".Q.."]]
Example 9
- Input
- n = 1
- Output
- [["Q"]]
Constraints
1 <= n <= 9