Given a singly linked list, explain how you would reverse it in place.
For example, given the list: 1 -> 2 -> 3 -> 4 -> 5, the reversed list would be: 5 -> 4 -> 3 -> 2 -> 1.
Walk me through your approach step by step. What pointers do you need to maintain? How do you handle edge cases like an empty list or a single-node list?
Explain your approach and analyze the time and space complexity.
How to approach it
- Hint 1
Think about what happens to each node's next pointer during reversal.
- Hint 2
You need to track three pointers: the previous node, the current node, and the next node.
- Hint 3
At each step, redirect the current node's next pointer to the previous node, then advance all three pointers forward.
Ready to answer it out loud?
Record your answer in 1:00 and Preptile scores it 1–10 with specifics — what landed, what you skipped, and what to say next time.
Practising needs an invite code. Join the waitlist and we’ll send you one.