Fast & Slow Pointers
Two pointers moving at different speeds (one step versus two) detect a cycle, find the midpoint, or locate the kth-from-end node in a single pass and O(1) space. It's the go-to for linked-list cycle and middle questions.
7 LeetCode problems solved with the Fast & Slow Pointers pattern. Practice them with spaced repetition so the pattern sticks.
- Delete the Middle Node of a Linked ListMEDIUM · O(n)
- Find the Duplicate NumberMEDIUM · O(n)
- Happy NumberEASY · O(log n)
- Linked List CycleEASY · O(n)
- Linked List Cycle IIMEDIUM · O(n)
- Middle of the Linked ListEASY · O(n)
- Palindrome Linked ListEASY · O(n)
See the full solution
The complete approach, reference solutions in 5 languages, and a step-by-step visualization — then add this problem to your spaced-repetition schedule.
Start free →