盛最多水的容器
解题思路:双指针法
class Solution { public int maxArea(int[] height) { int len = height.length; int l = 0; int r = len - 1; int maxarea = 0; int left = 0; int right = 0; while(l<r){ left = height[l]; right = height[r]; maxarea = Math.max(maxarea, Math.min(left,right)*(r-l)); if(left<right){ l++; }else{ r--; } } return maxarea; } }