Anyone is there help me out

one test cases is passing but second one is giving error

If you’re trying to find Cycle in Directed graph using a queue, do it with the approach of taking the node with in-degree zero and reducing the degree of all it’s adjacent neighbors by one (Khan’s algorithm).

why my approach is not rigth?

why my approach is not right can you explain me with some example can you give number so that i call you?

bro are u there kindly respond?

In second test case, 0 is also one of the nodes. But you’re initializing parent of every node as zero.
Instead of that, make every node as a parent of itself.
I’ve made some changes you can check it here.

i am not getting the logic can you call me on 8095703416 number?please i could understand the approach

The courses are of the format 0,1,2,…n-1.
So for every node instead of initializing the v[node] to 0, try initializing it with the node itself (or -1 will also work).
When you initialize v[node] to 0, in line no 7
for (int i = 0; i < n; i++)
{
v[i] = 0;
}
This zero is misinterpreted as node 0.
For better understanding, I strongly recommend dry running it.
Hope it helps.

hey can you give one test case where my code will be failed

hey can you give one testcase where my code will be failed