
Merge Two Sorted Lists
The common failure mode here is treating linked lists like arrays: copy the values, sort them, and rebuild. That throws away the structure the problem…
View solutionReverse, splice, partition, rotate, and delete linked-list nodes safely in place.
Problems
Practice problems that share this primary solution pattern and compare the clues that reveal it.

The common failure mode here is treating linked lists like arrays: copy the values, sort them, and rebuild. That throws away the structure the problem…
View solution
A value swap can produce the right sequence while violating the contract. The real task is to move node identities by changing links—and to do it without…
View solution
Reversing a linked-list segment is easy. Preserving everything on both sides of that segment is the real interview problem.
View solution
The target is named from the end, but a singly linked list only lets you move forward. The key move is to convert that backward-looking position into a…
View solution
A linked-list partition fails in one of two ways: it loses the unread suffix, or it preserves a stale link and creates the wrong structure. The reliable…
View solution
When a problem says “remove duplicates,” the first instinct is often to reach for a set. That works for an unsorted list, but it misses the key clue here:…
View solution
The key distinction is easy to miss: this problem removes every node belonging to a repeated value. It does not keep the first occurrence. The solution is…
View solution
A localized reversal fails at the boundaries: the middle looks correct, but the prefix disappears, the suffix becomes unreachable, or the returned head is…
View solution
A right rotation looks repetitive when described one node at a time. The useful implementation is one split, one reconnection, and one cut.
View solution