Idea with Pic (no code)

  • 0


    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..

  • 0

    No pic? Was really looking forward to see the pic and understand it.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.