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
  • Solution Approach
  • Complete Solution
9224 successful submissions.
Asked In:
  • Microsoft
  • VMWare
Click here to jump start your coding interview preparation