Increasing Decreasing Sequence

#include
using namespace std;
int main() {
long long int n;
int m=0;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
if(i==n-1)
break;
if(a[i]>a[i+1]){
m++;
}
}
if(m==0){
cout<<“true”;
}
else if(m==(n-1)){
cout<<“true”;
}
else if(m==n-2 or m==1){
cout<<“true”;
}
else{
cout<<“false”;
}
return 0;
}

this code pass only 4 test cases.

Consider the input:
5
5
5
5
5
5

Expected Output:
false

Check if this test case works correctly for your code. If not then please save your code on ide.codingblocks.com and share its link.

Also verify your approach from here

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.