~/boss / loop-demon

Floyd's cycle detection

The Loop Demon

Two heroes, no map. Find the room where the loop begins.

Loading the fight…

How to beat it

The turtle walks one room per step and the rabbit runs two. In a loop, the rabbit always laps the turtle. Then send the turtle back to the entrance and walk them both one room at a time.

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/linked-list-cycle-ii there. Sign in with GitHub to keep your progress on every device.

More bosses

esc