11.Container With Most Water
My code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Solution:
def maxArea(self, height: List[int]) -> int:
left = 0
right = len(height) - 1
amount = 0
while left < right:
cur_amount = min(height[left],height[right]) * (right - left)
amount = max(amount,cur_amount)
if height[left] < height[right]:
left += 1
else:
right -= 1
return amount