class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
ListNode* p = head;
while (p != NULL)
{
while (p->next != NULL && p->next->val == p->val)
{
p->next = p->next->next;
}
p = p->next;
}
return head;
}
};
LeetCode83. 删除排序链表中的重复元素
最新推荐文章于 2023-01-08 16:08:41 发布