Remove Duplicates from Sorted List

Given a sorted linked list, delete all duplicates such that each element appear only once.

For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3, return 1->2->3.

Interview Code Editor
Hints
  • Solution Approach
  • Complete Solution
6455 successful submissions.
Asked In:
  • Microsoft
  • VMWare
Click here to jump start your coding interview preparation