Count Nonattacking Queen Configurations
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: hard
Interview Round: Other
### Problem
Count the distinct ways to put `n` queens on an `n` by `n` chessboard with no two in a common row, column, or diagonal. Return the integer count rather than the boards themselves. Configurations with different queen positions are distinct, including different rotations or reflections.
```cpp
int totalNQueens(int n);
```
### Examples
```text
Input: n = 3
Output: 0
```
```text
Input: n = 5
Output: 10
```
### Constraints
- `1 <= n <= 9`.
- A valid configuration contains exactly `n` queens.
- Count board configurations, without identifying different symmetric boards as one.
Overview: Count all distinct nonattacking n-queen configurations without returning board layouts or merging symmetric placements.