The problem doesn't mention at all that the container should be rectangle. Only after I see the posted solution did I realize that. Before that I thought the container could be a trapezoid, bounded by two lines of different heights and the x axis.

But what if the problem is modified such that the container can actually be a trapezoid? Is it possible to find maxArea in O(n) time, too? Any idea is appreciated!