Pattern Recognition Drill
Easy Linked Lists
The Problem
Reverse a singly linked list in-place.
What approach would you use?
Think about it before scrolling down.
prev/cur/next pattern: save next, point cur back to prev, advance both. O(n) time, O(1) space.
Recursive reversal: reverse the rest, then make cur.next.next = cur. Elegant but O(n) stack space.
Common Trap
Don't lose the reference to next_node before rewiring — save it first, then modify cur.next.