Increasing Decreasing Sequence

The explanation part of the problem is not clear to me, can you please help me to understand how do I split the input, In the example, 12345 how is it both increasing and decreasing sequence, if reversed it is, but every increasing sequence will be a decreasing on the reverse, but I still don’t know how do I split the input without using a list, can you give me another example for explanation.

An example where the output should be false with explanation, please

  • A sequence is true if you can split it into two sub sequence such that first sequence is strictly increasing and second sequence is strictly decreasing.
  • For e.g.,
    1 2 3 4 5
    This sequence is also true as we can split it into two sequence like., sequence one is empty and sequence two is 1 2 3 4 5.
  • Let’s take another example.,
    5 4 3 2 1
    This is also true as we can split it such that sequence one is5 4 3 2 1 and sequence two is empty.
    According to the problem statement, we can say the if the sequence decreases then it should not increase, if this is the case one can directly print false else print true.
  • The third case is when the sequence is first strictly decreasing then strictly increasing.
    For example :
    9 5 2 7 10
    The sequence first decreases starting from 9 to 2 - { 9, 5, 2 } and then starts increasing - { 7, 10}. Note that it can also be broken as { 9, 5} and { 2, 7, 10} .
    Since the sequence fulfills the required condition , we would also print “true” for this.

If a sequence does not meet any of the above criteria , we return “false” for it.

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.

Sir, will i really lose points if i unlock the editorial even after completing the problem.

No, if you have already submitted the solution, then your points would not be reducted