Uber Interview Question

I was asked a graph based dsa question of medium leetcode difficulty on union find topic