The Reverse Linked List II interview question asks you to reverse only a specific portion of a linked list — from position left to position right (1-indexed) — in-place, and return the modified list head. The rest of the list remains unchanged. This is a more nuanced version of the full reversal, requiring careful pointer management to splice the reversed segment back into the original list.
This problem is asked at Apple, Uber, Microsoft, Meta, Amazon, TikTok, Oracle, Google, Bloomberg, and Adobe because it requires combining navigation to a specific position with in-place reversal and reconnection of list segments. It tests pointer manipulation precision and the ability to handle edge cases like left == 1 (head is part of the reversed segment) cleanly using a dummy node.
The pattern is locate-reverse-reconnect with a dummy head. Use a dummy node pointing to head. Navigate to position left - 1 (the node just before the reversal starts). Save this as pre. Reverse the sublist from left to right using the standard three-pointer technique. After reversal, connect pre.next to the new sublist head, and the original sublist head (now the tail) to right.next. Return dummy.next.
List: 1 → 2 → 3 → 4 → 5, left=2, right=4.
pre = node(1), curr = node(2).4 → 3 → 2.pre.next (node 1) → node(4), node(2).next → node(5).Result: 1 → 4 → 3 → 2 → 5.
left == 1.right.next before completing the reversal.left - 1.right - left + 1.For the Reverse Linked List II coding problem, the linked list interview pattern with dummy head and sublist reversal is key. Practice the "pre + curr" navigation pattern and internalize the reconnection step. Interviewers at Disney and Revolut often test this with left=1 as an edge case — ensure your dummy node handles it without any special-case code. Draw the before/after pointer diagram for a small example before coding.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Delete Node in a Linked List | Medium | Solve | |
| Odd Even Linked List | Medium | Solve | |
| Merge In Between Linked Lists | Medium | Solve | |
| Split Linked List in Parts | Medium | Solve | |
| Find the Minimum and Maximum Number of Nodes Between Critical Points | Medium | Solve |