 盛最多水的容器
盛最多水的容器
  https://leetcode.cn/problems/container-with-most-water/submissions/ (opens new window) 需要注意的点
- 双指针
class Solution:
    def maxArea(self, height: List[int]) -> int:
        
        left = 0
        right = len(height)-1
        ret = 0
        while left < right:
            # 计算面积
            tmp = min(height[left], height[right])*(right-left)
            ret = max(ret, tmp)
            if height[left] > height[right]:
                right -= 1
            else:
                left += 1
            
            
        return ret
难度:中