✅ Easy C++ Soln ✅
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\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        set<int> st(nums.begin(), nums.end());\n\n        ListNode* curr = head;\n\n        while(curr)\n        {\n            if(st.count(curr->val))\n            {\n                curr = curr->next;\n            }\n            else break;\n        }\n\n        ListNode* newHead = curr;\n\n        while(curr && curr->next)\n        {\n            if(st.count(curr->next->val))\n            {\n                curr->next = curr->next->next;\n            }\n            else\n            {\n                curr = curr->next;\n            }\n        }\n\n        return newHead;\n    }\n};\n```
['Linked List', 'C++']