Company: Salesforce on campus Amts_24march
Difficulty: medium
In Salesforce, various automated jobs are executed on the system to manage business processes efficiently. The execution times of these jobs are represented as an array duration , where duration[i] represents the execution time of the i th task (0 ≤ i < n ). An administrator can perform the following operation on these jobs: Select a specific job. Reduce the execution time of the selected job by one time unit. If the job's execution time reaches zero, it is considered completed and removed from the system. The goal is to bring the system to an equilibrium state where all active jobs have equal execution times. Determine the minimum number of operations required to achieve this state. Example n = 4 duration = [1, 2, 6, 3]. One of the optimal strategies is to remove jobs 0, 1, and 3 in 1, 2, and 3 operations, respectively. Hence, a minimum of 6 operations is required. Function Description Complete the function getMinimumOperations in the editor below. getMinimumOperations has the f