ma’am/sir , i have tried my best but was unable to understand the question- what i was supposed to do her? do we need to use the array or take the input with the help of loop? do we need to take two series as an input increasing and decreasing and then print true and false according to their order??
please let me know sir/ma’am what do i need to do in this question?
Unable to understand the question
Explanation of Question
Question is
you have to check whether the given array can be split into two
such that first sequence is strictly decreasing and second is strictly increasing
given input is
5
1 2 3 4 5
first decreasing sequence is of size 0
and then increasing sequence is of size 5
so output should be true
NOTE: decreasing or increasing sequence can be empty sequence
that means for completely inc and completely dec sequences output should be true
case 1: 12345
case 2: 54321
case 3: 32124
these cases are true as you have to find (strictly increasing) or (strictly decreasing) or (strictly decreasing and strictly increasing).
case 4:12321
case 5:12234
these cases are false because in case 4 it is strictly increasing and strictly decreasing and in case 5 it is not strictly increasing it is simply increasing.
Approach
you can solve this just by using some variables
you have to check that if current trend is decreasing and previously it is increasing then ans is false
or if elements are neither increasing or decreasing then also ans is false
Reference Code