Trapping Rain Water

Input: height = [0,1,0,2,1,0,1,3,2,1,2,1]
Output: 6
Explanation: The above elevation map (black section) is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped.
Input: height = [4,2,0,3,2,5]
Output: 9

--

--

--

Actuary | ML Practitioner | Apply Tomorrow's Technology to Solve Today's Problems

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Decision Tree Regression and it’s Mathematical Implementation

How Many Moves Does It Take To Solve the Tower of Hanoi?

Deep Appreciation At Second Sight

Solving Sudoku Using Quantum Computing

Rotating the Graph of a Function

Geometric Distribution

The Epiphanies of Mathematics

Mathematics: Behind the Signs and Symbols

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Yaokun Lin @ MachineLearningQuickNotes

Yaokun Lin @ MachineLearningQuickNotes

Actuary | ML Practitioner | Apply Tomorrow's Technology to Solve Today's Problems

More from Medium

What are ACID Operations?

Big Data: But how big?

Big Data Scientist

Big Data Provenance: What are its Challenges?

Big Data Provenance: What are its Challenges?

Building a customized Spark metrics collection tool for a global enterprise technology provider