Object-Oriented Programming · LinkedIn · Medium
Design a fixed-size Least Recently Used (LRU) cache that also maintains counters for successful and failed reads. The cache begins empty, with both counters initially zero. The supported operations are: GET key: If key is present, output its value, promote it to most recently used, and increase hits by 1. If it is absent, output -1 and increase misses by 1. PUT key value: Insert the key-value pair, or update the value if the key already exists, then mark the key as most…
Checking your access…