DoorDash interview question

(Algorithms) On Coderpad, implement topological sort. You may refer to Wikipedia etc for the algorithm.