"Send two runners down the list at different speeds. The gap between them isn't random — it's a fact you can exploit to find the middle, catch a loop, or hit the nth-from-last, all in one pass with no extra memory."
The Idea: Two Speeds, One Pass
You can't index a linked list, so tricks that work on arrays (jump to the middle, peek n from the end) seem impossible without two passes. The fast/slow pointer technique gets them in one pass by running two pointers at different speeds and reading the relationship between them. Same family as the two-pointer technique from the Arrays track, specialized for the walk-only world of linked lists.
Find the Middle, in One Pass
Move slow one node at a time and fast two at a time. When fast reaches the end, slow is at a middle position. For even lengths there are two middle nodes, and the loop condition determines whether the algorithm returns the earlier or later one. State that convention explicitly.
Floyd's Cycle Detection: the Famous One
Does a linked list have a loop (a node whose next points back into the list)? A naive answer stores every visited node in a set — O(n) space. Floyd's tortoise and hare does it in O(1) space: run slow (×1) and fast (×2). If there's no loop, fast falls off the end (hits None). If there is a loop, fast keeps lapping around it and will eventually land on the exact same node as slow — they collide. Two pointers, no extra memory, and a genuinely beautiful piece of reasoning: in a loop, a 2× runner gains one step per tick on a 1× runner, so it must eventually catch up.
nth-From-End Without Counting
Want the node n positions from the end, but you don't know the length? Start fast, advance it n steps alone, then move fast and slow together until fast hits the end. Because fast stayed exactly n ahead the whole way, slow lands precisely n from the end. One pass, no length needed — the fixed gap did the counting for you.