标签:class head move while from node let list dup
https://leetcode.com/problems/remove-duplicates-from-sorted-list/
public ListNode deleteDuplicates(ListNode head) { int last = -1; ListNode store = null; ListNode cur = head; while (cur != null) { if (store == null) { store = head; } else if (cur.val != last) { store = store.next; store.val = cur.val; } last = cur.val; cur = cur.next; } if (store != null) { store.next = null; } return head; }
remove-duplicates-from-sorted-list
标签:class head move while from node let list dup
原文地址:http://www.cnblogs.com/charlesblc/p/6001379.html