#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.