Each value in heights represents a vertical line at that index. Choose two lines that hold the greatest amount of water.
Return the maximum area. The area is the shorter height multiplied by the distance between the lines.
Inputheights = [1, 8, 6, 2, 5, 4, 8, 3, 7]
Output49
Inputheights = [1, 1]
Output1
2 ≤ heights.length ≤ 100,0000 ≤ heights[i] ≤ 10,000