双指针法
class Solution {
public int maxArea(int[] height) {
int l = height.length;
int start = 0, end = l - 1, max = 0;
while(start <= end){
int h = Math.min(height[start], height[end]);
max = Math.max(max, (end - start) * h);
if(height[start] < height[end]){
start++;
}else if(height[start] > height[end]){
end--;
}else{
start++;
end--;
}
}
return max;
}
}