/* * 11. Container With Most Water * 12.4 by Mingyang */ public int maxArea(int[] height) { int res=0; if(height==null||height.length==0) return res; int start=0; int end=height.length-1; int max=0; while(start<end){ max=Math.max(max,(Math.min(height[start],height[end])*(end-start))); if(height[start]>height[end]){ end--; }else{ start++; } } return max; }