Goldman Sachs Interview Question

Trapping rainwater - Leet code hard question .