X interview question

How to detect a cycle in a directed graph

Interview Answer

Anonymous

22 Feb 2019

DFS and having a visited[] array and mark the visited when you visit the node.