Return the ordering of courses you should take. If impossible (cycle), return empty list. This is topological sort applied to prerequisites.
Use Kahn's algorithm. If the result has fewer than numCourses nodes, there's a cycle.
💡 Pro tip: Understand this problem deeply — don't just memorize the code. Try explaining the approach out loud as if teaching a friend. If you can explain it simply, you truly understand it!
findOrder(4, [[1,0],[2,0],[3,1],[3,2]])
[0, 1, 2, 3]