N-Queens
Recognize the pattern
Brute force idea
If you approach N-Queens in the most literal way possible, you get this: Try all n^n placements — exponential. Most are invalid. It is a fair place to begin because it matches the surface of the question, yet it does not capture the deeper structure that makes the problem simpler.
Better approach
The deeper shift in N-Queens is this: Backtracking row by row: place one queen per row, check column and diagonal conflicts. Use sets for conflict checking. Prune invalid branches early. Once you hold onto the right piece of information from moment to moment, the problem feels less like trial and error and more like following a shape that was there all along.
Key invariant
At the center of N-Queens is one steady idea: One queen per row (since queens attack entire rows). For each row, try each column — check three constraints: column not used, positive diagonal not used, negative diagonal not used. When you keep that truth intact, each local choice supports the larger solution instead of fighting it.
Watch out for
One easy way to drift off course in N-Queens is this: Not tracking diagonals efficiently — use (row-col) for one diagonal direction and (row+col) for the other. Sets of these values give conflict detection. The fix is usually to return to the meaning of each move, not just the steps themselves.