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

New Probabilistic Approach to Factoring Big Numbers

2012 India Region 6 Olympiad Problem 1

Measuring Network Centrality

Impermanent loss changes with the price(P0) of starting farming for uniswap V3

Set Theory — Functions

How to calculate the impermanent loss of 80/20 liquidy pools on balancer

Pathfinding: Dijkstra’s Algorithm

Nerdle Strategy

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

Interview With our Newest Part-Timer

Applying PC and DirectLiNGAM for Causal Discovery

Why do different classification matrixes exist: Confusion Matrix, Precision, Recall, and F1 Score