Pairing problem

not passing all test cases
don’t know why
i follow hin video but getting wrong answer
please tell me my mistake

You need to find all the components of in the graph. You are not doing that

https://ide.codingblocks.com/s/575812 still getting wrong answer please tell me where i am doing wrong

Now it’s working https://ide.codingblocks.com/s/575922

modifies that you have provided to me is just passing one test case

Obviously it won’t pass, I made it work to accommodate your testcase. You need to run the loop till n, here is the correct code https://ide.codingblocks.com/s/576130

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.

I am not able to pass all the test cases . Only 3 test cases passed. Wht could be the other test cases?