Simple C++ iterative solution + comments (97% faster)
cpp\nclass Solution {\npublic:\n    ListNode* deleteDuplicates(ListNode* head) {\n        // handle edge cases, if list is empty\n        // or if it has one el
```cpp\nclass Solution {\npublic:\n    ListNode* deleteDuplicates(ListNode* head) {\n        // handle edge cases, if list is empty\n        // or if it has one element, return it\n        if (head == nullptr || head->next == nullptr) {\n            return head;\n        }\n        \n        // create an auxiliary head pointer\n        // and a new iterator\n        auto auxiliary_head = new ListNode(-1);\n        auto iter = auxiliary_head;\n        \n        while (head != nullptr) {\n            if (head->next && head->val == head->next->val) {\n                // if current node value is equal to its next value\n                // skip all nodes of that value\n                int curr = head->val;\n                while (head && head->val == curr) {\n                    head = head->next;\n                }\n            } else {\n                // otherwise, assign node to next iterator\n                // increment new iterator and increment node\n                iter->next = head;\n                iter = iter->next;\n                head = head->next;\n            }\n        }\n        \n        // we need to cut the cord\n        iter->next = nullptr;\n        \n        // return new head\n        return auxiliary_head->next;\n    }\n};\n```
['Iterator', 'C++']