LeetCode 51 N-Queens - Why Naive Fails

The trap

Try all ways to place nn queens on n2n^2 cells. That's (n2n)\binom{n^2}{n} combinations.

For n=8n = 8, that's over 4 billion combinations. Most violate the constraint immediately.

Can you prune invalid placements early?