You are given an array of length . Each element represents the height of a vertical line. Find two lines that together with the x-axis form a container that holds the most water.
The area of water is . If lines are at indices and where , then area .
Find the maximum area. Before reading on, think about what formula you're maximizing.