Myntra interview question

Cycle detection in graph using Disjoint set union by rank and path compression.