Question Description
My Code
public class Solution {
public int maxArea(int[] height) {
int result = 0;
int i = 0, j = height.length - 1;
while (i < j) {
int x = j - i;
int y = Math.min(height[i], height[j]);
int area = x * y;
result = area > result ? area : result;
if (height[i] < height[j]) i++;
else j--;
}
return result;
}
}