Sorted Array program problem

My program is failing one test case and I am not able to understand which test case as according to me it is working for all test cases

share your code…

#include
using namespace std;
bool isSorted(int *a,int n)
{
if(n==1)
{
return true;
}
if(a[0]<a[1] && isSorted(a+1,n-1))
{
return true;
}
return false;
}
int main()
{
int a[1000];
int n;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
if(isSorted(a,n))
{
cout<<“true”;
}
else
{
cout<<“false”;
}
return 0;
}

Hi harshul u r checking for strictly greater like 12345 by writing a[0]<a[1]

But what about 11111 it is also sorted but ur code will say that it is not sorted
Just do
a[0]<=a[1]

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.