# # 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 # # # @param height int整型一维数组 # @return int整型 # class Solution: def maxArea(self , height: List[int]) -> int: # write code here n = len(height) if n < 2: return 0 left, right = 0, n-1 max_water = 0 while left < right: current_width = right - left current_height = min(height[left], height[right]) current_water = current_width * current_height max_water = max(max_water, current_water) if height[left] < height[right]: left += 1 else: right -= 1 return max_water