Hash Map from Scratch

Hard
data-structures Amazon Google Meta

Implement a basic hash map with put, get, and remove operations. Use chaining for collision resolution.

Example

hm = HashMap()
hm.put("name", "Alice")
hm.get("name")  # => "Alice"
hm.put("name", "Bob")
hm.get("name")  # => "Bob"
hm.remove("name")
hm.get("name")  # => None

Test Cases

Python Editor

Output

Click "Run" to see results...