~/boss / strongest-first

Heap (priority queue)

The Boss Queue

Always fight the strongest monster first. Keep the pyramid in order, one swap at a time.

Loading the fight…

How to beat it

Every monster beats the two below it, so the king on top is the strongest. Fight it, and the last monster jumps to the top and sinks, swapping with its stronger child. A newcomer joins at the bottom and climbs while it beats its parent.

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/smash-the-two-heaviest-rocks there. Sign in with your email to keep your progress on every device.

More bosses

esc