#include
using namespace std;
bool sort(int a[],int i,int n)
{
if(n==1)
return true;
if(a[i]<a[i+1])
return sort(a,i+1,n-1);
else
return false;
}
int main() {
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
if(sort(a,0,n))
cout<<“true”;
else
cout<<“false”;
return 0;
}
my one test case is missing which is that case
Sort the array problem
@anujkurmi
I submitted your code and got a full score.
This is the problem link that I submitted to - https://hack.codingblocks.com/contests/c/537/366
If you are trying a different problem , please share the HackerBlocks link with me.
Your code seems fine and the only problems I could think of were that the problem might be giving inputs larger than int , so use long long int in case your code is not passing.
Also check whether that problem considers increasing sequence or a strictly increasing sequence. You might want to include the equal to condition in the former case.