Amazon interview question

Test for cycles in Directed Graph - Check if acyclic or cyclic