题解 | 盛水最多的容器
# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param height int整型一维数组 # @return int整型 # class Solution: def maxArea(self , height: List[int]) -> int: # write code here length = len(height) l = 0 r = length-1 maxx = 0 while l < r: maxx = max(maxx, min(height[l], height[r]) * (r - l)) if height[l] < height[r]: l += 1 else: r -=1 return maxx