#include <algorithm>
#include <climits>
class Solution {
public:
/**
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
*
*
* @param height int整型vector
* @return int整型
*/
int maxArea(vector<int>& height) {
int len = height.size();
int left = 0;
int right = len-1;
int maxarea = 0;
while (left<right) {
maxarea = max(maxarea,min(height[left], height[right])*(right-left));
if(height[left]< height[right]) {
left++;
}else{
right--;
}
}
return maxarea;
}
};

京公网安备 11010502036488号