Please Elaborate the Question

I didn’t understand what we want to do, what are the end conditions asked in this question. Please elaborate with examples.

@lckyb27 you have to check whether the array satisfies following property
from start to i it is strictly dec and i+1 to end strict increase like ex
5 4 3 2 1 2 3 4
here i=5 coz from s to 5 strict dec and 6 to 8 strict increase.
i hope its cleared if yes dont forget to hit like and mark resolved :smiley:

@vatsal38 Can you explain the given sample test case.
Given :-
5
1 2 3 4 5

output:- true

why?

choose i=0
so 1 is strictly decreasing
2 3 4 5 strictly increasing
@lckyb27

@vatsal38

Please check this code. It’s giving some error in the testcases

@lckyb27 check for
5
5 4 3 4 5
ans should be true

@vatsal38 I didn’t know what’s wrong in this ?

Can you update it in the above code with some comments?

@lckyb27 your code always give false when first element equals n
here refer this code

@lckyb27 from seeing your code i think you want to use prev and curr approach but you have implemented it all wrong so i tried to keep the same variables as your approach here


(btw the one i wanted you to refer was based on your approach only too)