class Solution {
public:
int maxArea(vector<int>& height) {
int max=0;
if(height.size()==0||height.size()==1){
return 0;
}
int maxedge=0;
for(int i=0;i<height.size()-1;i++){
if(maxedge<height[i]){maxedge=height[i];}
}
for(int i=0;i<height.size()-1;i++){
for(int j=i+1;j<height.size();j++){
if(height[i]<height[j]){
int result=height[i]*(j-i);
if(max<result){max=result;}
}else{
int result=height[j]*(j-i);
if(max<result){max=result;}
}
}
if(height[i]==maxedge){break;}
}
return max;
}
};