Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. class Solution:
  2.     def maxArea(self, height: List[int]) -> int:
  3.         i = 0
  4.         j = len(height) - 1
  5.         max_ = 0
  6.        
  7.         while i < j:
  8.             max_ = max(max_ , abs(j-i) * min(height[i],height[j]))
  9.  
  10.             if height[i] > height[j]:
  11.                 j -= 1
  12.                 continue
  13.                
  14.             fix = height[i]
  15.             while i+1 < len(height) and height[i+1] <= fix:
  16.                 i += 1          
  17.             i += 1
  18.         return max_
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement