def maxArea(height):
    left, right = 0, len(height) - 1
    max_water = 0
    
    while left < right:
        # Calculate the area of the current container
        water = (right - left) * min(height[left], height[right])
        max_water = max(max_water, water)
        
        # Move the pointer with the smaller height
        if height[left] < height[right]:
            left += 1
        else:
            right -= 1
    
    return max_water

# Test cases
print(maxArea([1,8,6,2,5,4,8,3,7])) # Output: 49
print(maxArea([1,1])) # Output: 1
print(maxArea([4,3,2,1,4])) # Output: 16
print(maxArea([1,2,1])) # Output: 2
