Practice SetLesson 051 min read

Fast & Slow Pointers — Practice Problems

November 05, 2026

// How to use this set

Work these in order: easy (Middle of the Linked List, Linked List Cycle, Happy Number, Palindrome Linked List, Intersection of Two Linked Lists) → medium (Linked List Cycle II, Find the Duplicate Number, Remove Nth Node From End, Reorder List, Circular Array Loop). Cover the solution, solve it on paper, then type it out and run it. Every solution below was run and tested.

Ten problems that drill the fast & slow pointer pattern (Floyd’s tortoise-and-hare) from Lesson 5. The reps are the point — read the approach, try it yourself first, then check the code. Each solution here was actually run and tested.

How to practise. The trick with this pattern is always the same: a slow pointer moves one step, a fast pointer two. Before coding, say out loud what the meeting point tells you (a cycle exists, the middle node, the cycle’s entrance). Draw the list, trace both pointers by hand, then write it.

All the linked-list problems below assume this node definition:

class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

The 10 problems

  1. 1Middle of the Linked List (LeetCode 876)EasyReturn the middle node of a linked list in one pass: fast moves two steps, slow moves one.arrow_forward
  2. 2Linked List Cycle (LeetCode 141)EasyDetect whether a linked list loops back on itself: a fast pointer laps a slow one only if there is a cycle.arrow_forward
  3. 3Happy Number (LeetCode 202)EasyDecide if repeatedly summing squared digits reaches 1: treat the numbers as a list and detect a cycle.arrow_forward
  4. 4Palindrome Linked List (LeetCode 234)EasyCheck if a linked list reads the same both ways: find the middle, reverse the back half, compare.arrow_forward
  5. 5Intersection of Two Linked Lists (LeetCode 160)EasyFind the node where two linked lists merge: each pointer walks A then B, so both travel the same distance.arrow_forward
  6. 6Linked List Cycle II (LeetCode 142)MediumReturn the node where a linked list's cycle begins: meet with Floyd's, then walk from head and meeting point.arrow_forward
  7. 7Find the Duplicate Number (LeetCode 287)MediumFind the repeated value without changing the array: read i -> nums[i] as a list, find its cycle start.arrow_forward
  8. 8Remove Nth Node From End of List (LeetCode 19)MediumDelete the n-th node from the end in one pass: give fast an n-node head start, then move both together.arrow_forward
  9. 9Reorder List (LeetCode 143)MediumReorder a list to first, last, second, second-last…: split at the middle, reverse the back half, weave.arrow_forward
  10. 10Circular Array Loop (LeetCode 457)MediumFind a one-direction loop longer than one in a circular jump array: tortoise and hare from each start.arrow_forward