My issue
my logic is correct yet it is giving wrong answer
My code
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n,check;
cin>>n;
int a[n];
for (int i=0;i<n;i++)
{
cin>>a[i];
}
a[n]=999999;
for (int j=1;j<n;j++)
{
if(a[j]>=a[j-1])
check++;
}
cout<<check<<endl;
if(check==n)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
return 0;
}
Learning course: Arrays using C++
Problem Link: CodeChef: Practical coding for everyone