Easy C++ Solution ✅✅
Code\n\nclass Solution {\npublic:\n    ListNode* modifiedList(vector<int>& nums, ListNode* head) {\n        unordered_set<int> s;\n        int n=nums.size();\n 
# Code\n```\nclass Solution {\npublic:\n    ListNode* modifiedList(vector<int>& nums, ListNode* head) {\n        unordered_set<int> s;\n        int n=nums.size();\n        for(int i=0;i<n;i++){\n            s.insert(nums[i]);\n        }\n        ListNode * ans=head;        \n        while(ans!=NULL && s.find(ans->val)!=s.end()){\n            ans=ans->next;       //Check for the head node excusively\n        }\n        head=ans;\n        while(head!=NULL && head->next!=NULL){\n            if(s.find(head->next->val)!=s.end()){\n                head->next=head->next->next;\n                continue;\n            }\n            head=head->next;\n        }\n        return ans;\n    }\n};\n```
['Linked List', 'C++']