public int maxArea(int[] height) {
        if (height == null) return -1;
        int left = 0, right = height.length - 1;
        int maxArea = 0;
        while (left <= right) {
            int area = Math.min(height[left], height[right]) * (right - left);
            if (area > maxArea) maxArea = area;
            if (height[left] < height[right]) {
                ++left;
            } else if (height[left] > height[right]) {
                --right;
            } else {
                ++left;
                --right;
            }
        }
        return maxArea;
    }