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 969ad0f commit 42545bdCopy full SHA for 42545bd
Algorithms/Medium/11_Container With Most Water/Solution.java
@@ -1,21 +1,21 @@
1
class Solution {
2
public int maxArea(int[] height) {
3
- int i = 0;
4
- int j = height.length - 1;
5
- int maxArea = Integer.MIN_VALUE;
+ int i = 0;
+ int j = height.length - 1;
+ int maxArea = Integer.MIN_VALUE;
6
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);
+ while (i < j) {
+ int h = Math.min(height[i], height[j]);
+ int width = j - i;
+ maxArea = Math.max(maxArea, h*width);
11
12
- if (height[i] > height[j]) {
13
- j--;
14
- } else {
15
- i++;
16
- }
17
+ if (height[i] > height[j]) {
+ j--;
+ } else {
+ i++;
+ }
18
19
- return maxArea;
+ return maxArea;
20
}
21
0 commit comments