C++ 2d vector and mod
erasing from the vector is o(n) so, this is not optimal, but it works for this problem.\n\nSolved LIVE ON STREAM. everyday 6pm PT. Link in profile\n\n\nclass My
erasing from the vector is o(n) so, this is not optimal, but it works for this problem.\n\n**Solved LIVE ON STREAM. everyday 6pm PT. Link in profile**\n\n```\nclass MyHashSet {\npublic:\n    int MOD;\n    vector<vector<int>> stuff;\n    MyHashSet() {\n        MOD = 1000;\n        stuff.resize(MOD);\n    }\n    \n    void add(int key) {\n        int myKey = key % MOD;\n        for(int x : stuff[myKey]) {\n            if(x == key) return;\n        }\n        stuff[myKey].push_back(key);\n    }\n    \n    void remove(int key) {\n        int myKey = key % MOD;\n        auto it = find(stuff[myKey].begin(), stuff[myKey].end(), key);\n        if(it != stuff[myKey].end()) {\n            stuff[myKey].erase(it);\n        }       \n    }\n    \n    bool contains(int key) {\n        int myKey = key % MOD;\n        auto it = find (stuff[myKey].begin(), stuff[myKey].end(), key);\n        return it != stuff[myKey].end();\n\n    }\n};\n```
[]