class Solution:
    def maxArea(self, height):
        i, j = 0, len(height) - 1
        water = 0
        while i < j:
            water = max(water, (j-i)*min(height[i],height[j]))
            if height[i] < height[j]:
                i += 1
            else:
                j -= 1
        return water


l = [3, 2, 1, 3, 1]
sol = Solution()
print(sol.maxArea(l))