Problems > Schedule the Courses > Editorial

Schedule the Courses — Solution & Editorial

Back to the Problem

Kahn's algorithm with a min-heap instead of a queue: always emit the smallest currently-available course.

Complexity: O((N + M) log N)