Skip to content

Container with most water ​

Container with most water — LeetCode

Given heights of vertical lines, pick two that together with the x-axis hold the most water.

Approach ​

Two pointers. Find area, Whichever height is smaller, move the pointer.

Remarks ​