Your question is Custom HashMap Implementation. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Canva's design services need predictable key-value behavior for in-memory metadata. Implement a custom HashMap for integer keys without using Python dictionaries, sets, or hash-map utility classes.
Your function receives an ordered list of operations and returns the result of every get and contains operation. Use separate chaining to resolve collisions and resize the bucket array when the load factor exceeds 0.75.
Implement implement_hash_map(operations), where operations is a list of operation arrays:
['put', key, value]: Insert or replace the value for key.['get', key]: Return the associated value, or None if absent.['remove', key]: Delete key if present. This produces no output.['contains', key]: Return True if key exists, otherwise False.Return a list containing results from get and contains operations in their original order. Keys and values are integers. The implementation must not use dict, set, or hash().
def implement_hash_map(operations):