1. The Hook: Two Friends on a Number Line


Imagine two friends walking along a line of numbers. Sometimes they walk together toward the same direction, sometimes they start at opposite ends and meet in the middle, and other times one runs faster than the other to check what’s ahead.

That’s the essence of the two-pointer technique, one of the...