public class Solution { public int maxArea(int[] height) { int i=0,j=height.length-1; int maxarea=0; int area=0; while(i<j) { if(height[i]<height[j]) {area = (j-i)*height[i]; i++; } else { area = (j-i)*height[j]; j--; } if(area>maxarea) maxarea = area; } return maxarea; }}
新闻热点
疑难解答