Valid Invalid Sequence solving using concept of peaks

MY CODE
https://ide.codingblocks.com/#/s/19815

PROBLEM
https://hack.codingblocks.com/contests/c/474/194

I have written a code wherein the program checks whether in a sequence of integers there more than 1 troughs (i.e. opposite of peaks), so whenever two or more troughs are encountered, it automatically breaks the loop and returns answer as false.

But this seems to work only on some cases.

Kindly Help with this.

Also any other method to solve this problem will be much appreciated.

Your code will gve output false even it is a valid sequence like if its an increasing sequence your code will give false , e.g.
5
1 2 3 4 5
You just missing this case

So if I apply my logic to counting of peaks too, and then if(no of peaks >1 || no of troughs >1) it will be false.

Is that it?

Take care of the border cases where the input may be only either strictly increasing or strictly decreasing.