#include
using namespace std;
bool sorted(int*a,long long int n)
{
if(n==1)
{
return true;
}
if(a[0]<a[1] && sorted(a+1,n-1))
{
return true;
}
return false;
}
int main() {
int a[1005];
long long int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
if(sorted(a,n))
{
cout<<“true”;
}
else
{
cout<<“false”;
}
return 0;
}
one test case fail
Sorted array recursion
hi Ajay
save your code to online ide of coding block and then post the link here
it help us to debug more fastly