Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created February 26, 2020 17:01
Show Gist options
  • Save deque-blog/96e7dcfbdff04e31dc845eab8ca53391 to your computer and use it in GitHub Desktop.
Save deque-blog/96e7dcfbdff04e31dc845eab8ca53391 to your computer and use it in GitHub Desktop.
def maxArea(self, heights: List[int]) -> int:
max_area = 0
n = len(heights)
for i in range(n):
for j in reversed(range(i+1, n)):
width = j - i
height = min(heights[i], heights[j])
max_area = max(max_area, width * height)
return max_area
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment