Design Your Own HashMap

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.