Why start from first of the list

For Test-case#2: I am getting timeout when I recurse from the end of the vector versus the begin. Can someone explain why the hint video also suggests we start only from begin and not end ?

Code: https://ide.codingblocks.com/s/98573

Hey pal, so I saw your code and made some changes in it, and all the test cases have passed. It’s totally fine to start from the end. Do you want to know the changes in the code that you have to make?

@ajinkya Please share the code changes

Alright, I’m literally giving this thing away like a big fat hint/solution.
Note- I changed your vector into an array instead.

//Base case that I amended.
if (myArr[index] == val)
return index;

    if(index==0& myArr[index]!=val)
    return -1;

after the base case, call the function recursively-
int result = searchArrayReverse(myArr, val, index - 1);

Wonderful. I now see the bugs in my code.