#暴力求解
'''
class Solution:
def maxArea(self, height: List[int]) -> int:
maxvol=0
n=len(height)
for i in range(n-1):
for j in range(i+1,n):
vol=(j-i)*min(height[i],height[j])
maxvol=max(maxvol,vol)
return maxvol
'''
#两个指针
class Solution:
def maxArea(self, height: List[int]) -> int:
left,right=0,len(height)-1
maxvol=0
while left < right:
vol=(right-left)*min(height[left],height[right])
maxvol=max(maxvol,vol)
if height[left]<height[right]:
left+=1
else:
right+=-1
return maxvol