Can i manipulate the sequence in which the number has been inputted to get the increasing and decreasing sequence…please specify.
Not able to understand question
no, you cannot manipulate the order of the sequence. Moreover, there is no need of doing it.
This problem doesn’t ask you for extracting the increasing or decreasing substring from the given sequence.
Actually, you are required to check if the given sequence is satisfying any one of the given constrains:
- Strictly increasing : 2,12,54,84,96
(the numbers are entered in increasing order, i.e. nth element < (n+1)th element) - Strictly decreasing: 96,84,54,12,2
(nth element > (n+1)th element) - First decreasing then increasing: 95,54,13,26,62
(the numbers are first decreasing and after a point starts increasing)
If it satisfy, return true
Else, return false.
Hope this would help you understand the problem. If you still have doubts, feel free to ask.