Increasing decreasing sequence problem

https://ide.codingblocks.com/s/53927

i m trying to hit the logic for a sequence which is first increasing then decreasing…
can u suggest some way to do tht?
i have tried to applied it through a variable point but not getting output

Hi Yukti, the logic is not correct. You’ll always get true, because you’re just comparing the adjacent elements. The statement ‘if(ar[i]<ar[i+1] || ar[i]>ar[i+1])’ will give true even for 1 3 2 4 5 because for every adjacent pair of elements either of the two statements will give true. Try to think of something else.