Problem 547 · Medium
Number of Provinces
Count connected components using Union-Find.
Union-Find
Graph
Open the interactive visualisation