Linked List Manipulation Cheat Sheet

Walk a fixed number of pointers through a linked list's next pointers, rewiring them in place.

Linked List Manipulation cheat sheet preview

Earn the full sheet below.

When to reach for it

  • You need to reverse, reorder, or remove nodes without extra space for a new list.
  • The problem talks about next pointers, not indices, so array tricks don't apply.
  • A 'convert to a list' solution works but costs O(n) space; this pattern uses fixed pointers instead.
  • Locating a node relative to another (nth from the end, the middle) often pairs this with Two Pointers.

What's on the sheet

The guard rails never move. Step 3 does each problem's rewiring.

  1. Define the node. A node only knows its value and what comes next.
  2. Guard the edges. An empty or single-node list has nothing left to do.
  3. Walk and Rewire. Each problem rewires differently; the walk is fixed.
  4. Return. prev, not curr, is the new head.

Watch out

  • Save curr.next into temp before overwriting curr.next = prev, or you lose the rest of the list.
  • Removing at the head needs a dummy node, like in Remove Nth Node From End of List, where fast walks n + 1 steps ahead of slow before both move together.

How to earn it

Solve half of the Linked List Manipulation problems on InterviewCrunch and the sheet is yours. Free accounts included. Members can download every sheet right away.

Want to see a finished sheet first? Preview the Two Pointers sample.

Every pattern has a sheet. See the full set.