Problem 3061 · Hard

Calculate Trapping Rain Water

The Heights table lists one-unit-wide bars in id order. Write a query returning total_trapped_water, the units of rain that stay pooled between the bars.

Open the interactive visualisation