#82
Remove Duplicates from Sorted List II
specialist · 845 · lc medium +31 · verified · 51.4% accepted · 9,634 likes · top 40%
Description
Delete all nodes from sorted linked list head whose values appear more than once, keeping only nodes with values that occur exactly once. Return the resulting sorted list.
Example 1:
Input: head = [1,2,3,3,4,4,5]
Output: [1,2,5]
Example 2:
Input: head = [1,1,1,2,3]
Output: [2,3]
Code
1
2
3
4
5
6
7
8