Dataminr interview question

Trapping rainwater question from leetcode.