https://www.geeksforgeeks.org/minimum-time-taken-by-each-job-to-be-completed-given-by-a-directed-acyclic-graph/

Simply implement Kahn’s algorithm with a jobs array adding 1 to each layer of the topo traversal