Help rahul to search

what is wrong in my code

Your submission shows that all your test cases were passed. Is you doubt resolved?

whats wrong in this code

Your code fails for this case:
5
3
4
5
1
2
2
Correct output:
4
Your output:
-1

Dry run with this case and verify