You are given an array height of length n. 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 width×min height. If lines are at indices i and j where i<j, then area =(j−i)×min(height[i],height[j]).
Find the maximum area. Before reading on, think about what formula you're maximizing.