Millennium interview question

Pretty basic leetcode question, variation of trapping rain water