Correct o/p but showing it as wrong ans!

correct o/p but showing it as wrong ans!
i have checked my code for one wrong test case but it was showing correct output then why it is showing as wrong answer for that test case(test case no.3).

@varu
wrong answer is because you need to print “0” in case there is no such node for the that case.
So just add a condition:-
if(v.size()==0)
cout<<“0”;

Just correct this thing, your code will pass.

thank you very much sir .

1 Like