###### Middle-题目84：82. Remove Duplicates from Sorted List II

Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1->1->2->3, return 2->3.

struct ListNode* deleteDuplicates(struct ListNode* head) {
else {
while (ptr2) {
ptr1 = ptr2;
while (ptr2 && ptr2->val == ptr1->val)
ptr2 = ptr2->next;
if (ptr1->next == ptr2)  // no duplicate
ptr1 = ptr2;
else {
while (prev->next != ptr1)
prev = prev->next;
prev->next = ptr2;
ptr1 = ptr2;
}
}

}
}

4ms,beats 8.00%,众数4ms,92%

#### Remove Duplicates from Sorted List II -- LeetCode

2014-04-24 08:33:10

#### 82. Remove Duplicates from Sorted List II Leetcode Python

2015-02-05 11:48:11

#### leetcode：82. Remove Duplicates from Sorted List II（Java）解答

2015-12-27 00:18:19

#### leetcode || 82、Remove Duplicates from Sorted List II

2015-04-13 16:47:33

#### LeetCode 82之Remove Duplicates from Sorted List II的Java题解

2015-05-06 17:23:34

#### Remove Duplicates from Sorted List -- LeetCode

2014-04-23 11:25:06

#### 83. Remove Duplicates from Sorted List（python）

2016-09-18 21:34:35

#### LeeCode 82 Remove Duplicates from Sorted List II

2015-05-19 12:52:51

#### leetCode 82.Remove Duplicates from Sorted List II （删除排序链表的重复II） 解题思路和方法

2015-07-22 13:29:46

#### Remove Duplicates from Sorted Array II -- LeetCode

2014-04-23 08:39:29

## 不良信息举报

Middle-题目84：82. Remove Duplicates from Sorted List II