Beginner Friendly Solution || Hash map || C++ || O(N)
Complexity\n- Time complexity:\nO(N)\n# Code\n\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *   
# Complexity\n- Time complexity:\nO(N)\n# Code\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        ListNode* temp=head;\n        ListNode* newlist=new ListNode();\n        ListNode* temp2=newlist;\n        map<int,int>m;\n        while(temp)\n        {\n            m[temp->val]++;\n            temp=temp->next;\n        }\n        for(auto i=m.begin();i!=m.end();i++)\n        {\n            if(i->second==1)\n            {\n                cout<<i->first<<endl;\n                ListNode* node=new ListNode(i->first);\n                temp2->next=node;\n                temp2=temp2->next;\n            }\n        }\n        return newlist->next;\n    }\n    \n};\n```\n![c2826b72-fb1c-464c-9f95-d9e578abcaf3_1674104075.4732099.jpeg](https://assets.leetcode.com/users/images/98ecf9d3-1257-4ca7-9638-6b2afb6c4ce6_1694792835.9833024.jpeg)\n
['Hash Table', 'Linked List', 'C++']