最多的水实为垂线段与坐标轴围成的面积
class Solution {
public:
int maxArea(vector<int>& height) {
int l=0, r=height.size()-1;
int ans=0;
while (l<r)
{
int temp=min(height[r], height[l])*(r-l);
ans=max(temp, ans);
if (height[l]<=height[r])
{
l++;
}
else
{
r--;
}
}
return ans;
}
};