class Solution:
def maxArea(self, height: List[int]) -> int:
left, right = 0, len(height)-1
result = 0
while left <= right:
area = (right - left) * min(height[right], height[left])
result = max(result, area)
if height[right] < height[left]:
right -= 1
else:
left += 1
return result
'CS > 알고리즘' 카테고리의 다른 글
[Leetcode] 15. 3Sum (0) | 2023.05.01 |
---|---|
[Leetcode] 1. Two Sum (0) | 2023.05.01 |
[Leetcode] 12. Integer to Roman (0) | 2023.05.01 |
[Leetcode] 202. Happy Number (0) | 2023.04.27 |
[Leetcode] 55. Jump Game (0) | 2023.04.27 |