Skip to content

Commit 39a76e0

Browse files
committed
committed from zkp
1 parent c1b518f commit 39a76e0

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

LeetCode/maxArea.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Solution:
2+
def maxArea(self, height):
3+
"""
4+
:type height: List[int]
5+
:rtype: int
6+
"""
7+
s = 0
8+
x2 = len(height)-1
9+
x1 = 0
10+
while x1 < x2:
11+
y1 = height[x1]
12+
y2 = height[x2]
13+
s = max(s, (x2-x1)*min(y1,y2))
14+
if y1 > y2:
15+
x2 -= 1
16+
else:
17+
x1 += 1
18+
return s

0 commit comments

Comments
 (0)