Created
February 26, 2020 17:01
-
-
Save deque-blog/96e7dcfbdff04e31dc845eab8ca53391 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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