Back to problems

Produce a Deterministic Course Plan

Algorithm · Robinhood · Medium

You are given num_courses classes identified by the integers from 0 to num_courses - 1. The input prerequisites is a list of two-element pairs. For a pair [a, b], class b must be scheduled before class a. Your function should return a two-element list. If a valid ordering exists, return [true, order], where order contains every class ID exactly once and satisfies all prerequisite constraints. When more than one valid ordering exists, choose the lexicographically smallest…

Checking your access…