Largest Water Reservoir


Given an array building of n non-negative integers where each integer represents the height of a building, find two buildings that together with the horizontal line form a container, such that the container contains the most water.

Return the maximum amount of water a container can store. Note that you may not slant the container.


maxWaterContainer([4, 3, 2, 1, 4]) // returns 16 /* The maximum area of water that can be contained is between the buildings at index 0 and 4, which can contain 4 * 4 = 16 units of water. */