✅ Easy C++ Solution
Code\n\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *     ListNode() : val(0), next(nullptr) {}\
# 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* modifiedList(vector<int>& nums, ListNode* head) {\n        unordered_set<int> s(nums.begin(), nums.end());\n        \n        ListNode* newHead = new ListNode(0);\n        newHead-> next = head;\n        ListNode* prev = newHead;\n        ListNode* current = head;\n        \n        while(current != NULL)\n        {\n            if(s.find(current-> val) != s.end())\n            {\n                prev-> next = current-> next;\n                delete current;\n                current = prev-> next;\n            }\n            else\n            {\n                prev = current;\n                current = current-> next;\n            }\n        }\n        ListNode* result = newHead-> next;\n        delete newHead;\n        return result;\n    }\n};\n```
['C++']