🔥Simple Brute Force 🎓 ! 💯✔🔥
\n\n# Code\ncpp []\nclass Solution {\npublic:\n    ListNode* modifiedList(vector<int>& nums, ListNode* head) {\n        set<int> st;\n        int n = nums.size(
\n\n***# Code***\n```cpp []\nclass Solution {\npublic:\n    ListNode* modifiedList(vector<int>& nums, ListNode* head) {\n        set<int> st;\n        int n = nums.size();\n        for (int i = 0; i < n; i++) {\n            st.insert(nums[i]);\n        }\n        ListNode* dummy = new ListNode(-1);\n        dummy->next = head;\n        ListNode* newdummy = dummy;\n        while (dummy->next != nullptr) {\n            int t = dummy->next->val;\n            if (st.find(t) != st.end()) {\n                ListNode* newnode = dummy->next;\n                dummy->next = newnode->next;\n                continue;\n            }\n            dummy = dummy->next;\n        }\n        return newdummy->next;\n    }\n};\n```
['Array', 'Hash Table', 'Linked List', 'C++']