Container With Most WaterMedium

array two pointers greedy

Pick two vertical lines that, with the x-axis, form a container holding the most water: area = min(height[l], height[r]) × (r − l). Two approaches, same problem — switch between them and watch how time trades off.

Press play to watch the algorithm run.
Metrics
Legend
How it works
0 / 0