Simple to understand!
Complexity\n- Time complexity:O(n)->(here n is size of linked list)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(nums.length)\n Add your 
# Complexity\n- Time complexity:O(n)->(here n is size of linked list)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(nums.length)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\n/**\n * Definition for singly-linked list.\n * public class ListNode {\n *     int val;\n *     ListNode next;\n *     ListNode() {}\n *     ListNode(int val) { this.val = val; }\n *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }\n * }\n */\nclass Solution {\n    public ListNode modifiedList(int[] nums, ListNode head) {\n        HashSet<Integer> set =new HashSet<>();\n        for(int num :nums){\n            set.add(num);\n        }\n        ListNode previous=null;\n        ListNode current=head;\n        while(current!=null){\n            if(set.contains(current.val)){\n                if(previous==null){\n                   current=current.next;\n                   head=current;\n                }else{\n                    current=current.next;\n                    previous.next=current; \n                }\n            } \n           else{\n             previous=current;\n             current=current.next;\n           }\n        }\n        return head;\n    }\n} \n```
['Array', 'Hash Table', 'Linked List', 'Java']