Remove Duplicates from Sorted List Problem

Remove Duplicates from Sorted List Problem — ExecCode Easy DSA Practice

Solve the Remove Duplicates from Sorted List problem on ExecCode. Free online easy DSA practice in Linked List. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well.

Examples

Input head = [1, 1, 2, 3, 3]; Output [1, 2, 3]. Input head = [1, 1, 1]; Output [1]. Input head = []; Output []

Constraints

0 ≤ nodes ≤ 300 -100 ≤ Node.val ≤ 100

Practice Remove Duplicates from Sorted List free on ExecCode. Browse DSA problems, topic map, and placement guides.