Dataminr Interview Question

Trapping rainwater question from leetcode.