Cisco interview question

Trapping Rain Water Problem as seen on leet code.