https://hack.codingblocks.com/contests/c/474/194
https://ide.codingblocks.com/#/s/24010
Valid-Invalid-Sequence
The question statement is
“Compute if it is possible to split sequence into two sequences - s1 to si and si+1 to sN such that first sequence is strictly decreasing and second is strictly increasing.”
You missed out the corner cases. According to the question, the sequence would be valid even if it is totally decreasing or totally increasing.
Attempt the question again after understanding it properly.