disjoint set - union find | Cracking Leetcode