def max_area(height):
    left = 0
    right = len(height) - 1
    max_volume = 0

    while left < right:
       
        width = right - left
        current_height = min(height[left], height[right])
       
        current_volume = width * current_height
        
       
        max_volume = max(max_volume, current_volume)
        
       
        if height[left] < height[right]:
            left += 1
        else:
            right -= 1

    return max_volume

# Example usage:
height1 = [1, 8, 6, 2, 5, 4, 8, 3, 7, 1, 2]
print(max_area(height1))  

height2 = [1, 1]
print(max_area(height2)) 