Coding Interview Club

Prepare for coding interviews in simple and structured steps

Problems on Linked Lists for Interviews and Self Assessment

Category: 
Problem: 

I will list down some problems on the topic of linked lists that are commonly asked in interviews.

 

Important concepts to revise before trying out the problems:

  • Linked List
  • Node of a Linked List
  • Singly Linked List
  • Doubly Linked List
  • Inserting and deleting nodes in a Linked List
  • Runner technique - There will be more pointers and they will move forward at different speeds.

 

Problems

  1. Reverse a linked list
  2. Remove duplicates from a sorted linked list.
  3. Remove duplicates from an unsorted linked list.
  4. Find the Kth to last element in a linked list
  5. Delete a node in the middle of a singly linked list, given only access to that node.
  6. Given a linked list with a loop (circular linked list), find the node at the beginning of the loop.
  7. Partitian a linked list around a given value x, with all nodes with values less than x should come before all nodes with values greater than or equal to x.
  8. Given two sorted (ascending) linked lists L1 and L2. Write a program to merge them into a single descending linked list. 
    • Example:
      • List1 = 5>15>25>35>null.
      • List2 = 1>10>20>30>null.
      • ResultList = 35>30>25>20>15>10>5>1>null.
  9. Find the middle element of linked list in one Pass?

Important Note!

  • I will add more to the list whenever I come across a new one.
  • If you were asked a problem not listed here, please let us know and we will add it here. You will also receive points. If you can provide a good solution and explanation also for your problem, you will get extra points and even cash prizes. 
Solution: 

Refer to individual problems under corresponding problem category for solutions.

Back to Top