Given a Directed Graph with V vertices and E edges, check whether it contains any cycle or not.
{
"V": 4,
"adj": [
[
1
],
[
2
],
[
3
],
[
1
]
]
}true{
"V": 3,
"adj": [
[
1
],
[
2
],
[]
]
}false{
"V": 5,
"adj": [
[
1
],
[
2
],
[
3,
4
],
[
1
],
[]
]
}trueSign in to Run Code and Submit