NC25 删除有序链表中重复的元素-I
struct ListNode* deleteDuplicates(struct ListNode* head ) {
// write code here
if(!head)
return NULL;//空为NULL
struct ListNode*p=head;
while(p->next){//如果next为空就结束
if(p->val==p->next->val)//因为有序
p->next=p->next->next;
else
p=p->next;
}
return head;
}