Design HashSet || C++ Solution || Easy to understand || Vector of list || Chaining
Using a vector of list (applying the concept of chaining in hashing to avoid collisions)\n\n\nclass MyHashSet {\npublic:\n    vector<list<int>> store;\n    int 
**Using a vector of list** **(applying the concept of chaining in hashing to avoid collisions)**\n\n```\nclass MyHashSet {\npublic:\n    vector<list<int>> store;\n    int size;\n    MyHashSet() {\n        size=100;\n        store.resize(size);\n    }\n    \n    int hash(int key){\n        return key%size;\n    }\n    \n    list<int> :: iterator search(int key){\n        int i=hash(key);\n        return find(store[i].begin(),store[i].end(),key);\n    }\n    \n    void add(int key) {\n        if(contains(key))   return;\n        int i=hash(key);\n        store[i].push_back(key);\n    }\n    \n    void remove(int key) {\n        if(!contains(key))   return;\n        int i=hash(key);\n        store[i].erase(search(key));\n    }\n    \n    bool contains(int key) {\n        int i=hash(key);\n        if(search(key)!=store[i].end()) return true;\n        else return false;\n    }\n};\n```\n\nIf you liked the solution, please upvote : )
['C', 'C++']