Microsoft interview question

Detect loop in an undirected graph