Introduction
It is a medium level algorithm related to graph, and it can be solved using union find algorithm. The array can be used to store each node's parent node. I practiced a few times in the past, and this is the first time I wrote one and it passes the online judge.
My practice
Here is the C# code. I just copied the code from Java code in discussion panel. I may have issues when I write one by myself.
No comments:
Post a Comment