We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 55ff889 commit 969ad0fCopy full SHA for 969ad0f
Algorithms/Medium/11_Container With Most Water/Solution.java
@@ -2,24 +2,20 @@ class Solution {
2
public int maxArea(int[] height) {
3
int i = 0;
4
int j = height.length - 1;
5
-
6
int maxArea = Integer.MIN_VALUE;
7
8
- while(i < j) {
+ while (i < j) {
9
int h = Math.min(height[i], height[j]);
10
int width = j - i;
11
12
maxArea = Math.max(maxArea, h*width);
13
14
- if(height[i] > height[j]) {
+ if (height[i] > height[j]) {
15
j--;
16
} else {
17
i++;
18
}
19
20
21
22
return maxArea;
23
24
25
-}
+}
0 commit comments