PayPal interview question

disjoint set union type question