2021/05/06
class Solution {
public int maxArea(int[] height) {
int i = 0;
int j = height.length - 1;
int max = 0;
while (i < j) {
int w = j - i;
int h = Math.min(height[i], height[j]);
int s = w * h;
if (s > max) max = s;
if (height[i] > height[j]) {
j--;
} else {
i++;
}
}
return max;
}
}