Simple C++ Solution using Linked List
\nclass MyHashSet {\npublic:\n    ListNode*head;\n    MyHashSet() {\n        head=NULL;\n    }\n    \n    void add(int key) {\n        ListNode*temp=head;\n    
```\nclass MyHashSet {\npublic:\n    ListNode*head;\n    MyHashSet() {\n        head=NULL;\n    }\n    \n    void add(int key) {\n        ListNode*temp=head;\n        while(temp!=NULL)\n        {\n            if(temp->val==key) return;         /* If key already exist then return */\n            temp=temp->next;\n        }\n         if(head==NULL)\n         {\n           head=new ListNode(key);  // If head is NULL then key is the first element to add in the linked list\n          }\n         else{\n            temp=new ListNode(key);    //Add the key to the front of the linked list\n            temp->next=head;\n            head=temp;\n        }\n    }\n    \n    void remove(int val) {\n        // If key exist at the front of the linked list\n        if(head!=NULL && head->val==val)\n        {\n            head=head->next;\n            return;\n        }\n        \n        //If key exist in between or last\n        ListNode*cur=head;\n        while(cur!=NULL && cur->next!=NULL)\n        {\n           if(cur->next->val==val)\n           {\n               cur->next=cur->next->next;\n               return;\n           }\n           cur=cur->next;\n        }\n    }\n    \n    bool contains(int key) {\n        ListNode*temp=head;\n        temp=head;\n        // Traverse through the whole linked list to check if key exist\n         while(temp!=NULL)\n         {\n             if(temp->val==key) return true;\n             temp=temp->next;\n         }\n        return false;\n    }\n};\n```
['Linked List']