Company: Innovacer_9nov
Difficulty: medium
Cache Performance Problem Description You are tasked with optimizing the performance of a popular video streaming platform that delivers content to millions of users worldwide. To ensure smooth and fast playback, the platform employs a content cache that temporarily stores recently accessed video segments. The cache has limited capacity, so the platform uses the Least Recently Used (LRU) policy to evict old content and make room for new requests. Your goal is to simulate the cache behavior over a series of video segment requests and calculate the cache's hit rate — the percentage of requests served directly from the cache, which significantly improves user experience by reducing latency. The cache can store a fixed number of video segments simultaneously (its capacity). Each video segment is identified by a unique integer ID. When a user requests a segment: If the segment is already in the cache ( cache hit ), it is served immediately, and its position in the cache is updated to mark i