Container With Most Water
You are given a list height where height[i] is the height of a vertical line at position
i. Pick two lines that, with the x-axis, form a container. Return the maximum water it
can hold — the area is width * min(two heights).
Examples
Input: [1,8,6,2,5,4,8,3,7]
Output: 49 # lines at index 1 (h=8) and index 8 (h=7): width 7 * min(8,7) = 49
Input: [1,1]
Output: 1
Constraints
2 <= len(height) <= 10^50 <= height[i] <= 10^4
Solution
Full worked solution, code, and complexity analysis available in the interactive view.