Solution: Trapping Rain Water
Let's solve the Trapping Rain Water problem using the Two Pointers pattern.
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.
Constraints:
heights.length
heights[i]
...