Two Sigma interview question

Disjoint set data structure