标签:12px logs 保存 存在 相同 保留 ati font 一个
while(pHead -> next != nullptr && tmp == pHead -> next -> val){
pHead -> next = pHead -> next -> next;
}
1 class Solution { 2 public: 3 ListNode* deleteDuplication(ListNode* pHead){ 4 if(pHead == nullptr || pHead -> next == nullptr){ 5 return pHead; 6 } 7 //ListNode* cur = pHead; 8 9 ListNode* dummyNode = new ListNode(-1); 10 dummyNode -> next = pHead; 11 pHead = dummyNode; 12 13 int tmp; 14 15 while(pHead -> next != nullptr && pHead -> next -> next != nullptr){ 16 if(pHead -> next -> val == pHead -> next -> next -> val){ 17 tmp = pHead -> next -> val; 18 while(pHead -> next != nullptr && tmp == pHead -> next -> val){ 19 pHead -> next = pHead -> next -> next; 20 } 21 22 } 23 else{ 24 pHead = pHead -> next; 25 } 26 27 } 28 return dummyNode -> next; 29 } 30 };
标签:12px logs 保存 存在 相同 保留 ati font 一个
原文地址:http://www.cnblogs.com/dingxiaoqiang/p/7511060.html