递归版本:
class Solution { public: ListNode* deleteDuplication(ListNode* pHead) { if (pHead==NULL) return NULL; if (pHead!=NULL && pHead->next==NULL) return pHead; ListNode* current; if ( pHead->next->val==pHead->val){ current=pHead->next->next; while (current != NULL && current->val==pHead->val) current=current->next; return deleteDuplication(current); } else { current=pHead->next; pHead->next=deleteDuplication(current); return pHead; } } };