Linked List problems, grouped by pattern
Linked list problems are about pointer discipline. A dummy node removes head edge cases, slow and fast pointers find middles and cycles, and careful reversal handles everything from palindromes to k-group swaps.
When to reach for it
- The head itself might change
- You need the middle, the nth-from-end node or a cycle
- The list must be reversed in place, fully or in parts
Mistakes to watch for
- Losing the next pointer before rewiring
- Returning head instead of dummy.next
- Fast pointer null checks in the wrong order
The 20 problems
1Dummy Node Pattern
- Remove Linked List Elements Animated Easy
- Delete Nodes From Linked List Present in Array Animated Medium
- Merge Two Sorted Lists Animated Easy
- Rotate List Animated Medium
- Swap Nodes in Pairs Animated Medium
- Swapping Nodes in a Linked List Animated Medium
- Remove Duplicates from Sorted List II Animated Medium
2Slow Fast Pointers
- Middle of the Linked List Animated Easy
- Linked List Cycle Animated Easy
- Linked List Cycle II Animated Medium
3Front Back Pointer
- Remove Nth Node From End of List Animated Medium
4Front Middle Back Pointer
- Reverse Linked List Animated Easy
- Reverse Linked List II Animated Medium
- Reverse Nodes in k-Group Animated Hard
- Palindrome Linked List Animated Easy
5Miscellaneous
- Delete Node in a Linked List Animated Medium
- Copy List with Random Pointer Animated Medium
- Intersection of Two Linked Lists Animated Easy
- Partition List Animated Medium
- Sort List Animated Medium