标签:
public ListNode deleteDuplicates(ListNode head) { if(head==null || head.next==null) return head; ListNode pre=head;; ListNode p=head.next; while(p!=null) { if(p.val==pre.val) { pre.next=p.next; p=p.next; } else { pre=p; p=p.next; } } return head; }
LeetCode Remove Duplicated from Sorted List
标签:
原文地址:http://www.cnblogs.com/maydow/p/4634172.html