705. Design HashSet

Practice Design HashSet for free on NudgeCode: Easy, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Build a set of integers without using a built-in set or hash table.

Each test is a list of operations and their arguments; the expected output lists what each call returns (null for calls that return nothing).

Example

["MyHashSet","add","add","contains","contains","add","contains","remove","contains"]
[[],[1],[2],[1],[3],[2],[2],[2],[2]]
->  [null,null,null,true,false,null,true,null,false]

Constraints