please explain what we have to do in thus
Increasing Decreasing Sequence
u have to find the an index exist i
suh that a[0]…a[i] is strictly decreasing and a[i+1]…a[ n-1] is strictly increasig
like 5 4 1 2 3
i=1
0 1 strict decresing
1 2 3 strkct inc
9 8 87 56 55 54 53 52 1 2 3 4 5 should this sequence return a true or false
This will return false
but in the given sample input n=5 and the sequence is 1,2,3,4,5 so the sequence is all increasing and the output is true but in the problem statement it is specified that the first sequence is strictly decreasing,
So
A single number is considered to be strictly Inc or Dec
Here we take
1 strictly Dec.
And
2 3 4 5 strictly Inc
Also for
5 4 3 2 1
5 4 3 2 is strictly Dec
And
1 is strictly inc
but sir when the sequence is in continuation and you do not know what the sequence is, then how will you identify this thing through code
u have to check for the different cases
case 1 when sequence is strictly inc
case 2 when seq is strictly dec
case 3 when u got a index i where a[0]…a[i] is strictly dec and a[i+1]…a[n-1] strictly inc
if any one of the above case is true then the ans is true else false
hope this will help
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.