public int maxArea(int[] height) {
        if (height == null || height.length <= 1)
            return 0;
        int begin = 0, end = height.length - 1;
        int max = 0;
        while (begin < end) {
            int h = Math.min(height[begin], height[end]);
            int w = end - begin;
            max = Math.max(h * w, max);
            if (height[begin] < height[end])
                ++begin;
            else
                --end;
        }
        return max;
    }