标签:存在 tno span || color 链表 amp node new
题目描述
class Solution { public: ListNode *deleteDuplication(ListNode *pHead) { if (pHead == NULL || pHead->next == NULL) return pHead; ListNode *head = new ListNode(pHead->val - 1); head->next = pHead; ListNode *p = head; ListNode *q = head->next; while (q) { while (q->next && (q->next->val == q->val)) { q = q->next; } if (p->next != q) { q = q->next; p->next = q; } else { p = q; q = q->next; } } return head->next; } };
标签:存在 tno span || color 链表 amp node new
原文地址:https://www.cnblogs.com/ruoh3kou/p/10240265.html