Code
Loading editor...
Tap Analyze to see visualization
Click Analyze to visualize
See step-by-step execution, variables, and output
Variables
Run code to see variables
Output
Console output will appear here
Click Analyze to visualize
See step-by-step execution, variables, and output
Run code to see variables
Console output will appear here
Start with two pointers at the widest possible container. Calculate the area using the shorter line as height. Move the pointer at the shorter line inward, since moving the taller line can only decrease width without increasing the limiting height.
The area is limited by the shorter line. Moving the shorter pointer inward is the only way to potentially find a taller line that could increase area, since decreasing width with the same height always reduces area.
Updated Feb 2026