C : beats 100%(mem) ~100%(time) - simple and short
Context : Before jumping onto any fancy solutions, like I tried for HashMap, I have kept this solution also obviously simple since other approaches are just ove
**Context :** Before jumping onto any fancy solutions, like I tried for HashMap, I have kept this solution also obviously simple since other approaches are just overkill with no gains in speed and time over this kind of one-shot allocation, when I compared as I mentioned for HashMap solution.\n\n**[Update] New version : compact code :**\n\n```\ntypedef struct {\n    uint8_t h[1000001];\n} MyHashSet;\n\nMyHashSet* myHashSetCreate() {\n    return calloc(1, sizeof(MyHashSet));\n}\n\nvoid myHashSetAdd(MyHashSet* obj, int key) {\n    obj->h[key] = 1;\n}\n\nvoid myHashSetRemove(MyHashSet* obj, int key) {\n    obj->h[key] = 0;\n}\n\nbool myHashSetContains(MyHashSet* obj, int key) {\n    return obj->h[key];\n}\n\nvoid myHashSetFree(MyHashSet* obj) {\n    free(obj);\n}\n```\n\n**[Previous version]**\n\n```\ntypedef struct {\n    char *a;\n} MyHashSet;\n\nMyHashSet* myHashSetCreate() {\n    MyHashSet *m = malloc(sizeof *m);\n    m->a = calloc(1, 100000);\n    return m;\n}\n\nvoid myHashSetAdd(MyHashSet* obj, int key) {\n    obj->a[key] = 1;\n}\n\nvoid myHashSetRemove(MyHashSet* obj, int key) {\n    obj->a[key] = 0;\n}\n\nbool myHashSetContains(MyHashSet* obj, int key) {\n    return obj->a[key];\n}\n\nvoid myHashSetFree(MyHashSet* obj) {\n    free(obj->a);\n    free(obj);\n}\n```
['C']