PythiloHard · 40 min · Task 85 of 100 · progress kept in this browser

Trap rain water

Return the volume of water trapped between nonnegative unit-width bars. Empty input returns zero. Use constant auxiliary space.

left_wall, right_wall, height = 3, 5, 1
print(max(0, min(left_wall, right_wall)-height))
Your task

Return the volume of water trapped between nonnegative unit-width bars. Empty input returns zero. Use constant auxiliary space.