letcode之11 盛最多水的容器(亲测C++和python版本)

python3

class Solution:
def maxArea(self, height: List[int]) -> int:
    max_area=0
    area=0
    i=0
    
    j=len(height)-1
    
    while(imax_area:
            max_area=area
     
    return max_area

C++

class Solution {
public:
    int maxArea(vector& height) {
    
 int b,h;  
 int left =0;
 int right=height.size()-1;
 int max=0;
 int area=0;
 while(leftmax)
         max=area;
     
 }    
return max;      
}
};

你可能感兴趣的:(LeetCode)