代码:
class Solution { public: int maxArea(vector<int>& height) { int L = 0,R = height.size()-1; int max_Area = 0; while(L<R) { int ans_area = min(height[L],height[R])*(R-L); max_Area = max(max_Area,ans_area); if(height[L]<height[R]) { L++; } else{ R--; } } return max_Area; } };