Remove Duplicates from Singly Linked List

Given a sorted singly linked list, write code to delete all duplicate elements so that each element appears only once. Modify the list in place and return its head pointer.

Input: List 1 -> 1 -> ...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: