Dsa
Linked List
Medium
Remove Duplicates From Sorted List
Given a sorted linked list, remove the duplicates such that each element appears only once.
The input will be a series of integers representing the linked list elements, separated by spaces. The last integer will be -1, which signifies the end of the list.
Output the modified linked list in the same space-separated format, ending with -1.
Example Input:
1 1 2 -1
Example Output:
1 2 -1
Key concepts
linked_listduplicate_removal
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