Topological Sort for Course Ordering (Course Schedule II variant)

Asked at Coupang · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026

Given prerequisite dependencies between courses, output any valid course-taking order; if it is impossible to finish all courses, return an empty list.

Loading the problem…