Palo Alto Networks Interview Question

A hard leetcode question which included graph theory and topological sorting to solve. First pseudo code and then real time programming to validate the solution works.