Linked List Problems for Coding Interviews

Linked list questions test pointer handling under pressure: reversing a list, detecting a cycle, merging sorted lists and finding the middle. A dummy head node and the fast and slow pointer technique remove most of the special cases.

Draw the pointers before coding and update them in the right order so you never lose the rest of the list. Practise doing each task in one pass and O(1) extra space, and test the empty list and single node.

Coding problems

Related

Frequently asked questions

How do I get good at linked list problems?

Solve a few problems of each difficulty, name the pattern after you solve each one, and revisit the ones you needed hints for a week later. The list on this page is ordered so you can start with the basic ones.

Can I run linked list problems online here?

Yes. Every problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and six more languages, with no setup.