Coding · must-tier · asked at Amazon, Apple, Google, Meta, Microsoft, Netflix
Reverse Linked List
Problem
You are given the head of a singly linked list. Reverse the order of the nodes in place so that the last node becomes the first, and return the new head. You may not allocate new list nodes; only pointer fields may change.
- The list contains between 0 and 8,000 nodes.
- Node values fit in a signed 32-bit integer.
Examples
4 -> 8 -> 15 -> 16 -> 23 -> 42→42 -> 23 -> 16 -> 15 -> 8 -> 4.-3 -> 9→9 -> -3. Two nodes: the old tail becomes the head.- empty list → empty list. A single node is likewise returned unchanged.
Hints
- To make a node point backwards you need to know its predecessor, which a singly linked node does not store.
- Walk the list keeping the previous node in a variable. Before you redirect
node.next, save the oldnextor you lose the rest of the list. - Three pointers (
prev,curr,nxt): redirect, then advance all three. The recursive version reverses the tail first and then hooks the head onto its end.
Last reviewed 8 September 2026
Locked
Approach · Solution (Python) · Complexity · Follow-ups · Company variations · Tests
The rest of this question — the worked approach, the Python solution with passing tests, complexity, follow-ups and how each company frames it — is part of the guides.
Get the full guide
Pick the company you're interviewing with. Each guide has every question tiered for that loop — one-time purchase, lifetime access.
Secure payment by Stripe · instant access · refund questions: [email protected]
Also in: Apple, Google, Meta, Microsoft, Netflix
Interviewing at more than one? All 6 guides for $499 · save $395
Not ready to buy? Get the free starter pack — 13 questions with full solutions.