Back to problems

O(1) Key-Value Store with Average and Max Retrieval

Object-Oriented Programming · Confluent · Medium

Design a key-value store that supports the following operations, all of which must run in O(1) time: Store or update a value for a given key. Retrieve the value associated with a key. Compute the average of every value currently in the store. Compute the maximum of every value currently in the store. Provide the following methods: Put(key, value) inserts a new key-value pair or updates the value if the key already exists. Get(key) returns the value stored for key. You may…

Checking your access…