// Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a container, such that the container contains the most water.

// Note: You may not slant the container.

public class Solution {
    public int maxArea(int[] height) {
		int len = height.length;

		if(len == 0) return len;

		int max = 0;

		int left = 0;
		int right = len - 1;

		while(left < right){
			int area = height[left] < height[right]? height[left] * (right - left) : height[right] * (right - left);
			max = max > area? max : area;
			if(height[left] < height[right]){
				left++;
			}else{
				right--;
			}
		}

		return max;
    }
}
@@ -405,17 +405,20 @@
 ight) %7B%0A
-%09
+    
 %09int len
@@ -440,17 +440,20 @@
 h;%0A%0A
-%09
+    
 %09if(len 
 == 0
@@ -452,12 +452,11 @@
 len 
-== 0
+%3C 2
 ) re
@@ -464,31 +464,16 @@
 urn 
-len;%0A%0A%09%09int max = 0;%0A%0A%09
+0;%0A%0A    
 %09int
@@ -483,17 +483,20 @@
 ft = 0;%0A
-%09
+    
 %09int rig
@@ -509,18 +509,43 @@
 en - 1;%0A
-%0A%09
+    %09int maxArea = 0;%0A%0A    
 %09while(l
@@ -562,83 +562,51 @@
 t)%7B%0A
-%09
+    
 %09%09int 
-a
+tempA
 rea = 
-height%5Bleft%5D %3C height%5Bright%5D? height%5Bleft%5D * (right - left) :
+Math.min(height%5Bleft%5D,
  hei
@@ -615,16 +615,17 @@
 t%5Bright%5D
+)
  * (righ
@@ -639,42 +639,68 @@
 t);%0A
-%09
+    
 %09%09max
+Area
  = max
- %3E area? max : a
+Area %3E tempArea? maxArea : tempA
 rea;%0A
-%09
+    
 %09%09if
@@ -713,17 +713,17 @@
 t%5Bleft%5D 
-%3C
+%3E
  height%5B
@@ -735,54 +735,72 @@
 %5D)%7B%0A
-%09%09%09%09left++;%0A%09%09%09%7Delse%7B%0A%09%09%09%09right--;%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09
+    %09%09%09right--;%0A    %09%09%7Delse%7B%0A    %09%09%09left++;%0A    %09%09%7D%0A    %09%7D%0A%0A    
 %09ret
@@ -806,16 +806,20 @@
 turn max
+Area
 ;%0A    %7D%0A
@@ -819,8 +819,9 @@
 %0A    %7D%0A%7D
+%0A

modify contaner with most water solution