class Solution {
public:
int maxArea(vector<int> &height) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
int ans = 0;
if(height.size()<=1)
return ans;
int pl = 0,pr = height.size()-1;
while(pl<pr){
int tmp = min(height[pl],height[pr])*(pr-pl);
ans = max(ans,tmp);
if(height[pl]<height[pr])
pl++;
else
pr--;
}
return ans;
}
};
public:
int maxArea(vector<int> &height) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
int ans = 0;
if(height.size()<=1)
return ans;
int pl = 0,pr = height.size()-1;
while(pl<pr){
int tmp = min(height[pl],height[pr])*(pr-pl);
ans = max(ans,tmp);
if(height[pl]<height[pr])
pl++;
else
pr--;
}
return ans;
}
};