Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 08 · DSA · Worked problems, in English · about 20 min to read

Play it as a journeyTutor comes with a plan

Clinic #34: Linked List Cycle

Pattern: Fast and slow pointers · LC 141 (and LC 142 in the second read)

Pattern Recognition
Pattern Recognition · Open board

Shows four problem shapes side by side. This clinic is the third one: a fast pointer lapping a slow one around a loop, worked on the problem it was made for.

Before you start. Linked Lists, Stacks & Queues built the chain: each item sits in a box called a node, and each node carries a note, the pointer, saying which node comes next. The only way through a chain is to start at the first node and follow the notes one at a time, because there is no “jump to box 5”. The last node’s note normally says “nothing next”, and that is how you know the chain ended.

Lesson 74 of 96 in DSA

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • A treasure hunt where every note names the next hiding place
  • By hand: a hunt that loops back, the cycle
  • The first idea: a notebook of every room you have seen
  • The click: send a walker and a runner, the slow and fast pointers
  • Why they must meet: the gap closes by one room per minute
  • 1969: a trick credited to Floyd, and nobody knows who found it first
  • The entrance: where does the loop start?
  • The tell: a chain you cannot index, and the word “cycle”
  • Solution ladder
  • The walker and runner, printed
  • Why the entrance walk works
  • Timings (measured, 2026-09-27)
  • First time in an interview: the path
  • The fast and slow pointers ladder: easy, medium, hard

Terms it explains: LC 141, node, pointer, cycle, entrance, set, constant memory, slow pointer, fast pointer, gap, Floyd's cycle-finding algorithm, chain of "next" links, a loop, LC 142: the entrance, slow and fast pointers, O(n), O(1), BEST, Draw two lists, Code it, Offer LC 142, Happy Number.

Review DSA