Java | Boolean map | 4 lines
Approach\n Describe your approach to solving the problem. \nSince key <= 1000000, we can simply use a boolean array to keep track of each unique number.\n\n# Co
# Approach\n<!-- Describe your approach to solving the problem. -->\nSince `key <= 1000000`, we can simply use a boolean array to keep track of each unique number.\n\n# Complexity\n- Time complexity: $$O(1)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass MyHashSet {\n  boolean[] set = new boolean[1000001];\n  \n  public void add(int key) {\n    set[key] = true;\n  }\n  \n  public void remove(int key) {\n    set[key] = false;\n  }\n  \n  public boolean contains(int key) {\n    return set[key];\n  }\n}\n```\nIf you like my solution, please upvote it!
['Array', 'Java']