Topological sort

code: https://ide.codingblocks.com/s/580315

not passing all test cases

@raghav007 your approach is correct there are 2 mistakes

  1. resize the visited array as number of tasks not number of edges
  2. declare the graph array inside in the solution class
    ( if your declares it outside and if we run multiple cases then it will fail… so declare it in Solution class)
    Coding Blocks IDE
    here is corrected code…if issue still exists let me know and if solved please mark experience

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.