DIY: Trapping Rainwater

Solve the interview question "Trapping Rainwater" in this lesson.

Problem statement

We have n non-negative integers representing an elevation map where the width of each bar is 1. Compute how much water it can trap after raining.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.