Bloomberg interview question

Trapping Rain Water Leetcode Question