~/boss / dragon-hoards

Dynamic programming

The Dragon Hoards

Rob two neighbors and the alarm goes off. Take the most gold you can.

Loading the fight…

How to beat it

Walk left to right and write down the best haul so far at each hoard. Skip it: keep the last best. Rob it: its gold plus the best from two hoards back. The bigger one wins, and you only ever need the last two numbers.

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/house-robber there. Sign in with your email to keep your progress on every device.

More bosses

esc