class Solution {
public:
int maxArea(vector<int>& height) {
int res = 0, i = 0, j = height.size() - 1;
while (i < j) {
res = max(res, min(height[i], height[j]) * (j - i));
height[i] < height[j] ? ++i : --j;
}
return res;
}
};
11.Container With Most Water
猜你喜欢
转载自www.cnblogs.com/smallredness/p/10671884.html
今日推荐
周排行