MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / getMinimumCpuIntervals

Function getMinimumCpuIntervals

javascript/0621-task-scheduler.js:34–48  ·  view source on GitHub ↗
(maxHeap, n, cpuIntervals = [0])

Source from the content-addressed store, hash-verified

32};
33
34const getMinimumCpuIntervals = (maxHeap, n, cpuIntervals = [0]) => {
35 while (!maxHeap.isEmpty()) {
36 const { iterations, coolingPeriodQueue } = execute(
37 n,
38 maxHeap,
39 cpuIntervals,
40 );
41
42 reQueueCoolingPeriod(coolingPeriodQueue, maxHeap);
43
44 if (!maxHeap.isEmpty()) cpuIntervals[0] += iterations;
45 }
46
47 return cpuIntervals[0];
48};
49
50const execute = (
51 n,

Callers 1

leastIntervalFunction · 0.85

Calls 3

executeFunction · 0.85
reQueueCoolingPeriodFunction · 0.85
isEmptyMethod · 0.45

Tested by

no test coverage detected