My sample test case is giving correct output but my testcases giving wrong answer.Here is my code.
Correct it and explain the problem
Don’t suggest other code
Testcases not passing
Actually i solved this question using undirected graphs and got accepted .Is there any problem if I have not made a directed graph from master vertex and then solved it .please have a look on my code and reply as soon as possibe.
hello @D19APPPP0016

here u need to to compare child of node i with child of parent of i . and if child[i] > child[parent of i] then only u should increment ur count.
Actually i solved this question using undirected graphs and got accepted .Is there any problem if I have not made a directed graph from master vertex and then solved it .please have a look on my code and reply as soon as possibe.https://ide.codingblocks.com/s/240735 .I was talking about this solution .Have a look at this
yeah this should work.
Ya it got accepted but I have not made a directed graph as told in the video. Is my approach correct or I just got lucky.
u have made a directed graph.

No bro I have made an undirected graph , check again
see edges are biredirectional and u are adding edge x->y and y-> x ,
so u can say it undircted becuase edge x->y and y-> x have no weights.
All i am asking is that my approach is correct or not despite being different from what is told in the video
it is correct . . … . .