mirror of
https://git.wolves.top/wolves/leetcode.git
synced 2025-11-04 17:26:32 +08:00
13 lines
382 B
Python
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 |