ASAPUtils Logo ASAPUtils
Week 1

Trapping Rain Water

Trapping Rain Water built up from brute force through prefix arrays to the O(1) space two-pointer solution, with C++ and JavaScript code and a visualizer that fills the water in as it runs.

The problem

Given an array where each entry is the height of a bar of width 1, compute how much rain water is trapped between the bars after it rains.

height = [0,1,0,2,1,0,1,3,2,1,2,1] -> 6

Related Problems