Company: Rippling_28nov
Difficulty: medium
Dual Cache Performance Problem Description Analyze the performance of a dual cache system processing service requests. Given n requests with payload sizes payloadSize[i] , and two caches A and B that can serve different subsets of these requests: cacheA[i] = 1 if cache A can serve request i , otherwise 0 cacheB[i] = 1 if cache B can serve request i , otherwise 0 Find the minimum sum of payload sizes for a subset of requests where each cache can serve at least minThreshold requests. Return -1 if such a subset does not exist. Examples Example 1: Input: n = 5 payloadSize = [10, 8, 12, 4, 5, 25] // Note based on image, the example list likely has length 5 matching n, but logic reads like items are indexed 1-based or 0-based. cacheA = [1, 0, 1, 1, 0, 1] cacheB = [1, 0, 1, 0, 1, 1] minThreshold = 3 Output: 31 Explanation: If we choose the subset [1 st , 3 rd , 4 th , 5 th ] requests: Cache A can serve the 1 st , 3 rd , and 4 th requests (3 requests, meeting the threshold) Cache B can serve t