Design Your Own HashMap
Design and implement your own hashmap
We'll cover the following
Statement
Design a hashmap without using built-in hash libraries. We only need to cater for integer keys and values in the hashmap. Return -1
if the key does not exist.
It should support the three primary functions of a hashmap:
put()
get()
remove()
Example
Consider the following hashmap example where the key-value pairs are mapped according to their respective hash keys with modulus base as 11
:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.