Solution in Java and C
Code
# Code
```java []
class Solution {
    public ListNode modifiedList(int[] nums, ListNode head) {
        Set<Integer> set = new HashSet<>();
        for (int val : nums){
            set.add(val);
        }

        ListNode dummy = new ListNode(0,head);
        ListNode current = dummy;
        while (current.next != null) {
            if (set.contains(current.next.val)) {
                current.next = current.next.next;
            } else
                current = current.next;
        }

        return dummy.next;
    }
}
```
```c []
struct ListNode* modifiedList(int* nums, int numsSize, struct ListNode* head) {
    bool* hash = calloc(100001, sizeof(bool));
    for (int i = 0; i < numsSize; i++) {
        hash[nums[i]] = true;
    }

    struct ListNode dummy;
    dummy.next = head;

    struct ListNode* current = &dummy;
    while (current->next) {
        if (hash[current->next->val]) {
            current->next = current->next->next;
        } else
            current = current->next;
    }

    free(hash);
    return dummy.next;
}
```
['Array', 'Hash Table', 'Linked List', 'C', 'Java']