Increasing and decreasing sequence question doubt

INCREASING DECREASING SEQUENCE
Take the following as input.

A number (N)
Take N more numerical inputs
The N inputs for a sequence S = s1, s2, …, sN. 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. Print true/false as output.

Input Format:
Constraints:
0 < N < 1000 Each number in sequence S is > 0 and < 1000000000

Output Format
Sample Input
5
1
2
3
4
5
Sample Output
true
sir, i am not getting this questions… what does he want to say? the sample input that they have given should have output false according to me…As 1,2,3,4,5 if we take i=3, then 1,2,3 is incresing sequence and also S(i+1) to S(n) that is 4,5 is also incresing…Please explain me this question so that i can solve it…

hi sheena
in this problem you have to basically consider 4 cases

the sequence can be either monotonically increasing
the sequence can be either monotonically decreasing
it can be either first increasing then decreasing
it can be either first decreasing then increasing.
if any of the case is true then answer is “yes”
try working upon this.

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.