leetcode Container With Most Water python

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

 

posted @ 2015-11-15 23:08  hao.ma  阅读(129)  评论(0编辑  收藏  举报