Reverse a Linked List
CodingTechnical InterviewEasyLast asked 1 year ago
Blink22 interview question (Egypt) · stage: Technical Interview · domain: Coding · role: Software Engineer · difficulty: Easy · asked twice, last in April 2025
What they ask
The online technical interview is one long session (two to three hours) with two senior engineers, and it starts with data structures before moving to databases and design. The opening coding exercise is a classic: reverse a singly linked list, in place, and return the new head.
Examples
1 -> 2 -> 3 -> 4becomes4 -> 3 -> 2 -> 1.- A single node or an empty list is returned unchanged.
Constraints
- Do it without allocating a new list;
O(n)time andO(1)extra space is expected for the iterative version. - Then they ask for the recursive version and what its space cost is.
What they look for
- Correct pointer juggling with three references (
prev,curr,next) and no lost nodes; talk through it as you write. - Testing your own code on the edge cases (empty, one node, two nodes) before they ask.
- Explaining why recursion costs
O(n)stack and when that matters. - Since the session is long, this is also a temperature check on how you communicate under a friendly but persistent pair of interviewers. They said openly that they hire for thinking, not for a specific stack.