Medium Accuracy: 30.19%
Submissions: 100k+ Points: 4
Given a Directed Graph with V vertices (Numbered from 0 to V-1) and E edges, check whether it contains any cycle or not.
Explanation: 3 -> 3 is a cycle
Explanation: no cycle in the graph
Your task: You don’t need to read input or print anything. Your task is to complete the function isCyclic() which takes the integer V denoting the number of vertices and adjacency list as input parameters and returns a boolean value denoting if the given directed graph contains a cycle or not.
Expected Time Complexity: O(V + E) Expected Auxiliary Space: O(V)