Course Schedule leetcode: https://leetcode.com/problems/course-schedule/
This problem involves detecting a cycle, and if there is one then you cannot complete all course.
I've heard that DFS is most recommended for detecting a cycle, yet Kahn's Algorithm is recommended for the course schedule problem, which is a BFS solution.
So.. which is it? Is DFS better for detecting cycles or is BFS?
See Question&Answers more detail:os