height[i] is the height of a vertical line at x-coordinate i. Two lines together with the x-axis form a container.
height[i]
i
Return the maximum amount of water such a container can hold.
height = [1,8,6,2,5,4,8,3,7]
49
height = [1,1]
1
n == height.length 2 <= n <= 10^5 0 <= height[i] <= 10^4
Topics
Implement maxArea in the editor and return the answer — printing it is never graded.
maxArea
Problem 76 of 1146 in the arena