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 bafa98f commit a490985Copy full SHA for a490985
โcontainer-with-most-water/ZetBe.pyโ
@@ -0,0 +1,23 @@
1
+'''
2
+๋ฌธ์ : ์ปจํ ์ด๋ ์ต๋ ๋ฌผ ๋ด๊ธฐ
3
+ํ์ด: ์์ชฝ ๋์์ ์์ํ์ฌ ๋ ์์ ์ชฝ์ ํฌ์ธํฐ๋ฅผ ์ด๋์ํค๋ฉฐ ์ต๋ ๋์ด๋ฅผ ๊ณ์ฐ
4
+์๊ฐ๋ณต์ก๋: O(n)
5
+๊ณต๊ฐ๋ณต์ก๋: O(1)
6
+์ฌ์ฉํ ์๋ฃ๊ตฌ์กฐ: ํฌ ํฌ์ธํฐ
7
8
+
9
10
+class Solution:
11
+ def maxArea(self, height: List[int]) -> int:
12
+ r, l = len(height)-1, 0
13
+ answer = (r-l)*(min(height[r], height[l]))
14
+ while r > l:
15
+ answer = max(answer, (r-l)*(min(height[r], height[l])))
16
+ if height[r] < height[l]:
17
+ r -= 1
18
+ else:
19
+ l += 1
20
+ return answer
21
22
23
0 commit comments