Course Schedule
Recognize the pattern
Brute force idea
A straightforward first read of Course Schedule is this: Try all possible orderings — factorial time. That instinct is useful because it follows the prompt literally, but it usually keeps revisiting work the problem is begging you to organize.
Better approach
The deeper shift in Course Schedule is this: Topological sort with BFS (Kahn's) or DFS cycle detection. Once you hold onto the right piece of information from moment to moment, the problem feels less like trial and error and more like following a shape that was there all along.
Key invariant
At the center of Course Schedule is one steady idea: A valid ordering exists if and only if the dependency graph has no cycles. When you keep that truth intact, each local choice supports the larger solution instead of fighting it.
Watch out for
One easy way to drift off course in Course Schedule is this: Not detecting cycles — if you can't process all courses, there's a cycle. The fix is usually to return to the meaning of each move, not just the steps themselves.