82.Remove Duplicates from Sorted List II (M)
1.Description(Medium)
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.
Example
Given1->2->3->3->4->4->5
, return1->2->5
.
Given1->1->1->2->3
, return2->3
.
2.Code
https://www.jiuzhang.com/solutions/remove-duplicates-from-sorted-list-ii/
此题与112相比,有可能会换head,所以要用dummy来做。而且要一次性删完所有的重复值。
Last updated