Dsa
Linked List
Easy
Remove Duplicates from Linked List
Given a sorted singly linked list, remove all duplicates such that each element appears only once and return the modified list.
Input Format:
- First line: Integer n (the number of nodes).
- Second line: n space-separated integers representing the nodes of the linked list.
Output Format:
- A single line containing the space-separated values of the modified linked list in order.
Example:
Input:
5
1 1 2 3 3
Output:
1 2 3
Key concepts
linked_listdeduplicationset
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