706. Design HashMap

Practice Design HashMap 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 map from integer keys to integer values without using a built-in 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

["MyHashMap","put","put","get","get","put","get","remove","get"]
[[],[1,1],[2,2],[1],[3],[2,1],[2],[2],[2]]
->  [null,null,null,1,-1,null,1,null,-1]

Constraints