Optimal Algorithmic Approach
Greedy Two-Pointer: the width decreases with each move, so always sacrifice the smaller height to potentially gain more from height.
Core Invariants & Edge Cases
- Start with widest possible container (left=0, right=n-1)
- Always move the pointer with the shorter height inward
- Area = min(h[left], h[right]) × (right - left)