Container with most water
Two walls hold the most water: move the shorter one inward, never the taller.
Values1, 8, 6, 2, 5, 4, 8, 3, 7
Each value is a wall's height. Start with the widest container: walls at 0 and 8.
- compare
- swap or write
- settled
Space play · ← → step · Home End jump · drag the strip to scrub