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 3e99718 commit bf05e92Copy full SHA for bf05e92
container-with-most-water/samthekorean,py
@@ -0,0 +1,20 @@
1
+# TC : O(n)
2
+# SC : O(1)
3
+class Solution:
4
+ def maxArea(self, height: List[int]) -> int:
5
+ low = 0
6
+ high = len(height) - 1
7
+ max_val = 0
8
+
9
+ while low < high:
10
+ val = min(height[low], height[high]) * (high - low)
11
+ max_val = max(val, max_val)
12
+ if height[low] < height[high]:
13
+ low += 1
14
+ elif height[low] > height[high]:
15
+ high -= 1
16
+ # increment low or decrement high
17
+ else:
18
19
20
+ return max_val
0 commit comments