PROBLEM LINK:Author: Sumeet Verma
Complexity Analysis: O(N * N) because we do an O(N) iteration for each query and total number of queries can be 2N, therefore O(2N*N). Here I have ignored the constant of unionfind for simplicity.
This question is marked "community wiki".
asked 26 Nov '15, 01:08

Hi, the following is my code: http://ideone.com/1ElezS (I couldn't get the inline code function to work, sorry for the external link). When I submit however, I'm getting TLE. Can you please point out any errors? My approach is basically DSU. Thanks :) answered 28 Nov '15, 13:39

Can anyone please explain it in simple terms. Thnaks. answered 28 Nov '15, 15:38
