What we learned:
Prerequisite problems are graph problems. Each dependency (" before ") becomes a directed edge .
Topological sort finds valid orderings. If we can process all nodes, we have a valid schedule.
Cycle detection is built-in. If Kahn's algorithm can't process all nodes, there's a cycle. Return empty.
In-degree tracks "remaining prerequisites." When in-degree hits , the course is ready to take.
Pattern recognition: Any problem asking "can you order X given dependencies?" or "find a valid sequence respecting constraints" is likely a topological sort problem.