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 Mirror Chain.
Overwrite one next pointer too early and the rest of the expedition becomes unreachable.
How you win
- 1Recognize when Iterative pointer reversal matches the clues
- 2Keep this true after every move: previous heads a fully reversed prefix and current heads the untouched suffix
- 3Reach the result within O(n)
Rules and pressure
- Target cost: O(n)
- State rule: previous heads a fully reversed prefix and current heads the untouched suffix
Lesson 1 of 3
Keep the nodes in place and watch their next links change. The saved next_node protects the untouched chain while current.next is overwritten.
Your call · At n1, previous is n0 and the original next is n2. After n1.next = n0, which reference still reaches the untouched suffix?