207. Course Schedule

Practice Course Schedule for free on NudgeCode: Medium, Graph pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

There are numCourses courses labeled 0 to numCourses - 1. Each pair [a, b] in prerequisites means course b must be taken before course a. Return true if it is possible to finish every course, and false otherwise.

Example

numCourses = 2, prerequisites = [[1,0],[0,1]]  ->  false   (each course needs the other first)

Constraints