Goldman Sachs interview question

Answer the classic trapping rainwater leetcode question