Round 1: Coding question
Duration: 1 hour
Expectation: Optimal working code
Platform: Online code pairing round
Question:
Design a data structure to store the count of strings with the ability to return the strings with minimum and maximum counts.
Implement the class:
inc(String key) - Increments the count of the string key by 1
dec(String key) - Decrements the count of the string key by 1
getMaxKey() - Returns one of the keys with the maximal count
getMinKey() - Returns one of the keys with the minimum count
All functions should show avg O(1) time