struct ListNode { int val; struct ListNode *next; }; struct ListNode* deleteDuplicates(struct ListNode* head){ struct ListNode* cur = head; if (head) { while (cur->next) { if (cur->val == cur->next->val) cur->next = cur->next->next; else cur = cur->next; } } return head; }
每日LeetCode - 83. 删除排序链表中的重复元素(C语言)
原文:https://www.cnblogs.com/vicky2021/p/14791111.html