[C++] || 95% faster
\n\n\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *     ListNode() : val(0), next(nullptr) {}\n 
![image](https://assets.leetcode.com/users/images/002a7e8a-8850-455a-bfad-c32c2e7efd6f_1646794760.4226303.png)\n\n```\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *     ListNode() : val(0), next(nullptr) {}\n *     ListNode(int x) : val(x), next(nullptr) {}\n *     ListNode(int x, ListNode *next) : val(x), next(next) {}\n * };\n */\nclass Solution {\npublic:\n    ListNode* deleteDuplicates(ListNode* head) {\n        if(head == NULL or head->next == NULL){\n            return head;\n        }\n        ListNode * temp = head;\n        ListNode * prev = new ListNode(-2);\n        ListNode * head1 = prev;\n        prev->next = head;\n        int find = head->val;\n        while(temp != NULL){\n            if(temp != NULL and temp->next != NULL and temp->val == temp->next->val){\n                while(temp != NULL and temp->next != NULL and temp->val == temp->next->val){\n                    temp = temp->next;\n                }\n                prev->next = temp->next;\n                temp = prev->next;\n            }\n            else{\n                prev = prev->next;\n                temp = temp->next;\n                \n            }\n        }\n        return head1->next;\n    }\n};\n```
[]