Array
42. Trapping Rain Water
The water sitting above column i is pinned by the shorter of the two tallest walls flanking it: water[i] = min(maxLeft[i], maxRight[i]) − height[i], when that's positive. So precompute, for every…
Loading…
The water sitting above column i is pinned by the shorter of the two tallest walls flanking it: water[i] = min(maxLeft[i], maxRight[i]) − height[i], when that's positive. So precompute, for every…
Loading…