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.

Access this course and 1400+ top-rated courses and projects.