(numCourses, graph, path)
| 31 | }; |
| 32 | |
| 33 | var hasPath = (numCourses, graph, path) => { |
| 34 | for (let course = 0; course < numCourses; course++) { |
| 35 | if (isCyclic(course, graph, path)) return false; |
| 36 | } |
| 37 | |
| 38 | return true; |
| 39 | }; |
| 40 | |
| 41 | var isCyclic = (currCourse, graph, path) => { |
| 42 | const hasSeen = path[currCourse]; |