Pseudocode for N-Queens
repeat these steps
- if there are no conflicts with the queens...
- else if there is a conflict and there is room to shift the current queen rightward...
- else if there is a conflict and there is no room to shift the current queen rightward...
Keep popping the stack, and reducing filled
by 1, until you reach a row where the queen
can be shifted rightward. Shift this queen right.