Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Course Schedule
Medium
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Given number of courses and prerequisites, determine if you can finish all courses.
Sample Input:
2, [[1,0]]
Sample Output:
true
Hints
Hint 1
Model as a directed graph and check for cycles
Hint 2
Use DFS with cycle detection or Kahn's algorithm
Hint 3
If cycle exists, courses cannot be completed
Code Editor
Reset
Run
Save
Loading...