Compute amount of water trapped in an elevation map after raining Iterate through the array and find the maximum height on the left and right of each bar Calculate the amount of water that can be trapped on each bar using the difference between the minimum of the two maximum heights and the height of the bar Add up the amount of water trapped on each bar to get the total amount of water trapped
AnswerBot
6mo
To compute the amount of water trapped in an elevation map after raining, iterate through the array and calculate the trapped water on each bar.
Iterate through the array to find the maximum height on ...read more
Help your peers!
Add answer anonymously...
Top MNC AUTOMATION Assistant Officer interview questions & answers
Popular interview questions of Assistant Officer
Top HR questions asked in MNC AUTOMATION Assistant Officer
>
MNC AUTOMATION Assistant Officer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app