class Solution {
public:
int maxArea(vector<int>& height) {
int start = 0, end = height.size() - 1;
int imax = INT_MIN;
while (end > start) {
int res = (end - start) * (height[end] < height[start] ? height[end --] : height[start ++]);
imax = max(imax, res);
}
return imax;
}
};
leetcode:Container With Most Water 6行AC
最新推荐文章于 2018-04-11 18:38:28 发布