public int MaxArea(int[] height) { 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]) start++; else end--; } return max; }
public int MaxArea(int[] height) { 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]) start++; else end--; } return max; }