FastPrepSchedule Four Tasks per Processor

Schedule Four Tasks per Processor

Bloomberg LP logoBloomberg LP● MediumFULLTIMEPHONE SCREEN
Learn

Problem statement

Processor i becomes available at processorTime[i] and has four cores. There are exactly four times as many independent tasks as processors. Assign exactly four tasks to each processor; its four tasks run simultaneously when it becomes available.

Return the earliest possible time when every task is finished.

Function

minTime(processorTime: int[], taskTime: int[]) → int

Examples

Example 1

processorTime = [8,10]taskTime = [2,2,3,1,8,7,4,5]return = 16

Assign the four longest tasks to the processor available at 8; the makespan is 8+8=16.

Constraints

  • taskTime.length == 4 * processorTime.length.
  • Times are nonnegative.

More Bloomberg LP problems

See Bloomberg LP hiring insights
public int minTime(int[] processorTime, int[] taskTime) {
  // Write your code here.
}
processorTime[8,10]
taskTime[2,2,3,1,8,7,4,5]
expected16
Checking account…