35. Container With Most Water
MediumTwo pointers
height[i] is the height of a vertical line at position i. Pick two lines that, with the x-axis, hold the most water. Return that maximum area (width × the shorter height).
Example 1
Input: height = [1, 8, 6, 2, 5, 4, 8, 3, 7] Output: 49
Constraints
2 ≤ height.length ≤ 10⁵