← All problems
Container With Most Water
Given heights, find two lines forming the container holding the most water.
Complexity
Time O(n), Space O(1)
Common pitfalls
- Moving the taller pointer (loses the proof)
- Forgetting width shrinks each step
Your solution
Log in to save your code and track progress.