Problem context and objectives
Mission briefing
Portal network mechanic · Travel portals are connected as a one-way chain
Repair the links without losing the unexplored route: Tortoise Causeway.
Overwrite one next pointer too early and the rest of the expedition becomes unreachable.
How you win
- 1Recognize when Fast and slow pointers matches the clues
- 2Keep this true after every move: at loop boundaries, fast has traveled twice as far as slow
- 3Reach the result within O(n)
Rules and pressure
- Target cost: O(n)
- State rule: at loop boundaries, fast has traveled twice as far as slow
Lesson 1 of 3
Slow follows one link and fast follows two. The 2-to-1 distance relationship holds after each complete loop iteration, not between its assignments.
Your call · For n0 → n1 → n2 → n3 → n4, where are the pointers after one complete iteration from head?