whats wrong in my code plzz comment it out
Https://ide.codingblocks.com/s/261933
hello @Aditya-Kushwaha-914550392281281
there are few mistakes.
a) base case should be if i==n return -1.
this is how ur recursive function should look like.
after basecase
int index=lastindex(i+1)
if(index!=-1)
return index
else {
if(arr[i]==key)
return i;
else
return -1;
}
but according to ur approach the question still cant solve
why ?..
pls share ur updated code i will check
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.