Remove Duplicates from a Sorted Linked List

In this tutorial, I am going to discuss a programming question to remove duplicates from a sorted linked list.

Given a sorted linked list, write a code to remove all duplicates such that each element appears only once.

For example:

Input:

1 -> 2 -> 2 -> 3 -> 3 -> NULL

Output:

1 -> 2 -> 3 -> NULL