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

Function canFinish

javascript/0207-course-schedule.js:8–12  ·  view source on GitHub ↗
(numCourses, prerequisites)

Source from the content-addressed store, hash-verified

6 * @return {boolean}
7 */
8var canFinish = function (numCourses, prerequisites) {
9 const { graph, path } = buildGraph(numCourses, prerequisites);
10
11 return hasPath(numCourses, graph, path);
12};
13
14var initGraph = (numCourses) => ({
15 graph: new Array(numCourses).fill().map(() => []),

Callers

nothing calls this directly

Calls 4

isCyclicFunction · 0.85
buildGraphFunction · 0.70
hasPathFunction · 0.70
topologicalSortFunction · 0.70

Tested by

no test coverage detected