Search
⌘K
Get Premium
Leetcode 11. Container With Most Water
Given heights of vertical lines at unit-spaced x-coordinates, pick two indices i<j to maximize the area min(height[i],height[j])*(j-i). With n up to 1e5, the problem requires a linear-time two-pointer/greedy approach instead of brute-force O(n^2).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.