Course schedule extended

Revision en1, by __SAK__, 2022-10-01 11:02:05

You might have seen the problem Course Schedule on Leetcode [https://leetcode.com/problems/course-schedule/] Here the ans just comes down to finding if there exists a cycle in the graph or not. I wanted to find the how many total courses can I take if not all the courses. One approach I thought was a multisource BFS with maintaining the indegree for each node and updating it but it would be quite slow. Can anyone suggest any faster method?

Tags graph, multisource bfs

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English __SAK__ 2022-10-01 11:02:05 469 Initial revision (published)