Load Balancing
INTERN
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:
- int n : the number of resources
- 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.
Get one-to-one training from Google Facebook engineers
Top-notch Professionals
Learn from Facebook and Google senior engineers interviewed 100+ candidates.
Most recent interview questions and system design topics gathered from aonecode alumnus.
One-to-one online classes. Get feedbacks from real interviewers.
Customized Private Class
Already a coding expert? - Advance straight to hard interview topics of your interest.
New to the ground? - Develop basic coding skills with your own designated mentor.
Days before interview? - Focus on most important problems in target company question bank.