#!/usr/bin/env python

""" Python 3 """

def max_area(height: list) -> int:
    """
    :type height: List[int]
    :rtype: int
    """

    # Init vars
    left = 0
    right = len(height) - 1
    area_max = 0
    area_tmp = 0

    while left < right:
        # Move barriers until they meet in the middle
        area_tmp = min(height[left], height[right]) * (right - left)
        area_max = max(area_tmp, area_max)

        if height[left] > height[right]:
            # Left side bigger means move right inward
            right -= 1
        else:
            left += 1
        
    return area_max


def main():
    heights01 = [1, 8, 6, 2, 5, 4, 8, 3, 7]
    most_area = max_area(heights01)
    print('Most area: {}'.format(most_area))

if __name__ == "__main__":
    main()
