You have N courses ( to ) and a list of prerequisites. For example, [, ] means you must take course before course .
Return true if you can finish all courses, false if impossible.
Think: what makes it impossible to finish all courses? If course A requires B and B requires A, you have a circular dependency. No valid ordering exists. This is asking you to detect whether a directed graph contains a cycle. The graph has courses as nodes and prerequisites as directed edges.