Back to Browse

CODING INTERVIEW PROBLEM - TRAPPING RAIN WATER (LeetCode 42)

104 views
Feb 23, 2020
11:02

Link to problem: https://leetcode.com/problems/trapping-rain-water/ Intuition: The water can only fill up the *lowest* edge before it flows over the edge. Therefore the height of the water at a given spot is the minimum of the largest edge to the left and the largest edge to the right; subtract the height of the ground from this. To build the largest edges arrays we pass over the array in both directions keeping track of the max value seen so far. SOCIAL ---------------------------------------------------------------------------------------------------------------- Patreon: https://www.patreon.com/joshribakoff Instagram: https://www.instagram.com/joshribakoff/ Twitter: https://twitter.com/joshribakoff Github: https://github.com/joshribakoff LinkedIn: https://www.linkedin.com/in/josh-riba...

Download

1 formats

Video Formats

360pmp419.4 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

CODING INTERVIEW PROBLEM - TRAPPING RAIN WATER (LeetCode 42) | NatokHD