Container With Most Water
Vertical lines of heights stand at positions . Two lines and the x-axis form a container holding water. Find the maximum.
Input
, then heights.
Output
The maximum amount of water.
Constraints
,
Sample 1
Input
9 1 8 6 2 5 4 8 3 7
Output
49