class Solution {
public int maxArea(int[] height) {
int maxArea = Integer.MIN_VALUE;
int l = 0;
int r = height.length - 1;
while(l < r){
maxArea = Integer.max(maxArea, Integer.min(height[l],height[r])*(r-l));
if(height[l] < height[r]) l++;
else r--;
}
return maxArea;
}
}