__SAK__'s blog

By __SAK__, history, 2 months ago, In English

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?

 
 
 
 
  • Vote: I like it
  • -1
  • Vote: I do not like it