Navan Interview Question

Rain water trapping problem on leetcode