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