Easy and simple solution in c++ using map
Intuition\nEasy and simple solution in c++ using map\n\n# Approach\nAt first, i put all the numbers that l have to delete from the linked list (head) into the m
# Intuition\nEasy and simple solution in c++ using map\n\n# Approach\n*At first, i put all the numbers that l have to delete from the linked list (head) into the map and loop along the linked list(head) if the number is\'nt in the map, l add it to the linked list(ans).*\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    ListNode* modifiedList(vector<int>& nums, ListNode* head) {\n        map<int,int>mp;\n        for(auto it:nums) mp[it]++;\n        ListNode * ans = new ListNode(0,NULL);\n        ListNode * t = ans;\n        while(head!=NULL){\n            if(!mp[head->val]) {\n                ans->next=new ListNode(head->val);\n                ans=ans->next;\n            }\n            head=head->next;\n        }\n    return t->next;\n    }\n};\n```
['Linked List', 'C++']