LFU cache

0
Remix

Implement a least-frequently-used cache with get and put in O(1). When full, evict the key used least often, breaking ties by least recently used. Keep a map from key to node and a map from frequency to a list of keys, and track the minimum frequency.

xAICodingLast asked Jul 2025
No answer yet. Write the first one; the best answer gets endorsed.