11 lines C++ solution with comments
\tListNode *deleteDuplicates(ListNode *head) {\n        if(!head||!head->next)return head;\n        ListNode *newhead=0,**phead=&newhead;//phead pointer to new 
    \tListNode *deleteDuplicates(ListNode *head) {\n        if(!head||!head->next)return head;\n        ListNode *newhead=0,**phead=&newhead;//phead pointer to new head pointer\n        while(head)\n        {\n            if(head->next&&head->val==head->next->val)\n\t\t\t{//skip all nodes has duplicate value\n\t\t\t\tint dupval=head->val;\n\t\t\t\twhile(head&&head->val==dupval)head=head->next;\n\t\t\t\tcontinue;\n\t\t\t}//assign and advance phead\n\t\t\telse {*phead=head; phead=&((*phead)->next);}\n\t\t\thead=head->next;\n        }\n        *phead=0;// point the next of last node to NULL\n        return newhead;\n    }
[]