Company: Wayfair_28oct
Difficulty: medium
Server Management Problem Description A company manages a network of n servers, each with a specified capacity and incoming requests. To prevent overload, the company can double the capacity of any k servers. Determine the maximum total number of requests that can be handled after implementing these changes. Examples Example 1: Input: n = 4, serverCapacity = [10, 4, 3, 7], incomingRequests = [3, 10, 4, 5], k = 2 Output: 20 Explanation: If the second and third server capacities are doubled: Server 1: Can handle 3 requests (out of 10 capacity) Server 2: Can handle 8 requests (doubled capacity from 4 to 8, but only 8 of 10 incoming requests) Server 3: Can handle 4 requests (doubled capacity from 3 to 6, but only 4 incoming requests) Server 4: Can handle 5 requests (out of 7 capacity) Total requests handled: 3 + 8 + 4 + 5 = 20 Example 2: Input: n = 5 serverCapacity = [5, 3, 7, 10, 12] incomingRequests = [3, 2, 5, 8, 10] k = 2 Output: 28 Explanation: The serverCapacity[i] > incomingRequests