Skip to content
  • Dashboard
  • Review
  • Go: plan & chat
  • Roadmap
  • Patterns & lessons49
  • Sheets
  • Problems1.5k
  • Ascend
  • Toolkit
  • Core CS + SQL
  • System Design
  • Machine Coding
  • Interview hub
  • Mock interview
  • Companies & OA
  • Leaderboard
  • Battles
  • College Cup
  • People

Keep your progress

Sync across devices with a free account.

Sign upSign in
Patterns & lessons
Sign inSign up
Patterns

Topic · 2 patterns

Linked Lists patterns

Linked-list questions are pointer surgery. Fast and slow pointers find the middle, a cycle or the k-th node from the end in one pass; in-place reversal rewires next pointers without extra memory. Draw the nodes before you code: most bugs are a pointer lost before it was saved.

The patterns

  1. Fast & Slow Pointers

    O(n) / O(1)

    Move one pointer 1 step and another 2 steps; they meet inside a cycle, and slow lands on the middle when fast hits the end.

    Spot it: Linked-list cycle or middle in one pass with O(1) space, or a chain x → f(x) that must repeat (Happy Number, Find the Duplicate).

    Learn Fast & Slow PointersCheat sheet and practice
  2. In-place Reversal

    O(n) / O(1)

    Re-point next pointers one node at a time while carrying prev/curr; for k-groups, reverse a chunk then stitch.

    Spot it: Reverse a whole list, a sublist [left, right], or every k nodes; reorder, rotate, swap pairs, palindrome check, in O(1) space.

    Learn first: Fast & Slow Pointers

    Learn In-place ReversalCheat sheet and practice

Which one? Match the signal

If the problem saysReach for
A linked list that might have a cycle, or you need the middle in one passFast & Slow PointersO(n)
Reverse a list, a sublist, or every k nodes — O(1) extra spaceIn-place LL ReversalO(n)

Easy to confuse

  • Find the Duplicate Number looks like Cyclic Sort, but it’s Fast & Slow Pointers

    Array must not be modified and O(1) space: values form a functional graph whose cycle entry is the duplicate.

  • Happy Number looks like Math / Number Theory, but it’s Fast & Slow Pointers

    The question is whether an iterated function cycles; Floyd detects it without a set.

Used together

  • Fast & Slow Pointers + In-place Reversal

    When: palindrome list, reorder list. Compare or interleave the halves with O(1) space.

Where to start

then the The 128 and The 365 sheets

Fast & Slow Pointers

  • Middle of the Linked ListEasy
  • Linked List CycleEasy

In-place Reversal

  • Reverse Linked ListEasy
  • Reverse Linked List IIMedium

Further reading

free, outside Lessgo
  • Linked List explore cardLeetCode

    Covers fast/slow pointers and reversal with hand-picked problems.

  • Linked list cheatsheetTech Interview Handbook

    Dummy node, two-pointer and reversal tricks with corner cases.

  • Linked list visualizerVisuAlgo

    Animate insert/delete/reverse to build pointer intuition.

  • Cycle detection (Floyd/Brent)Wikipedia

    Proof of why tortoise-hare finds the cycle start; asked as follow-up.

  • NeetCode RoadmapNeetCode

    Pattern-ordered problem tree with a short video per problem; best interview-first path.

← Arrays & Two PointersAll 49 patternsBinary Search →
TodayReviewPatternsProblems