Design a HashSet without using any built-in hash table libraries.
Implement the MyHashSet class:
MyHashSet()initializes the object.void add(key)inserts the valuekeyinto the HashSet.bool contains(key)returns whether the valuekeyexists in the HashSet or not.void remove(key)removes the valuekeyin the HashSet. Ifkeydoes not exist in the HashSet, do nothing.
- Method calls.
Input: ["MyHashSet", "add", "add", "contains", "contains", "add", "contains", "remove", "contains"] [[], [1], [2], [1], [3], [2], [2], [2], [2]]
Output: [null, null, null, true, false, null, true, null, false]