82. Remove Duplicates from Sorted List II
problem description
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
Example 1:
Example 2:
algorithm thought
又是链表问题,并且直接返回一个链表。和之前做链表题一样直接用递归的形式解决
code
algorithm analysis
一次遍历解决,时间复杂度O(n)
Last updated