Given an array heights of non-negative integers where each value is the height of a column of width 1, return the total amount of rainwater trapped between the columns after it rains. The ground to the left and right of the array is at height 0.
Input
heights: a list of non-negative integers, the column heights from left to right
Output
An integer: the total units of rainwater trapped
Examples
####Example 1:
Input: heights = [1, 2, 3, 4, 5]
Output: 0
Explanation: The columns only ascend, so any water spills off the right side, nothing is trapped.
####Example 2:
Input: heights = [3, 1, 4, 1, 5, 9]
Output: 5
Explanation: Water pools in the dips, bounded by the tallest wall on each side. Above index 1 (height 1) the left wall is 3 and taller walls sit to the right, so it holds 3 - 1 = 2. Above index 3 (height 1) the left wall is 4, so it holds 4 - 1 = 3. Total = 2 + 3 = 5.
####Example 3:
Input: heights = [10, 20]
Output: 0
Explanation: Two ascending columns with no dip between walls, nothing is trapped.