Company: Razorpay_4sep
Difficulty: medium
Optimized Cache Hit Counter Problem Description A memory cache can hold at most C distinct memory addresses at a time. It starts empty and then serves a sequence of N memory access requests, one after another. For each requested address: If the address is already in the cache, the request is a cache hit . Otherwise the request is a cache miss , and the address is loaded into the cache. If the cache already holds C addresses at that moment, the least recently used address is removed first to make room. An address is "used" every time it is requested, whether that request is a hit or a miss. So the least recently used address in the cache is the one whose most recent request lies furthest in the past. Count the total number of cache hits and the total number of cache misses over the whole sequence. Complete the function simulateCacheAccess(C, accesses) , where C is the cache capacity and accesses is the list of requested addresses in order. It returns the two counts as a string: the numb