Course Schedule
There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [a, b] indicates that you must take course b first if you want to take course a.
Return true if you can finish all courses. Otherwise, return false.
For example, the pair [1, 0] indicates that to take course 1 you must first take course 0.
canFinish(2, [[1, 0]]); // true
canFinish(2, [[1, 0], [0, 1]]); // false (cycle detected)