mirror of
https://git.wolves.top/wolves/leetcode.git
synced 2025-11-04 17:26:32 +08:00
init
This commit is contained in:
13
greed/11.py
Normal file
13
greed/11.py
Normal file
@@ -0,0 +1,13 @@
|
||||
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
|
||||
Reference in New Issue
Block a user