Amazon Interview Question

Trapping Rain Water from leetcode was asked