Please tell me error in this program.Not giving correct output:Inout:1,2,4,6,-1,-1,7,-1,-1,5,8,-1,-1,9,-1,-1,3,11,-1,-1,10,-1,-1

@KetanPandey hey please check the input format of question and give correct input.

This is the input:1 2 4 6 -1 -1 7 -1 -1 5 8 -1 -1 9 -1 -1 3 11 -1 -1 10 -1 -1 .The output should be 2 but its printing 1.Why

Please correct the code soon and tell me my mistake

@KetanPandey hey there is problem in your logic I have changed that function little bit ,check this:

mistake you have done is at line no 53
there should be “and” instead of “or”

Modified Code

if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like :heart:: and don’t forgot to mark doubt as resolved :grinning:

@KetanPandey hey , this is the mistake which has been corrected by me.