✅Python3 || C++|| Java✅ [Beats 97%]
Please Upvote \uD83D\uDE07\n# Before\n# Python3\n\nclass MyHashSet:\n\n    def __init__(self):\n        self.mp=defaultdict(int)\n        \n\n    def add(self, 
# Please Upvote \uD83D\uDE07\n# Before\n# Python3\n```\nclass MyHashSet:\n\n    def __init__(self):\n        self.mp=defaultdict(int)\n        \n\n    def add(self, key: int) -> None:\n        self.mp[key]=True\n        \n\n    def remove(self, key: int) -> None:\n        self.mp[key]=False\n\n    def contains(self, key: int) -> bool:\n        return self.mp[key]\n        \n```\n# After\n# C++\n```\nclass MyHashSet {\nprivate:\n    std::vector<bool> mp;\n\npublic:\n    MyHashSet() {\n        mp.resize(1000001, false);\n    }\n\n    void add(int key) {\n        mp[key] = true;\n    }\n\n    void remove(int key) {\n        mp[key] = false;\n    }\n\n    bool contains(int key) {\n        return mp[key];\n    }\n};\n\n```\n# Python3\n```\nclass MyHashSet:\n\n    def __init__(self):\n        self.mp=[False]*1000001\n        \n\n    def add(self, key: int) -> None:\n        self.mp[key]=True\n        \n\n    def remove(self, key: int) -> None:\n        self.mp[key]=False\n\n    def contains(self, key: int) -> bool:\n        return self.mp[key]\n\n```\n# Java\n```\nclass MyHashSet {\n    private boolean[] mp;\n\n    public MyHashSet() {\n        mp = new boolean[1000001];\n        Arrays.fill(mp, false);\n    }\n\n    public void add(int key) {\n        mp[key] = true;\n    }\n\n    public void remove(int key) {\n        mp[key] = false;\n    }\n\n    public boolean contains(int key) {\n        return mp[key];\n    }\n}\n```\n![image.png](https://assets.leetcode.com/users/images/686e141e-52e4-46ad-beb6-8a33cd3caf80_1681363181.6946194.png)
['C++', 'Java', 'Python3']