My Approach is same As mentioned in editorial :-
- create component for same type
- create edges for different component
- use union find (dsu) concept
I am not able to find out any Test case where my code is giving WA answer… plz someOne provide any test case for my code is not giving right answer
solution link:- link
Output ScreenShot:-