I used BFS on all nodes who haven’t been visited to find all connected components and their size. I see similar successful submissions to this question so why am I getting TLE?
vector<vector<int> > adj
Take this by reference instead of by value, as you have done with
Thank you so much!