Increasing and Decreasing Sequence Problem


It is not passing two test cases.

Please, read the question carefully.
the first input is the number of elements in the sequence.
But your program is not considering this input.
Your code is directly taking the sequence.
This is causing problem.

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.

https://ide.codingblocks.com/s/82797 I have corrected this issue but still unable to find the mistake.

I checked your code.
But I didn’t find the correction in the code.
It is still facing the same issue as I mentioned earlier.

Your code is not asking for the “size” of the sequence.

Your code is taking n, but that is a variable for the elements of sequence, not for the size.
You have to include:

int n, seq[1000];
cin>>n; //input : size of sequence
for(int i =0;i <n; i++)
cin>>seq[i]; // input: elements of sequence