try my best

###### Leetcode: Container With Most Water
class Solution {
public:
/*
贪心：
从长度最长开始，即left=0,right=height.size()-1
每次更新宽度小的那个边界，left向右移动，right向左移动
同步更新答案 即area
*/
int maxArea(vector<int>& height) {
int n=height.size();
int left=0;
int right=n-1;
int max_area=(right-left)* min(height[left],height[right]);
while(left<right){
if(height[left]<height[right]){
left++;
}
else{
right--;
}
int max_=(right-left)* min(height[left],height[right]);
max_area=max(max_,max_area);
}
return max_area;
}
};

#### 【LeetCode】Container With Most Water 解题报告

2014-12-02 09:24:29

#### LeetCode --- 11. Container With Most Water

2015-01-29 10:49:05

#### [LeetCode][11]Container With Most Water解析 时间复杂度为O(n) -Java实现

2016-06-12 14:16:19

#### [LeetCode]Container With Most Water, 解题报告

2013-12-10 19:47:10

#### Leetcode Container With Most Water 解题报告

2014-01-23 10:22:20

#### LeetCode 11 Container With Most Water (C,C++,Java,Python)

2015-05-07 22:56:04

#### [LeetCode] 011. Container With Most Water (Medium) (C++/Java/Python)

2015-03-02 22:51:59

#### LeetCode(11) ContainerWithMostWater

2013-12-09 08:23:48

#### LeetCode 11. Container With Most Water（容器装水）

2016-05-19 05:24:14

#### 【LEETCODE】11-Container With Most Water [Python]

2016-01-07 09:03:13

## 不良信息举报

Leetcode: Container With Most Water