Created
February 26, 2020 17:18
-
-
Save deque-blog/a72e8fe1bd6dc2f70a96aa9d9c501772 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(heights: List[int]) -> int: | |
| i = 0 | |
| j = len(heights) - 1 | |
| max_area = 0 | |
| while i < j: | |
| width = j - i | |
| if heights[i] < heights[j]: | |
| max_area = max(max_area, width * heights[i]) | |
| i += 1 | |
| else: | |
| max_area = max(max_area, width * heights[j]) | |
| j -= 1 | |
| return max_area | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment