11. Container With Most Water
class Solution:
def maxArea(self, height: List[int]) -> int:
max_res = 0
n = len(height)
lp = 0
rp = n - 1
while lp < rp:
h = min(height[lp], height[rp])
a = h * (rp-lp)
max_res = max(max_res, a)
if height[lp] < height[rp]:
lp += 1
else:
rp -= 1
return max_resLast updated