Problems > Components over Time > Editorial

Components over Time — Solution & Editorial

Back to the Problem

Union-find: each successful union decreases the count by one; self-loops and repeats change nothing.

Complexity: O(M α(N))