Container Water · Trapping Rain Water · Largest Rectangle

Side-by-side algorithm visualization — notice the structural differences

400ms
Water / Area
Active Pointers
Stack Elements
Max Rectangle
Bars / Walls
Container With Most Water Area: 0
Thin walls with space between — water fills the gap. Find the biggest container.
Trapping Rain Water Water: 0
Buildings touching — no gaps. Water trapped on top of each building between taller ones.
Largest Rectangle in Histogram Area: 0
Bars touching — no gaps. Extend each bar left/right to find the largest rectangle.