VacuumLabs interview question

Diamond pattern DFS to detect cycles.