Temp Node
A standard linked list removal problem where we use a temp node.\n\nWe also need to use a hashset to check for values efficiently.\n\n> Note that contains was i
A standard linked list removal problem where we use a temp node.\n\nWe also need to use a hashset to check for values efficiently.\n\n> Note that `contains` was introduced in C++20.\n\n**C++**\n```cpp    \nListNode* modifiedList(vector<int>& nums, ListNode* head) {\n    ListNode tmp(0, head);\n    unordered_set<int> s(begin(nums), end(nums));\n    for (auto *p = &tmp; p->next != nullptr; )\n        if (s.contains(p->next->val))\n            p->next = p->next->next;\n        else\n            p = p->next;\n    return tmp.next;\n}\n```
[]