8ms clean C++ code
This is not a hard problem, but it is also not very easy to make the code clean and neat.\n\n    class Solution {\n        public:\n            ListNode deleteD
This is not a hard problem, but it is also not very easy to make the code clean and neat.\n\n    class Solution {\n        public:\n            ListNode* deleteDuplicates(ListNode* head) {\n                if( !head ) return NULL;\n                ListNode* p = new ListNode(head->val-1), *ptr = p, *pre = p;\n                while( head ) {\n                    if( pre->val != head->val && (!head->next || head->next->val != head->val )) {\n                        ptr->next = head;\n                        ptr = ptr->next;\n                    }\n                    pre = head;\n                    head = head->next;\n                }\n                ptr->next = NULL;\n                return p->next;\n            }\n    };
[]