Amazon interview question

Trapping Rain Water from leetcode was asked