Illustration of the 'Container With Most Water' problem showing vertical bars and the maximum water area highlighted

Find the container with most water (Blind 75) — O(n) Solution

Problem Overview We are given an array heights of size n. The value at each index represents the height of a vertical bar. We need to find two bars such that together they can hold the maximum amount of water. Note: We are not allowed to slant the container. LeetCode - Container With Most Water Example Input: height = [1,8,6,2,5,4,8,3,7] Output: 49 ...

February 17, 2026 · 2 min · 386 words · Hitesh Patel