Smallest valid task order from dependencies
There are n tasks numbered 0 to n - 1, done one at a time, and a list of pairs [a, b] meaning a must finish before b starts. Return an order that respects every dependency; among all valid orders, return the smallest one when compared position by position. If the dependencies contain a cycle, report that no order exists. (Kahn's algorithm with a min-heap instead of a plain queue.)
No answer yet. Write the first one; the best answer gets endorsed.
