Determine if you can finish all numCourses given prerequisite pairs [a, b].
Input: numCourses = 2, prerequisites = [[1,0]]
Output: true
Topics: graphs, topological-sort
Asked by: Amazon, Google
Time complexity: O(V + E). Space complexity: O(V + E).