classSolution:defmaxArea(self, height: List[int])->int:# 对撞双指针# 对比记录最大面积,并移动短板,重新计算;
left, right =0,len(height)-1
res =-1while left < right :
temp =min(height[left],height[right])*(right - left)
res =max(temp,res)if height[left]< height[right]:
left+=1else:
right-=1return res