Hello, I wrote the code according to topo sort but i dont know why answer is incorrect

I wrote the code according to following assumptions the ones with no dependencies gets pushed in queue first and then it’s neighbors are visited.

code for the logic: https://ide.codingblocks.com/s/468554 what is it that am i getting wrong about the problem??

hello @shibangi

ss

handel this case

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.