← All problems
Reverse Linked List
Reverse a singly linked list. Implement it iteratively first, then recursively, and be able to explain the pointer manipulation and the recursion's base case in an interview.
Complexity
Time O(n), Space O(1) iterative / O(n) recursive
Common pitfalls
- Losing the next pointer before flipping
- Wrong base case in recursion
Your solution
Log in to save your code and track progress.