-
-
Save parcar/cf22c2b6323ef8a46dd584708b8e2410 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
| class Solution: | |
| def maxArea(self, height: List[int]) -> int: | |
| lo = 0 | |
| hi = len(height)-1 | |
| cmax = 0 | |
| while(lo < hi): | |
| cmax = max(min(height[lo],height[hi]) * (hi - lo), cmax) | |
| if (height[lo] > height[hi]): | |
| hi -= 1 | |
| else: | |
| lo += 1 | |
| return cmax | |
| ''' | |
| Runtime: 144 ms, faster than 65.36% of Python3 online submissions for Container With Most Water. | |
| Memory Usage: 15.5 MB, less than 5.26% of Python3 online submissions for Container With Most Water. | |
| ''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment