Skip to content

AshishNikam111000/Trapping-Rain-Water

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Trapping-Rain-Water

Graphical representation of "Trapping rain water" problem using vanilla HTML/CSS/Javascript. Go to Website

Problem Statement -

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.

Examples 1:

Input: arr[ ] = {2, 0, 2}
Output: 2 Units
Explanation: The structure is like below

Untitled-Diagram711

We can trap 2 units of water in the middle gap.

Examples 2:

Input: arr[ ] = {3, 0, 2, 0, 4}
Output: 7 Units
Explanation: The structure is like below

Untitled-Diagram811

We can trap "3 units" of water between 3 and 2, "1 unit" on top of bar 2 and "3 units" between 2 and 4.

Languages and Tools:

Visual Studio Code HTML5 CSS3 JavaScript GitHub

About

Graphical representation of "Trapping rain water" problem.

Topics

Resources

Stars

Watchers

Forks