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.
(移除链表中的重复元素(删除出现2次以上的元素))
Example:
1. 指针遍历
在遍历过程中维护一个 p_pre 来记录重复元素之前的位置。具体实现过程如下:
1 | class Solution: |