Ok so this time i am not able to find the bug

the answer for the sample test case is correct but not getting submitted pls check this code

check now ->

ok so i found 2 changes that you made in my code
so 1 change i understood but in the hint of this question apaar sir is telling it as directed graph thats why i took it directed only

haven’t seen video, but it must be another approach then if apaar sir has said so.

no no it is exactly the same approach that i implemented

Okay, will see the video. Rest the code is right. You can submit it and check it. You can move to next question now :slight_smile:

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.