WA on ques of detecting cycle in graph using union find

where my code going wrong https://www.codechef.com/viewsolution/10869822.

We are not your servants. Do the effort of explaining your solution and what you’ve worked out so far if you want us to pursue the effort of helping you.

1 Like

You should debug your code yourself. :slight_smile:
If needed, you can check other people’s solution, generate test case and match your output with their output.

But, don’t ask others to tell you your mistakes.

1 Like