here’'s the code the first testcase is failing could you help me out with it.
here’s my code #include
using namespace std;
int searcharray(int a[],int l,int n,int m)
{
if(n<l)
return -1;
if(a[l]==m)
return l;
if(a[n]==m)
return n;
else return searcharray(a,l+1,n-1,m);
}
int main() {
int n;
int a[10000];
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int m;
cin>>m;
cout<<searcharray(a,0,n-1,m);
}