Log in
← All problems

Rain water between walls

hardProblem solving40 XP

heights are the heights of walls of width 1, side by side. After rain, how many units of water are trapped between them? Water above a wall rises to the lower of the tallest walls on its left and right.

Examples

Examples use JSON: true/false/null are True/False/None in Python.

Run examples checks the examples above. Submit also runs 4 hidden tests.