Skip to content

Commit 42545bd

Browse files
authored
Update Solution.java
1 parent 969ad0f commit 42545bd

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
class Solution {
22
public int maxArea(int[] height) {
3-
int i = 0;
4-
int j = height.length - 1;
5-
int maxArea = Integer.MIN_VALUE;
3+
int i = 0;
4+
int j = height.length - 1;
5+
int maxArea = Integer.MIN_VALUE;
66

7-
while (i < j) {
8-
int h = Math.min(height[i], height[j]);
9-
int width = j - i;
10-
maxArea = Math.max(maxArea, h*width);
7+
while (i < j) {
8+
int h = Math.min(height[i], height[j]);
9+
int width = j - i;
10+
maxArea = Math.max(maxArea, h*width);
1111

12-
if (height[i] > height[j]) {
13-
j--;
14-
} else {
15-
i++;
16-
}
17-
}
12+
if (height[i] > height[j]) {
13+
j--;
14+
} else {
15+
i++;
16+
}
17+
}
1818

19-
return maxArea;
19+
return maxArea;
2020
}
2121
}

0 commit comments

Comments
 (0)