LeetCode Β· Linked List
Linked List Problem Set
Pointer manipulation β reversals, merges, cycle detection, and reordering. The key: draw the pointers on paper before coding.
Concept page: Linked List
| Difficulty | Pattern | Problem | Key Insight |
|---|---|---|---|
| Easy | reversal | LC 206 Β· Reverse Linked List | Iterative three-pointer swap. O(n). |
| Easy | merge | LC 21 Β· Merge Two Sorted Lists | Dummy head, compare and link. O(n + m). |
| Easy | fast-slow | LC 141 Β· Linked List Cycle | Floyd's tortoise and hare. O(n). |
| Medium | fast-slow | LC 142 Β· Linked List Cycle II | After the Floyd meeting point, reset one pointer to head and walk both at the same speed to find the cycle entry. |
| Medium | reorder | LC 143 Β· Reorder List | Find middle β reverse second half β merge alternating. O(n). |
| Medium | removal | LC 19 Β· Remove Nth Node From End of List | Two pointers with n-gap. O(n) one pass. |
| Medium | math | LC 2 Β· Add Two Numbers | Digit-by-digit addition with carry. O(max(m,n)). |
| Medium | copy | LC 138 Β· Copy List with Random Pointer | HashMap oldβnew, or interleave-then-separate. O(n). |
| Medium | fast-slow | LC 287 Β· Find the Duplicate Number | Floyd's cycle detection on index-value mapping. O(n). |
| Hard | merge | LC 23 Β· Merge k Sorted Lists | Min-heap of k list heads, or divide-and-conquer merge. O(n log k). |