~/boss / the-storm
Two pointers (trapping rain water)
The Flood
Rain falls on a row of pillars. Measure every drop that stays.
Loading the fight…
How to beat it
Each column holds water up to the shorter of the tallest walls on its left and right, minus its own height. Put a pointer at each end and always settle the side with the shorter pillar: a wall at least that tall stands across from it, so its level is already decided.
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/trapping-rain-water there. Sign in with your email to keep your progress on every device.