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

Function networkDelayTime

javascript/0743-network-delay-time.js:11–17  ·  view source on GitHub ↗
(times, n, k)

Source from the content-addressed store, hash-verified

9 * @return {number}
10 */
11var networkDelayTime = (times, n, k) => {
12 const { graph, maxTime, queue } = buildGraph(times, n, k);
13
14 bfs(queue, graph, maxTime, k);
15
16 return checkAns(maxTime);
17};
18
19var initGraph = (n, k) => ({
20 graph: Array.from({ length: n + 1 })

Callers

nothing calls this directly

Calls 4

checkAnsFunction · 0.85
buildGraphFunction · 0.70
bfsFunction · 0.70
getTimeFunction · 0.70

Tested by

no test coverage detected