The Reverse Nodes in k-Group interview question asks you to reverse the nodes of a linked list in groups of k at a time, and return the modified list. If the number of remaining nodes is less than k, those nodes are left as-is in their original order. The modification must be done in-place without altering node values.
This HARD problem is asked at Apple, Cisco, Uber, Goldman Sachs, Microsoft, Meta, Amazon, Google, Bloomberg, and Adobe because it is the most demanding linked list reversal problem. It requires combining group counting, in-place reversal, and correct reconnection — all repeatedly. It is a direct test of linked list mastery and the ability to write clean, correct pointer code under pressure.
The pattern is iterative group reversal with a dummy head. Use a dummy node. For each group: first, check if k nodes remain (if not, done). Reverse exactly k nodes using the three-pointer technique, then reconnect the previous group's tail to the new group head and the new group tail to the next group's start. Advance the prev pointer to the new group tail and repeat.
A recursive alternative: check if k nodes remain, reverse the first k nodes, then recursively process the rest and connect.
List: 1 → 2 → 3 → 4 → 5, k=2.
Result: 2 → 1 → 4 → 3 → 5.
k=3 on same list:
Result: 3 → 2 → 1 → 4 → 5.
k nodes remain before reversing — reversing an incomplete group violates requirements.prev to the tail of the reversed group before the next iteration.For the Reverse Nodes in k-Group coding problem, the linked list and recursion interview pattern is the gold standard. Master this problem and Remove Nth Node From End of List — together they cover the hardest linked list interview scenarios. Interviewers at Goldman Sachs and Nutanix often use k-Group as the final challenge in a linked list round. Practice until you can code both the iterative and recursive versions fluently, and be ready to compare their space complexity (iterative: O(1), recursive: O(n/k) stack).