Test Cases Failing

Can you help me out where my test cases are failing in question - Increasing and Decreasing Sequence.
My Code -

long int a,b;
int n,i=0;
cin>>n;
cin>>a;

bool isDec;

while(i<n-1){

    cin>>b;

    if(a==b){
        cout<<"false"<<endl;
        break;
    }
    else if(b>a){
       isDec=false;
    }
    else if(!isDec && b<a){
        cout<<"false"<<endl;
        break;
    }

    i++;
    a=b;
}
if(i==n-1){
    cout<<"true"<<endl;
}

hello @ksalokya

pls save ur code at cb ide and share its link with me.

check now

nope. not working. example case itself not passing.

This seems to work. Anyways, Thank You!

yeah , i didnt noticed that u were already reading one element before loop

1 Like

Yeah! Thanks a lot! You can close this thread.

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.