Back to problems

List All LRU Cache Possibilities

Object-Oriented Programming · Oracle · Medium

Design a standard LRU (Least Recently Used) cache with capacity n. Given that n items are inserted one by one in increasing order from 1 to n, generate all possible final cache states that could result from processing the insertion sequence. The order of the cache states in the output list does not matter. An LRU cache maintains the most recently used items up to its capacity. When an item is accessed, it becomes the most recently used item and may cause eviction of the…

Checking your access…