(frequencyMap, maxHeap = new MaxPriorityQueue())
| 23 | }; |
| 24 | |
| 25 | const 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 | |
| 34 | const getMinimumCpuIntervals = (maxHeap, n, cpuIntervals = [0]) => { |
| 35 | while (!maxHeap.isEmpty()) { |