Easy Video Solution 🔥 || How to 🤔 in Interview || Using Temp Node ✅
\n\n# Code\njava []\nclass Solution {\n    public ListNode modifiedList(int[] nums, ListNode head) {\n        HashSet<Integer> set = new HashSet<>();\n        L
\n\n# Code\n```java []\nclass Solution {\n    public ListNode modifiedList(int[] nums, ListNode head) {\n        HashSet<Integer> set = new HashSet<>();\n        ListNode dummy = new ListNode(-1);\n        ListNode newnode = dummy;\n        for (int x : nums) {\n            set.add(x);\n        }\n        while (head != null) {\n            if (!set.contains(head.val)) {\n                newnode.next = head;\n                newnode = newnode.next;\n            }\n            head = head.next;\n        }\n        newnode.next = null;\n        return dummy.next;\n    }\n}\n\n```
['Array', 'Hash Table', 'Linked List', 'Java']