LeetCode 11. Container With Most Water

Last updated

Last updated
class Solution(object):
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
left, right = 0, len(height)-1
max_area = 0
while left < right:
hight = min(height[left], height[right])
max_area = max(max_area, hight*(right - left))
if height[left] < height[right]:
left += 1
else:
right -= 1
return max_area