The initial mechanics are pretty okay. We need to:
- Initialize the LRUCache with a capacity (which needs to be always positive)
- Have a way to retrieve the value of a key – this is a hint for using a hashmap, so we want to use a map as the backend data structure here. Return -1 if not found.
- putting a new key is interesting. We need to: 3.1. Update the key if it exists 3.2. Add the key/value pair to the cache.
However, in order to add the key/value to the cache, we need to: