Sorted Array recursion challenge problem

#include
using namespace std;
long long int isSorted(long long int a[],long long int n)
{
//base cll
if(n==1 || n==0)
return 1;
if(a[0]<a[1] && isSorted(a+1,n-1))
return 1;
return -1;

}

int main()
{
long long int i,n;
cin>>n;
long long int arr[n];
for(i=0;i<n;i++)
cin>>arr[i];
long long int p=isSorted(arr,n);
if(p==1)
cout<<“true”<<endl;
else
cout<<“false”<<endl;
return 0;
}

The code is write for test case 1 and 2 but showing error for test case 0 with the error that you may not declare for negative numbers but I have declared variable type as long long int.

hello @shubhangis248

use <= in place of <

Did the same but still same doubt-Dang! You couldn’t score a perfect 100 because you failed one or more testcases. This means that your program didn’t account for all input cases (did you account for negative numbers, for example?).

save ur code here->https://ide.codingblocks.com/

and share the link with me

image
return 0 here