Question DSA-TP-0067
HardWhy does the 'container with most water' two-pointer method move the shorter line inward?
- A.
To keep the width the same
- B.
Moving the taller one can never give a larger area, since the width shrinks and the height is capped by the shorter line
- C.
It is arbitrary
- D.
The shorter line is always optimal
Sign up free to see the answer and a step-by-step explanation.