πŸ’‘ Increasing Decreasing Sequence (Question statement doubt)

Hi,

I am having an issue with understanding this problem.
As per the problem , it was supposed to print true if we can split the first sequence in strictly decreasing and other in strictly increasing order.
For the given series of
1 2 3 4 5
How is this possible?
Please let me know if i am missing something.

Hello @idontknowhowtocode,

Hello,
You are given a sequence of numbers.

you don’t have to split the sequence.
what you are required to do is to keep track of whether the sequence is:

  1. strictly increasing (entirely) eg. [1,2,3,4]
  2. strictly decreasing (entirely) eg. [5,3,2,0]
  3. First strictly decreasing than strictly increasing eg. [5,3,1,4,6]

if yes,
print true
else,
print false

strict function: which do not contain the same number at consecutive positions i.e. same values cannot occur one after other.
example: [1, 1, 2] This is not a strict function as there are two 1 at consecutive locations.

Hint: there should be no decrease in sequence if it once starts increasing i.e. first increasing then decreasing returns false. eg. [2,4,7,3,1] (not accepted)

In the series, you have given, the decreasing sequence is null/empty.
Thus, falling into point 1.

Hope, this would help.
if you still have doubts, feel free to ask.
Give a like if you are satisfied.

Hello so you are saying if input is 1 2 3 4 5, then answer will be true bcz it is strictly increasing.
if input is 8 7 6 5 4 3 it will be also true bcz of strictly decreasing.

if I/p is 1 2 3 4 9 8 7 6 it will be false, bcz in first it was increasing and then it decreases.

but if it is 9 8 7 6 1 2 3 it will be true?

Right?

Yes, @idontknowhowtocode.

And also look for equality(non-strict sequence).

1 Like

okay one llast doubt, will this be
1 3 4 5 6
True?

Yass @idontknowhowtocode,

Let me know, if you face any problem.