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 892a5b1 commit 4b8828dCopy full SHA for 4b8828d
1 file changed
container-with-most-water/kangdaia.py
@@ -0,0 +1,15 @@
1
+class Solution:
2
+ def maxArea(self, height: list[int]) -> int:
3
+ # 가장 멀리 떨어져 있으면서 높이가 비슷한 막대기?
4
+ max_area = 0
5
+ i, j = 0, len(height) - 1
6
+ while i < j:
7
+ left, right = height[i], height[j]
8
+ area = min(left, right) * (j - i)
9
+ if area > max_area:
10
+ max_area = area
11
+ if left < right:
12
+ i += 1
13
+ else:
14
+ j -= 1
15
+ return max_area
0 commit comments