Problem
Problem page: https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/
Topics: Linked List
Difficulty: Medium
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given1->2->3->3->4->4->5, return1->2->5.
Given1->1->1->2->3, return2->3.
Analysis
This one's a lot like Remove Duplicates from Sorted List, except that instead of keeping one copy of each repeated value, you delete all its copies.
Code
1 | class Solution: |
Article link: https://xnerv.wang/en/leetcode-remove-duplicates-from-sorted-list-ii/
