MCPcopy Index your code
hub / github.com/neetcode-gh/leetcode / search

Function search

javascript/0210-course-schedule-ii.js:38–50  ·  view source on GitHub ↗
(
    numCourses,
    graph,
    color,
    topologicalOrder,
    isDirectedAcyclicGraph,
)

Source from the content-addressed store, hash-verified

36};
37
38var search = (
39 numCourses,
40 graph,
41 color,
42 topologicalOrder,
43 isDirectedAcyclicGraph,
44) => {
45 for (let i = 0; i < numCourses; i++) {
46 const isNew = color[i] === 1; // White
47 if (isNew)
48 dfs(i, graph, color, topologicalOrder, isDirectedAcyclicGraph);
49 }
50};
51
52var dfs = (node, graph, color, topologicalOrder, isDirectedAcyclicGraph) => {
53 const hasCycle = !isDirectedAcyclicGraph[0];

Callers 1

findOrderFunction · 0.70

Calls 1

dfsFunction · 0.70

Tested by

no test coverage detected