3217. Delete Nodes From Linked List Present in Array You are given an array of integers nums and the head of a linked list. Return the head of the modified linked list after removing all nodes from the linked list that have a value that exists in nums. 123456789101112131415161718192021222324252627/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x) : val(x), next(nullptr) {} * ListNode(int x, ListNode *next) : val(x), next(next) {} * }; */class Solution {public: ListNode* modifiedList(vector<int>& nums, ListNode* head) { ListNode* dummy = new ListNode(-1); ListNode* runner = dummy; unordered_set<int> us(begin(nums), end(nums)); while(head) { if(!us.count(head->val)) { runner->next = new ListNode(head->val); runner = runner->next; } head = head->next; } return dummy->next; }};