83. Remove Duplicates from Sorted List

来源:互联网 发布:域名的ns记录 编辑:程序博客网 时间:2024/06/16 16:14

这里写图片描述

    ListNode* deleteDuplicates(ListNode* head) {        ListNode*slow=head,*fast=head;        while(fast){            if(slow->val!=fast->val) {                slow->next=fast;                fast=fast->next;                slow=slow->next;            }else                fast=fast->next;        }        if(slow)slow->next=NULL;        return head;    }
原创粉丝点击