classSolution { public: intmaxArea(vector<int>& height){ //双指针; int ans =-1; int left=0; int right=height.size()-1; while(left<right){ int temp=0; if(height[left]<=height[right]){ temp = height[left]*(right-left); ans = std::max(ans,temp); left++; }else{ temp = height[right]*(right-left); ans = std::max(ans,temp); right--; }