Files
leetcode/greed/11.py
2025-09-15 21:12:04 +08:00

13 lines
382 B
Python

from typing import List
class Solution:
def maxArea(self, height: List[int]) -> int:
left, right = 0,len(height)-1
res = 0
while left < right:
res = max(res, (right-left) * min(height[left], height[right]))
if height[left] < height[right]:
left += 1
else:
right -= 1
return res