Design Your Own HashMap


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()


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 70+ hands-on prep courses.