Given bar heights, how much rain water is trapped between them? Water above a bar is limited by the shorter of the tallest bars to its left and right.
Implement trapped_water(heights) in time and extra space, using two pointers that move inward from both ends and track the running maximum on each side.