Navan interview question

Rain water trapping problem on leetcode