~/boss / eight-queens

Backtracking

The Eight Queens

No queen may attack another. Place them row by row, and back up when you hit a dead end.

Loading the fight…

How to beat it

One queen per row, top to bottom. Try the columns left to right and put her on the first square no queen attacks. Every square attacked? Dead end: pick up the queen in the row above and move her right.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/n-queens there. Sign in with your email to keep your progress on every device.

More bosses

esc