leetcode 83删除排序链表中的重复元素
2020-12-13 01:53
阅读:533
标签:isp 技术 efi one audio img leetcode mic control
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: ListNode* deleteDuplicates(ListNode* head) { ListNode *pre, *cur, *ahead; ahead=pre=new ListNode(-1);cur=head; while(cur!=NULL){ while(cur->next!=NULL && cur->val==cur->next->val){ cur=cur->next; } pre->next=cur; pre=cur; cur=cur->next; } return ahead->next; } };
leetcode 83删除排序链表中的重复元素
标签:isp 技术 efi one audio img leetcode mic control
原文地址:https://www.cnblogs.com/joelwang/p/11017565.html
评论
亲,登录后才可以留言!