Recognize the pattern
When should you use Fast & Slow Pointers?
Look for a sequence of states where each state determines exactly one next state. If the sequence can terminate, Fast may reach null. If a state can repeat, different traversal speeds can expose the cycle without a visited set.
Common mistakes
- Checking for a collision before the pointers make their first move.
- Moving Fast twice without guarding both hops against null.
- Treating Find the Duplicate Number as value comparison instead of state traversal.
- Resetting both pointers before Phase 2 instead of only one.