Sorted array test case 2 failed

my code:

#include

using namespace std;

void checksorted(int a[],int si,int n)
{
if(si==n)
{
cout<<“true”;
return;
}
if(a[si]<a[si+1])
{
checksorted(a,si+1,n);
return;
}
else
{
cout<<“false”;
}
}

int main()
{
int a[1000],n;

cin>>n;

for(int i=0;i<n;i++)
{
    cin>>a[i];
}

checksorted(a,0,n);

return 0;

}

hi bhuvan
save your code to online ide of coding block and then post the link here

My code

int line 7 make si==n-1
because when
si==n-1
it will check a[n-1]==a[n]
and a[n] not exist a garbage

Thanks for the help
Happy coding!!

Happy coding:slightly_smiling_face: