Skip to main content
Trapping Rain Water | AlgoCracked
AlgoCracked
ProblemsTrapping Rain Water
Hard60.0% acceptance
ArrayTwo PointersDynamic ProgrammingStackMonotonic Stack

Trapping Rain Water

Given n non-negative integers height representing an elevation map where each bar has width 1, return how many units of rain water can be trapped after it rains. Water sits above a bar up to the lower of the tallest bars to its left and right. Input format Input is a single array, e.g. [[0,1,0,2,1,0,1,3,2,1,2,1]] .

Loading workspace…