LeetCode 206 ·
Easy
Reverse Linked List
Reverse a singly linked list.
Try it
Step through the core mechanic. The simulator below runs the linked list shape this problem is built on.
Walk the pattern
No dedicated step-through for this one yet. The shape is Linked list — its pattern page has the interactive walkthrough, the reference implementation, and a five-problem progression that this problem sits inside.
The approach
Walk with prev/curr; each step save next, point curr.next back to prev, advance both. prev ends on the new head. The iterative version is O(1) space.
| Aspect | Value |
|---|---|
| Pattern | Linked list |
| Recognise it by | Flip the direction of next pointers. |
| Time complexity | O(n) |
| Space complexity | O(1) |
| Difficulty | Easy |
Who asks it
Companies known to ask this problem, from public LeetCode company-tag aggregations. A signal of where to expect it, not a guarantee.