← 返回 goldmansachs 的题目列表Trapping Rain Water
类型:online_judge
Given an array representing elevation map where the width of each bar is 1, compute how much water it can trap after raining. The input is a list of non-negative integers, and the output is a single integer representing the total amount of trapped water.
Example
Input: [0,1,0,2,1,0,1,3,2,1,2,1]
Output: 6
Constraints
The array length is in the range [1, 100000].
Each element is in the range [0, 100000].
Example
Input
0,1,0,2,1,0,1,3,2,1,2,1