bp interview question

Trapping rain water from leetcode.