链表操作
class Solution {
public ListNode deleteDuplicates(ListNode head) {
if (head == null) return head;
if (head.next == null) return head;
ListNode now = head.next;
ListNode last = head;
while (now != null) {
while (now != null && now.val == last.val) {
now = now.next;
}
last.next = now;
last = now;
if (now != null)
now = now.next;
}
return head;
}
}