C++: Simple Trie Solution
```\nclass MyHashSet {\n    struct node{\n        bool flag;\n        struct node child[10];\n    };\n    struct node root;\n    \n    struct node allocate(){\n
```\nclass MyHashSet {\n    struct node{\n        bool flag;\n        struct node* child[10];\n    };\n    struct node* root;\n    \n    struct node* allocate(){\n        struct node* ptr = (struct node*)malloc(sizeof(struct node));\n        ptr->flag = false;\n        for(int i=0;i<10;i++){\n            ptr->child[i] = NULL;\n        }\n        return ptr;\n    }\n    \n    void insertWord(struct node* root,int key){\n        while(key){\n            int digit = key%10;\n            key = key/10;\n            if(root->child[digit] == NULL)\n                root->child[digit] = allocate();\n            root = root->child[digit];\n            \n        }\n        root->flag = true;\n    }\n    \n    bool searchWord(struct node* root,int key){        \n        while(key){\n            int digit = key%10;\n            key = key/10;\n            if(root->child[digit] == NULL)\n                return false;\n            root = root->child[digit];\n            \n        }\n        return root->flag;        \n    }\n        \n    void removeWord(struct node* root,int key){\n        while(key){\n            int digit = key%10;\n            key = key/10;\n            if(root->child[digit] == NULL)\n                return;\n            root = root->child[digit];\n\n            }\n        root->flag = false;        \n    }\n    \npublic:\n    /** Initialize your data structure here. */\n    MyHashSet() {\n        root = allocate();\n    }\n    \n    void add(int key) {\n        insertWord(root,key);        \n    }\n    \n    void remove(int key) {\n        removeWord(root,key);        \n    }\n    \n    /** Returns true if this set contains the specified element */\n    bool contains(int key) {\n        return searchWord(root,key);\n    }\n};\n\n/**\n * Your MyHashSet object will be instantiated and called as such:\n * MyHashSet* obj = new MyHashSet();\n * obj->add(key);\n * obj->remove(key);\n * bool param_3 = obj->contains(key);\n */
[]