Implement a prototype of a resource allocation system in a distributed parallel computing infrastructure.
There are n
resources and m
tasks to schedule on them where the p^th
task has a processing time of burstTime[i]
. The total load time of a resource is the sum of the total burst times of the jobs assigned to the resources. However, a particular resource can be allocated jobs in a contiguous segment only i.e. from some index x
to some index y
or [x, x + 1, x + 2, ..., y]
.
Find the minimum possible value of the maximum total load time of the servers if resources are allocated optimally.
Function Description
Complete the function loadBalancing
in the editor.
loadBalancing
has the following parameters:
- 1.
int n
: the number of resources - 2.
int[] burstTime
: an array of integers representing the processing times of tasks
Returns
int: the minimum possible value of the maximum total load time of the servers
Example 1:
Input: n = 3, burstTime = [7, 2, 3, 4, 5]
Output: 9
Explanation:It is optimal to allocate the first job to the first resource, the last job to the second resource, and the remaining three jobs to the third resource. Total load times are 7, 5, and 2 + 3 + 4 = 9 respectively.
Unknown for now

input:
output: