[LeetCode] 11. Container With Most Water
Python
class Solution:
def maxArea(self, height: List[int]) -> int:
answer = 0
left = 0
right = len(height) - 1
while left < right:
answer = max(answer, min(height[left], height[right]) * (right - left))
if height[left] < height[right]:
left += 1
else:
right -= 1
return answer
댓글남기기