Pergunta de entrevista da empresa Google

They asked me to design an algorithm to detect cycles in a directed graph.