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 Sentinel Sieve.
Overwrite one next pointer too early and the rest of the expedition becomes unreachable.
How you win
- 1Recognize when Dummy-head deletion matches the clues
- 2Keep this true after every move: the kept chain contains every processed value except the target
- 3Reach the result within O(n)
Rules and pressure
- Target cost: O(n)
- State rule: the kept chain contains every processed value except the target
Lesson 1 of 3
Dummy gives every real node a predecessor. Keep previous fixed when bypassing a match; advance it only after keeping a node.
Your call · Where is previous after removing a matching head 6?