Linked List Interview Questions 2026
Linked lists test your ability to manipulate pointers precisely. A small error in pointer reassignment breaks the entire solution, making clarity of thought critical.
Fast-Slow Pointer
Two pointers moving at different speeds solve several linked list problems. Fast pointer moves 2 steps, slow moves 1. When fast reaches the end, slow is at the midpoint. When they meet, a cycle exists.
Cycle detection: Floyd's tortoise and hare. After detecting a cycle, find the entry point: reset one pointer to head, advance both by 1 step; they meet at the cycle entry. Kth from end: advance fast k steps, then move both until fast reaches the end.
Reversal
Reverse a linked list iteratively: three pointers (prev, curr, next). In each step: save next, point curr to prev, advance prev and curr. Return prev when curr is null.
Reverse in groups of k: reverse each group, connect to previous group. Recursive approach: reverse first k nodes, recurse on rest, connect. Iterative approach: more complex but avoids call stack overhead for large lists.
Merge and Sort
Merge two sorted linked lists: dummy head simplifies boundary handling. Compare heads of both lists, append smaller, advance that pointer. Append remaining non-null list.
Merge sort on linked list: find midpoint (fast-slow), split, recursively sort, merge. Time O(n log n), space O(log n) call stack. In practice, converting to array and sorting may be preferable unless the interviewer specifies in-place.
Common Pointer Bugs
Losing the next pointer before reassigning: always save next_node = curr.next before overwriting curr.next. Returning the wrong head: after reversal, the new head is the last node you processed, not the original head.
Off-by-one in k-th node: initialize fast, then advance it k steps (not k-1). Verify with examples of k=1 (last node) and k=length (first node).
Browse Real Linked List Questions
Real linked list problems from top tech company interviews.
Browse Linked List Questions