Remove Duplicates from Sorted List II Problem

Remove Duplicates from Sorted List II Problem — ExecCode Medium DSA Practice

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

Problem description

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers. For Remove Duplicates from Sorted List II, focus on the exact input variables, return only the requested value, and preserve the required time complexity for the intended pattern.

Examples

Input head = [1, 2, 3, 3, 4, 4, 5]; Output [1, 2, 5]

Constraints

1 ≤ n ≤ 10^5 Values fit interview constraints

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