Dsa
Linked List
Hard
Duplicate Remover
You are given a singly linked list of integers where each integer may appear more than once. Your task is to remove all duplicates from the linked list and return the modified list in the same order.
Input Format:
- The first line contains an integer n (the number of nodes in the linked list).
- The next n lines contain one integer each, representing the nodes from head to tail.
Output Format:
- A single line with the modified linked list in order, separated by spaces.
Example:
Input:
5
1
2
2
3
4
Output:
1 2 3 4
Key concepts
linked_listpointer_manipulation
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now