遍历list,如果遇到相等的数,就删除那个节点,否则指针前移
public ListNode deleteDuplicates(ListNode head) {
ListNode p = head;
while(p != null && p.next!= null){
if(p.val == p.next.val)p.next=p.next.next;
else p = p.next;
}
return head;
}