Remove Duplicates from Sorted List
Med Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
Thoughts
删除结点肯定需要记录下要被删的结点的next,所以新建next指针
Code
Analysis
TC: O(n)
Last updated
Was this helpful?