int res = 0;
int ab = 0;
for(int i = 0;i < height.length; i++){
for (int j = i +1; j < height.length; j++){
ab = Math.min(height[i], height[j])* (j - i);
res = Math.max(res, ab);
}
}
return res;
int low = 0, high = height.length - 1 ;
int res = 0;
while (low < high){
int tlo = height[low], thi = height[high];
int ab = Math.min(tlo, thi) * (high - low);
res = Math.max(res, ab);
**if (tlo <= thi)**
**while (low < high && height[low] <= tlo) low++;**
**else**
**while (low < high && height[high] <= thi) high--;**
}
return res;