Domanda di colloquio di Millennium

Pretty basic leetcode question, variation of trapping rain water