Container With Most Water
Screen Shot 2019-01-06 at 10.42.23 PM.png
Screen Shot 2019-01-06 at 10.42.29 PM.png
答案:
class Solution:
def maxArea(self, height):
"""
:type height: List[int]
:rtype: int
"""
min_,max_= 0,len(height)-1
areas = 0
while min_ != max_:
if height[min_] < height[max_]:
areas = max((max_-min_)*height[min_],areas)
min_ +=1
else:
areas = max((max_-min_)*height[max_],areas)
max_ -=1
return areas