题解 | #删除有序链表中重复的元素-I#
删除有序链表中重复的元素-I
https://www.nowcoder.com/practice/c087914fae584da886a0091e877f2c79
struct ListNode* deleteDuplicates(struct ListNode* head ) { if(head == NULL) return NULL; struct ListNode* cur = head; while(cur->next) { struct ListNode* next = cur->next; if(cur->val == next->val) { cur->next = next->next; free(next); } else { cur = cur->next; } } return head; }