i am not understanding logic
Increasing decreasing
how can i split sequence s1 to si
you don’t have to split any sequence.
what you are required to do is to keep track of whether the sequence is:
- strictly increasing (entirely)
- strictly decreasing (entirely)
- First strictly decreasing than strictly increasing
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.
Hint: there should be no decrease in sequence if it once starts increasing i.e. first increasing than decreasing returns false.
Hope, this would help.
if you still have doubts, feel free to ask.
how to store elements without array
You have no need to store the entire sequence.
Just, take a variable “pre”, that stores the previously entered number and compare it’s value with the currently entered number.
hint: initialize “pre” with a large value.
Now, start coding.
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.