Problem 42 · Hard

Trapping Rain Water

Work out how much rain water the bars of an elevation map can hold after rain. The visual raises a water level from the left and right sides and shows the water trapped above each bar.

Open the interactive visualisation