Hello I wanted to know how can this java code can be improved. Currently it get TLE in few test cases.It would be helpful if someone can find the bottleneck in this solution.
Solution: find the number of connected components.
equivalent code in c++ is 10 times faster than java.
I am trying to switch to java for cp.