标签:ini 重复 turn def color delete find lse insert
/** * 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) { set<int> s; ListNode* temp; ListNode* p=head; ListNode* pre=head; while(p!=NULL){ if(s.find(p->val)!=s.end()){ pre->next=p->next; }else { if(p!=head){ pre=pre->next; } s.insert(p->val); } p=p->next; } return head; } };
标签:ini 重复 turn def color delete find lse insert
原文地址:https://www.cnblogs.com/lettleshel/p/9302358.html