Don't know how to approach this problem

Hey,
I did not know how to approach the problem I am right now taking the average of the entire array and just comparing that average with the first and last element of shorted array.

Hi Deepak
in this problem you have to basically consider 4 cases

the sequence can be either monotonically increasing
the sequence can be either monotonically decreasing
it can be either first increasing then decreasing
it can be either first decreasing then increasing.
if any of the case is true then answer is “yes”
try working upon this.

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.

Hey can you recommend me something that can help me with this still stuck in this problem

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.

ok let me give it a shot

Hello @Deepak388,

You have not replied to this thread for 5 days.
Please, mark this as resolved if you have solved the issue.
Else, let me know if you are facing any problem.
I am here to resolved your doubts

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.

1 Like