🎯SUPER EASY FOR BEGINNERS 👏
Code


# Code
```python3 []
# Definition for singly-linked list.
# class ListNode:
#     def __init__(self, val=0, next=None):
#         self.val = val
#         self.next = next
class Solution:
    def modifiedList(self, nums: List[int], head: Optional[ListNode]) -> Optional[ListNode]:

        dummy = ListNode(-1)
        temp = dummy
        nums_set = set(nums)   # If we use List it make O(N) time complexity
                               # Id we use Set() this makes O(1) time Complexity

        curr = head
        while curr:
            if curr.val not in nums_set:
                temp.next = ListNode(curr.val)
                temp = temp.next
            curr = curr.next
        return dummy.next
        
```
![ba0bc1d0-c297-43a2-b6a7-e2a943eaa77b_1701996327.3360279.png](https://assets.leetcode.com/users/images/86cf549e-8a12-487c-b99b-d81c8a375ae0_1738340008.702124.png)

['Python3']