Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings

The Mirror Chain

Learn
Play
Prove
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

  1. 1Recognize when Iterative pointer reversal matches the clues
  2. 2Keep this true after every move: previous heads a fully reversed prefix and current heads the untouched suffix
  3. 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?

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead