Company: AT and T
Difficulty: medium
\n Dual Cache Performance Analysis \n \n \n A team is doing an analysis of a dual cache performance. There are n requests in the queue to be processed by a service where the payload size of the i th request is denoted by payloadSize[i]. There are two caches A and B in the service which cache the response to requests made. \n \n \n If the i th request is cached by cache A, then cacheA[i] = 1, otherwise 0 for all 1 ≤ i ≤ n \n If the i th request is cached by cache B, then cacheB[i] = 1, otherwise 0 for all 1 ≤ i ≤ n \n \n \n Find the minimum sum of the payload sizes of a subset of requests in which each cache can serve at least minThreshold requests, or return -1 if they cannot. \n \n\n \n Function Description \n Complete the function getMinimumSize with the following parameters: \n \n int payloadSize[n] : the payload sizes of the requests \n int cacheA[n] : the requests which are cached in cache A \n int cacheB[n] : the requests which are cached in cache B \n \n \n\n \n Returns \n long