29. Trapping Rain Water
Given bar heights, compute how much rain water can be trapped.
範例 1:
輸入: height = [0,1,0,2,1,0,1,3,2,1,2,1] 輸出: 6
範例 2:
輸入: height = [4,2,0,3,2,5] 輸出: 9
限制條件:
0 <= height.length <= 2 * 10^4
Given bar heights, compute how much rain water can be trapped.
輸入: height = [0,1,0,2,1,0,1,3,2,1,2,1] 輸出: 6
輸入: height = [4,2,0,3,2,5] 輸出: 9
0 <= height.length <= 2 * 10^4