2019-09-26 08:29:31 -07:00

12 lines
271 B
C

struct ListNode* deleteDuplicates(struct ListNode* head) {
struct ListNode* cur = head;
while (cur && cur->next) {
if(cur->val == cur->next->val)
cur->next = cur->next->next;
else
cur = cur->next;
}
return head;
}