Pairing problem

what’s wrong in the code?

@rockstarpkm
Where are you finding the connected components? You should use disjoint sets Union or use dfs or bfs to find the size and number of components

you can refer to this code: