Https://hack.codingblocks.com/contests/c/537/366 two testcases are passing but third is not tell me whats wrong

#include

using namespace std;

int j=0;

bool sorted(long long unsigned int *a,int n)
{
if(n==1)
{
return true;
}

if(a[j]<a[j+1])
{
j++;
if(n-1>0)
{
return sorted(a,n-1);

}
}

return false;

}

int main ()
{
int n,i;

cin>>n;

long long unsigned int a[n];

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

}

if(sorted(a,n))
{
cout<<“true”;
}

else
{
cout<<“false”;
}

return 0;

}

Hey Ashutosh, its not recommended to use a global variable for a recursive function. So, update your sorted function like this:

bool sorted(long long unsigned int *a,int n)
{
    if(n==1)
    {
        return true;
    }
    return arr[n-1]>=arr[n-2] && sorted(arr,n-1);
}

Hey Ashutosh, as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.