Simple C++ Solution | Single Pass
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```\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> st(nums.begin(), nums.end());\n        \n        ListNode* temp=new ListNode(-1);\n        \n        ListNode* curr=head;\n        ListNode* t=temp;\n        \n        while(curr!=NULL){\n            if(st.find(curr->val)!=st.end()){\n                curr=curr->next;\n                continue;\n            }\n            \n            ListNode* t2=new ListNode(curr->val);\n            curr=curr->next;\n            t->next=t2;\n            t=t->next;\n        }\n        \n        return temp->next;\n        \n    }\n};\n```
['C++']