~/boss / monster-chain

Reversing a linked list

The Chain

Flip every monster's arrow in one pass, without losing anyone.

Loading the fight…

How to beat it

Each monster only knows who's next. Walk the chain with three hands: prev, curr and next. Grab next first, flip curr's arrow back to prev, then step all three forward. When curr runs off the end, prev is the new head.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/reverse-linked-list there. Sign in with your email to keep your progress on every device.

More bosses

esc