This question evaluates algorithmic reasoning with arrays and the ability to optimize pairwise measurements, specifically assessing understanding of how positional distance and element values combine to maximize an area metric.
You are given an integer array h where h[i] represents the height of a vertical line drawn at x-coordinate i.
Choose two different indices i < j. Together with the x-axis, these two lines form a container that can hold water.
The amount of water the container can hold is:
Return the maximum possible area over all pairs (i, j).
h
: array of non-negative integers
2 <= len(h) <= 10^5
0 <= h[i] <= 10^4