Leed code 11. Container With Most Water

 1 public int maxArea(int[] height) {
 2     int left = 0, right = height.length - 1;
 3     int maxArea = 0;
 4 
 5     while (left < right) {
 6         maxArea = Math.max(maxArea, Math.min(height[left], height[right])
 7                 * (right - left));
 8         if (height[left] < height[right])
 9             left++;
10         else
11             right--;
12     }
13 
14     return maxArea;
15 }
原文地址:https://www.cnblogs.com/wwjldm/p/6912423.html