Easy
Reverse Linked List
Re-point each node's next to the node behind it as you walk.
Approach
Keep prev = null and iterate. For each node, remember its next, flip its pointer to prev, then advance prev and current forward. When you fall off the end, prev is the new head. It's an in-place pointer reversal in one pass.
Time complexity
O(n)
Space complexity
O(1)
Common mistake
Losing the rest of the list by overwriting node.next before saving it in a temp.
See it run, step by step
Generate an interactive lesson for Reverse Linked List — trace every variable and watch the algorithm execute until it clicks.
Start a lesson on Reverse Linked List