Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created February 26, 2020 16:54
Show Gist options
  • Save deque-blog/b2501242d2115a0f3e3df0d14c8486ee to your computer and use it in GitHub Desktop.
Save deque-blog/b2501242d2115a0f3e3df0d14c8486ee to your computer and use it in GitHub Desktop.
def maxArea(heights: List[int]) -> int:
max_area = 0
n = len(heights)
for i in range(n):
for j in 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