The current test cases do not have a case where there is a course with no prerequisites. Therefore, all the test cases can be passed just by checking if there is a course without a prerequisite, without having to do DFS cycle detection or topological sort.
https://algo.monster/problems/course_schedule
The current test cases do not have a case where there is a course with no prerequisites. Therefore, all the test cases can be passed just by checking if there is a course without a prerequisite, without having to do DFS cycle detection or topological sort.
New test case:
4
4
1 0
1 3
2 1
3 2