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

Function leastInterval

javascript/0621-task-scheduler.js:8–13  ·  view source on GitHub ↗
(tasks, n)

Source from the content-addressed store, hash-verified

6 * @return {number}
7 */
8var leastInterval = function (tasks, n) {
9 const frequencyMap = getFrequencyMap(tasks);
10 const maxHeap = getMaxHeap(frequencyMap);
11
12 return getMinimumCpuIntervals(maxHeap, n);
13};
14
15var getFrequencyMap = (tasks, frequencyMap = new Array(26).fill(0)) => {
16 for (const task of tasks) {

Callers

nothing calls this directly

Calls 5

getMinimumCpuIntervalsFunction · 0.85
getMaxFrequencyFunction · 0.85
getMostFrequentTaskFunction · 0.85
getFrequencyMapFunction · 0.70
getMaxHeapFunction · 0.70

Tested by

no test coverage detected