public int maxArea0413(int[] height) {
    if (height == null || height.length <= 1) {
      return 0;
    }
    int i = 0, j = height.length - 1;
    int hi = height[i], hj = height[j];
    int max = Math.min(hi, hj) * (j - i);
    while (i < j) {
      if (hi <= hj) {
        i++;
        while (height[i] <= hi && i < j) {
          i++;
        }
      }
      else {
        j--;
        while (height[j] <= hj && i < j) {
          j--;
        }
      }
      if (i > j) {
        break;
      }
      hi = height[i];
      hj = height[j];
      max = Math.max(max, Math.min(hi, hj) * (j - i));
    }
    return max;
  }