~/boss / treasure-corridor

Kadane's algorithm

The Treasure Corridor

One walk through gold and traps. Hold the richest bag you can.

Loading the fight…

How to beat it

Carry a running total. Gold adds, traps subtract. If the total drops below zero, drop it and start fresh at the next room. Keep the best total you've seen.

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/maximum-subarray there. Sign in with GitHub to keep your progress on every device.

More bosses

esc