✔️ [Python] Simple, Easy Solution with HashTable, Array and LinkedList
Approach-1: Using Dictionary\n\n\nclass MyHashSet:\n\n    def __init__(self):\n        self.d = {}\n\n    def add(self, key: int) -> None:\n        self.d[key] 
#### Approach-1: Using Dictionary\n\n```\nclass MyHashSet:\n\n    def __init__(self):\n        self.d = {}\n\n    def add(self, key: int) -> None:\n        self.d[key] = 1\n\n    def remove(self, key: int) -> None:\n        self.d[key] = 0\n\n    def contains(self, key: int) -> bool:\n        return self.d.get(key,0)!=0\n```\n\n\n#### Approach-2: Using Array+Linked-List\n```\nclass ListNode:\n    def __init__(self, val=0, next=None):\n        self.val = val\n        self.next = next\n    \nclass MyHashSet:    \n    \n    def __init__(self):\n        self.size = 1000\n        self.arr = [None]*self.size\n\n    def find_index(self, key):\n        return key % self.size\n    \n    def find_value(self, key):\n        idx = self.find_index(key)\n        head = self.arr[idx]\n        while head:\n            if head.val == key: return 1\n            head = head.next\n        return 0\n\n    def add(self, key: int) -> None:\n        if self.find_value(key): return\n        idx = self.find_index(key)\n        self.arr[idx] = ListNode(key, self.arr[idx])\n\n    def remove(self, key: int) -> None:\n        idx = self.find_index(key)\n        node = self.arr[idx]\n        if node is None: \n            return \n        if node.val==key:\n            self.arr[idx] = node.next\n            return \n        first, second = node, node.next\n        while second:\n            if second.val == key:\n                first.next = second.next\n                return\n            first, second = first.next, second.next\n\n    def contains(self, key: int) -> bool:\n        return self.find_value(key)\n```\n\nIf you think this post is **helpful** for you, hit a **thums up.** Any questions or discussions are welcome!\n\n
['Array', 'Hash Table', 'Linked List', 'Python', 'Python3']