Skip to content

Commit 71360e4

Browse files
authored
Create Container With More Water
1 parent d701b80 commit 71360e4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Container With More Water

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public int maxArea(int[] height) {
3+
int max = -1;
4+
for(int i = 1; i<=height.length; i++){
5+
for(int j = i+1; j<=height.length; j++){
6+
int area = Math.min(height[i-1], height[j-1]) * (j-i);
7+
max = Math.max(max, area);
8+
}
9+
}
10+
return max;
11+
}
12+
}

0 commit comments

Comments
 (0)