数据结构中比较简单的链表题
public ListNode deleteDuplicates(ListNode head) {
ListNode pre = head;
ListNode cur=head.next;
if(head==null||head.next==null)
{return head;}
while (pre.next != null) {
if (pre.val == cur.val) {
pre.next = cur.next;
cur = pre.next;
} else {
pre=cur;
cur=pre.next;
}
}
return head;
}