Company: Razorpay_12oct
Difficulty: medium
Optimized Cache Hit Counter Problem Description You are tasked with simulating a cache memory system with a fixed capacity. The system processes a sequence of memory access requests. For each request, it either results in a cache hit (if the item is already in the cache) or a cache miss (if the item is not in the cache and needs to be loaded). You need to implement a simulation using the Least Recently Used (LRU) eviction policy. When the cache reaches its capacity and a new item needs to be inserted, the least recently used item should be removed to make room. Due to a high frequency of memory access requests (up to 10 5 ), your implementation must be optimized for performance, and choosing the right data structures (e.g., HashMap + Doubly Linked List or OrderedDict) is critical. Function Description: Implement the function simulateCacheAccess . The function takes the cache capacity C and a list of memory accesses accesses . It should return the total number of cache hits and cache mi