Beats 100% Real Java Solution (Not boolean array)
itemsPerBucket is set to 1001 to deal with the edge case when the key is 0 even though the description specify the number value ranges from 1-100k. This will oc
itemsPerBucket is set to 1001 to deal with the edge case when the key is 0 even though the description specify the number value ranges from 1-100k. This will occupy 1000 additional booleans in memory. \n\n```\nclass MyHashSet {\n\n    private int buckets = 1000;\n    private int itemsPerBucket = 1001;\n    private boolean[][] table;\n    \n    /** Initialize your data structure here. */\n    public MyHashSet() {\n        table = new boolean[buckets][];\n    }\n\n    public int hash(int key) {\n        return key % buckets;\n    }\n\n    public int pos(int key) {\n        return key / buckets;\n    }\n    \n    public void add(int key) {\n        int hashkey = hash(key);\n        \n        if (table[hashkey] == null) {\n            table[hashkey] = new boolean[itemsPerBucket];\n        }\n        table[hashkey][pos(key)] = true;\n    }\n    \n    public void remove(int key) {\n        int hashkey = hash(key);\n\n        if (table[hashkey] != null)\n            table[hashkey][pos(key)] = false;\n    }\n    \n    /** Returns true if this set did not already contain the specified element */\n    public boolean contains(int key) {\n        int hashkey = hash(key);\n        return table[hashkey] != null && table[hashkey][pos(key)];\n    }\n}\n```
[]