There are n servers, where the workload of the i-th server is represented by serverLoad[i] (0 ≤ i < n).
A developer wants to minimize the number of operations required to reduce the server workloads. They may manually offload tasks from at most k servers, removing those servers from consideration.
After any manual offloading, an automated load management tool can be used repeatedly.
In a single operation, the tool works as follows:
L be the maximum workload among the remaining servers.L / 2 is completely offloaded (removed).The process can be repeated until all remaining servers have been removed.
Determine the minimum number of tool operations required after optimally choosing up to k servers to manually offload.
int getMinOperations(vector<int> serverLoad, int k);
serverLoad[n]: workload of each server.k: maximum number of servers that can be manually offloaded.int: minimum number of tool operations.Flipkart • Pending
Flipkart • Pending
Flipkart • Pending
Texas • Pending
BNY • Pending