Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
leetcode_problem11
class Solution:
def maxArea(self, height: List[int]) -> int:
maxArea = 0
i, j, N = 0, 1, len(height)
while i+j<N:
if height[i] <= height[N-j]:
area = (N-i-j)*height[i]
i += 1
elif height[i] > height[N-j]:
area = (N-i-j)*height[N-j]
j += 1
if area > maxArea:
maxArea = area
return maxArea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.