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

Function getMaxHeap

javascript/0621-task-scheduler.js:25–32  ·  view source on GitHub ↗
(frequencyMap, maxHeap = new MaxPriorityQueue())

Source from the content-addressed store, hash-verified

23};
24
25const getMaxHeap = (frequencyMap, maxHeap = new MaxPriorityQueue()) => {
26 for (const frequency of frequencyMap) {
27 const hasFrequency = 0 < frequency;
28 if (hasFrequency) maxHeap.enqueue(frequency);
29 }
30
31 return maxHeap;
32};
33
34const getMinimumCpuIntervals = (maxHeap, n, cpuIntervals = [0]) => {
35 while (!maxHeap.isEmpty()) {

Callers 1

leastIntervalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected