Pergunta de entrevista da empresa Goldman Sachs

Trapping rainwater. Leetcode hard question