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 a92eb7e commit 77917b1Copy full SHA for 77917b1
container-with-most-water/krokerdile.js
@@ -0,0 +1,21 @@
1
+/**
2
+ * @param {number[]} height
3
+ * @return {number}
4
+ */
5
+var maxArea = function(height) {
6
+ let left = 0;
7
+ let right = height.length - 1;
8
+ let max = 0;
9
+
10
+ while(right > left){
11
+ if(height[left] >= height[right]){
12
+ max = Math.max(max, height[right] * (right - left));
13
+ right = right -1;
14
+ }
15
+ else{
16
+ max = Math.max(max, height[left] * (right - left));
17
+ left = left +1;
18
19
20
+ return max;
21
+};
0 commit comments