public int baseCase(int[] height, int mid, int left, int right, int[] aux) {

        //step 1, expand
        int currentMin = height[mid];
        aux[mid] = height[mid];
        for (int i = mid - 1; i >= left; i--) {
            if (height[i] < currentMin) {
                currentMin = height[i];
            }
            aux[i] = currentMin;
        }
        currentMin = height[mid];
        for (int i = mid + 1; i <= right; i++) {
            if (height[i] < currentMin) {
                currentMin = height[i];
            }
            aux[i] = currentMin;
        }

        //step 2, shrink
        int size = right - left + 1;
        int maxSoFar = height[mid];
        while (!(left == mid && right == mid)) {
            if (left == mid) {
                maxSoFar = Math.max(maxSoFar, aux[right] * size);
                right--;
            } else if (right == mid) {
                maxSoFar = Math.max(maxSoFar, aux[left] * size);
                left++;
            } else if (aux[left] <= aux[right]) {
                maxSoFar = Math.max(maxSoFar, aux[left] * size);
                left++;
            } else {
                maxSoFar = Math.max(maxSoFar, aux[right] * size);
                right--;
            }
            size--;
        }

        return maxSoFar;
    }