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