Problem intuition
Brute force tries every pair and computes the area directly.
The optimal move is to start from the widest container and shrink only the shorter wall, because moving the taller wall cannot increase the height bottleneck.
Java solution ladder
The solutions below are ordered from least optimal to most optimal, so you can see the improvement path instead of only the final answer.