Course Schedule

There are n courses labeled 0 to n-1. You are given m prerequisite pairs (a, b) meaning you must take course b before course a. Determine whether it is possible to finish all courses.

*...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: