Amazon interview question

Rain water trapping question from leeycode