Problem in Found at Last

The code is running fine but only one test case is there out of three which is not being passed.
Here is the link of the code given below.

Hello @ratulhans,
if(n==-1)
then return -1.
rest is fine.

But it is working with return 0 too, since I’m giving input as
Input
1
8
8
And output is
Output
0

pls reply as soon as possible.It’s very urgent

In cases where the element is not found you have to print -1.
0 will work only for cases where the element is present at 0th index.
According to your logic, even if element is not found, 0 will be printed.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.