3 ways to resolve problem: binary search, hashmap and optimized way
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code 1 - Binary Search\n```golang []\n/**\n * Definition for singly-linked list.\n * type ListNode struct {\n *     Val int\n *     Next *ListNode\n * }\n */\nfunc binarySearch(nums []int, val int) bool {\n    low, high := 0, len(nums)-1\n\tvar mid int\n\n\tfor high >= low {\n\t\tmid = low + (high-low)/2\n\n\t\tif nums[mid] == val {\n\t\t\treturn true\n\t\t}\n\n\t\tif nums[mid] > val {\n\t\t\thigh = mid - 1\n\t\t} else {\n\t\t\tlow = mid + 1\n\t\t}\n\t}\n\n\treturn false\n}\n\nfunc modifiedList(nums []int, head *ListNode) *ListNode {\n\tdumpHead := &ListNode{0, head}\n\tcurrent := dumpHead\n    \n    slices.Sort(nums)\n\tfor current.Next != nil {\n\t\tif binarySearch(nums, current.Next.Val) {\n\t\t\tcurrent.Next = current.Next.Next\n\t\t} else {\n\t\t\tcurrent = current.Next\n\t\t}\n\t}\n\n\treturn dumpHead.Next\n}\n```\n\n# Code 2 - Hashmap\n\n```golang []\n\nfunc modifiedList(nums []int, head *ListNode) *ListNode {\n    m := make(map[int]bool)\n    for _, num := range nums {\n        m[num] = true\n    }\n\n\tdumpHead := &ListNode{0, head}\n\tcurrent := dumpHead\n    \n\tfor current.Next != nil {\n\t\tif m[current.Next.Val] {\n\t\t\tcurrent.Next = current.Next.Next\n\t\t} else {\n\t\t\tcurrent = current.Next\n\t\t}\n\t}\n\n\treturn dumpHead.Next\n}\n```\n\n# Code 3 - Runtime beat 100%, Memory beat 97,57%\n```golang []\nfunc modifiedList(nums []int, head *ListNode) *ListNode {\n    m := [100001]bool{}\n    for _, num := range nums {\n        m[num] = true\n    }\n\n\tdumpHead := &ListNode{0, head}\n\tcurrent := dumpHead\n    \n\tfor current.Next != nil {\n\t\tif m[current.Next.Val] {\n\t\t\tcurrent.Next = current.Next.Next\n\t\t} else {\n\t\t\tcurrent = current.Next\n\t\t}\n\t}\n\n\treturn dumpHead.Next\n}\n```\n
['Hash Table', 'Binary Search', 'Go']