I found this idea could be the same as the highest votee. Just explain by picture. Which would be easier to understand, I guess.
The idea is: Scan from left most to the peak (highest point), update the water level (blue line) if current height is higher that water level, or accumulate water with the difference between water level and current height.
And do the same from right most.
Hope I explained well..