Your question is LFU Cache 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.
Implement an LFU (Least Frequently Used) cache template class.
Asked in the Technical Phone Screens (3 rounds) stage. This is a practical C++ coding task focused on data structures and template classes.
For grading, implement lfu_cache(operations, capacity). Each operation is ['put', key, value] or ['get', key]; return the values from get operations, using -1 for missing keys. When frequencies tie, evict the least recently used key.
def lfu_cache(operations, capacity):