Design Hashmap, is a LeetCode problem. In this post we will see how we can solve this challenge in C++

Problem Description

To be specific, your design should include these functions:

get(key) : Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key.

Example:

MyHashMap hashMap = new MyHashMap();

Note:

Please do not use the built-in HashMap library.

....

You can find the full details of the problem Design HashMap at LeetCode

Solution: Please check the main.cpp snippet for the solution.

This solution originally posted at: Github by @kamyu104