✅ Java Solution
CODE\nJava []\npublic ListNode modifiedList(int[] nums, ListNode head) {\n\tSet<Integer> dup = new HashSet();\n\tfor(int num : nums) dup.add(num);\n\n\tListNode
## **CODE**\n```Java []\npublic ListNode modifiedList(int[] nums, ListNode head) {\n\tSet<Integer> dup = new HashSet();\n\tfor(int num : nums) dup.add(num);\n\n\tListNode res = new ListNode(-1);\n\tListNode trv = res;\n\twhile(head != null) {\n\t\tif(!dup.contains(head.val)) {\n\t\t\ttrv.next = head;\n\t\t\ttrv = trv.next;\n\t\t}\n\t\thead = head.next;\n\t}\n\ttrv.next = null;\n\treturn res.next;\n}\n```
['Java']