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: The Looping Oracle.
Overwrite one next pointer too early and the rest of the expedition becomes unreachable.
How you win
- 1Recognize when Floyd cycle detection matches the clues
- 2Keep this true after every move: after collision and reset, equal-speed walks from head and collision meet at the entrance
- 3Reach the result within O(n)
Rules and pressure
- Target cost: O(n)
- State rule: after collision and reset, equal-speed walks from head and collision meet at the entrance
Lesson 1 of 3
These numbers identify nodes; nextIndex defines their connections. Compare the pointers after moving, not when both have just been initialized at node 0.
Your call · Both pointers start at node 0. When does their equality prove a cycle?