akshitagit / CPP

Repository for C++/C codes and algos.
https://github.com/akshitagupta15june
MIT License
483 stars 430 forks source link

RAIN WATER SAVING-INTERVIEW QUESTION (FAANG) #137

Open akshitagupta15june opened 3 years ago

akshitagupta15june commented 3 years ago

AKSHITA has created an elevated roof. She wants to know how much water can she save during rain.

Given n non negative integers representing the elevation map where width of every bar is 1, Find the maximum water that she can save.

Explanation for the Sample input Testcase: image

Elevation Map Input Format

First line contains an integer n. Second line contains n space separated integers representing the elevation map. Constraints

1 <= N <= 10^6 Output Format

Print a single integer containing the maximum unit of waters she can save. Sample Input

10 0 2 1 3 0 1 2 1 2 1

Sample Output

5

akshitagupta15june commented 3 years ago

ADD CODE IN INTERVIEWQUESTIONS REPO

Maitryee-Choudhary commented 3 years ago

I would like to work on this.Can you assign to me?

akshitagupta15june commented 3 years ago

Ok assigning to u

Maitryee-Choudhary commented 3 years ago

Thank you! I will submit my PR on 1st October

kritika122000 commented 3 years ago

can you please assign me