双指针法:

int maxArea(int* height, int heightSize){    int max = 0;    for (int i = 0, j = heightSize - 1; i < j; ) {        int min = height[i] <= height[j] ? i : j;        if (height[min] * (j - i) > max) {            max = height[min] * (j - i);        }        if (min == i) {            i++;        } else if (min == j) {            j--;        }    }    return max;}