EvolutionIQ Interview Question

Didn't expect coding question during the screening round. Recruiter asked disjoint set question.