This is a classic two-pointer problem with a non-obvious greedy insight — understanding why moving the shorter line is always optimal.
Enable JavaScript for the full StreamPrep guide.