Given a sequence of non-negative integers representing the heights of bars in an elevation map, the goal is to determine the amount of rainwater that can be trapped between the bars after rain.
Constraints:
n==heights.length
0≤heights[i]≤10 ...
⋮
Tap here to switch tabs
Problem
Ask
Submissions
Solution
Solution: Trapping Rain Water
Statement▼
Given a sequence of non-negative integers representing the heights of bars in an elevation map, the goal is to determine the amount of rainwater that can be trapped between the bars after rain.