Simple 3-Pointer Solution | 8ms | C++
Faster than 93.08% (8ms)\n* Memory usage less than 96.39% (10.8 MB)\n\n\nclass Solution\n{\npublic:\n    ListNode* deleteDuplicates(ListNode* head)\n    {\n    
* Faster than 93.08% (8ms)\n* Memory usage less than 96.39% (10.8 MB)\n\n```\nclass Solution\n{\npublic:\n    ListNode* deleteDuplicates(ListNode* head)\n    {\n        if(!head)\n            return head;\n        \n        ListNode *prev=NULL, *curr=head, *next=curr->next;\n        while(next)\n        {\n            if(curr->val == next->val)\n            {\n                while(next && next->val == curr->val)\n                    next=next->next;\n                if(!prev) // This condition means element at the head is repeating. So, head pointer needs to be shifted.\n                    head=next;\n                else\n                    prev->next = next;\n            }\n            else\n            {\n                prev=curr;\n            }\n            \n            curr=next;\n            if(next)\n                next=curr->next;\n        }\n        return head;\n    }\n};\n```\n#### If you like the solution, do give it an upvote. In case of queries, feel free to leave them in the comment.\n#### LeetCode and Chill !!!
['C', 'C++']