I did this my way. Im getting correct answer to the sample input . But when i submit it , it doesn’t show the right answer. There is another way of doing this by which im getting the right answer . but can you pls tell me whats wrong in my code;
#include
using namespace std;
int main() {
int t;
cin>>t;
while(t–)
{
int n,a[10000],i;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
int p=0;
for(i=0;i<n-2;i++)
{
if(a[i]>=a[i+1])
{
if(a[i+1]<=a[i+2])
{ p=i+1;
}
}
}
int count=0;
for(int j=p;j<n;j++)
{ count++;
}
cout<<count<<endl;
}
return 0;
}