标签:with for break tco max pre mos ret else
public class Solution { public int maxArea(int[] height) { int maxa = 0; int maxi = 0; if(height.length<2) return 0; for(int i=0;i<height.length-1;i++){ if(height[i]<height[maxi]){ continue; } for(int j=height.length-1;j>i;j--){ if(height[j]>height[i]){ int maxmid = (j-i)*height[i]; maxa = maxa>maxmid?maxa:maxmid; break; } else{ int maxmid = (j-i)*height[j]; maxa = maxa>maxmid?maxa:maxmid; } } maxi = i; } return maxa; } }
Leetcode Array 11 Container With Most Water
标签:with for break tco max pre mos ret else
原文地址:http://www.cnblogs.com/mxk-star/p/7236712.html