Load Balancing
Updated
Problem statement
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
loadBalancing(n: int, burstTime: int[]) → int
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
Examples
Example 1
n = 3burstTime = [7, 2, 3, 4, 5]return = 9It 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.
Constraints
Unknown for now
More MathWorks interview questions
- Earliest Time to Schedule a MeetingOA · Seen Nov 2026
- Minimum Cost to Serve Requests on a RingOA · Seen Nov 2026
- Minimum Tree Diameter After Removing K LeavesOA · Seen Nov 2026
- Cities on Shortest Delivery RoutesOA · Seen Nov 2026
- Repeated Mirror XOROA · Seen Nov 2026
- Beautiful ArrangementONSITE INTERVIEW · Seen Jul 2026
- Find Minimum Cost to Remove Array ElementsONSITE INTERVIEW · Seen Jul 2026
- Group Shifted StringsONSITE INTERVIEW · Seen Jul 2026
- Longest Valid ParenthesesONSITE INTERVIEW · Seen Jul 2026
- Balancing TeamsOA · Seen Nov 2025
Similar questions at other companies
- Count Lamps Lighting Each PointAirbnb · OAAirbnb interview questions
- Choose ContainersIMC Trading · OAIMC Trading interview questions
- Minimum Size Subarray SumMicrosoft · OAMicrosoft interview questions
- Calculate Total Distance TravelledAmazon · OA
- TikTok Metrics AnalysisTikTok · OATikTok interview questions
- Largest Square Sub-Grid Within a Sum LimitC3.ai · OAC3.ai interview questions
- Maximum Distinct Items Within a BudgetAdobe · OAAdobe interview questions
- Size-Weighted Random Server PicksDocuSign · OADocuSign interview questions
- Calculating QuantilesIndeed · OAIndeed interview questions
- Count Lamps Lighting Each PointCapital One · OACapital One interview questions