Model courses as a directed graph. Each prerequisite [a, b] means edge from b to a (b must come before a).
You can finish all courses if and only if the graph has no cycles. A cycle means circular dependencies.
Use Kahn's algorithm (BFS-based topological sort): start with courses that have no prerequisites (in-degree 0). Process them, removing their outgoing edges. If new courses reach in-degree 0, add them to the queue. If you process all courses, no cycle exists.
Alternatively, use DFS cycle detection.