We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f45048 commit 174a7e1Copy full SHA for 174a7e1
container-with-most-water/jinah92.py
@@ -0,0 +1,15 @@
1
+# O(1) spaces, O(N) times
2
+class Solution:
3
+ def maxArea(self, height: List[int]) -> int:
4
+ max_area = 0
5
+ start, end = 0, len(height)-1
6
+
7
+ while start != end:
8
+ # start, end 포인터에서 물의 넓이 계산 및 최대값 계산
9
+ max_area = max((end-start)*min(height[start], height[end]), max_area)
10
+ if height[start] < height[end]:
11
+ start += 1
12
+ elif height[start] >= height[end]:
13
+ end -= 1
14
15
+ return max_area
0 commit comments