0%
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| class Solution: def __init__(self): self.max_value = 0 def maxArea(self, height: List[int]) -> int: left = 0 right = len(height)-1 max_value = 0 while left < right: min_left_right = min(height[left],height[right]) max_value_undetermined = min_left_right*(right-left) if max_value < max_value_undetermined: max_value = max_value_undetermined if min_left_right == height[left]: left += 1 else: right -= 1 return max_value
|