Problems > The Widest Container > Editorial

The Widest Container — Solution & Editorial

Back to the Problem

Two pointers at the ends; always move the SHORTER wall inward — moving the taller one can only shrink the area (width drops, height cannot rise above the shorter wall).

Complexity: O(N)