This is a verified interview question from Ui-path. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Offloading Tasks - UI Path Online Assessment IIT Roorkee" covers key patterns like Arrays.
"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: 1. Let `L` be the maximum workload among the remaining servers. 2. Every server whose workload is **strictly greater than `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. ### Function Signature ```cpp int getMinOperations(vector<int> serverLoad, int k); ``` ### Parameters * `serverLoad[n]`: workload of each server. * `k`: maximum number of servers that can be manually offloaded. ### Returns * `int`: minimum number of tool operations. ---"
Join thousands of developers practicing for Ui-path.