Increasing decreasing sequence


some testcase not giving right answer

hey @khemchandrs, can we first discuss the logic then code?

i did not know how can i do this question

tell what approach i will used in this question

hey @khemchandrs, https://ide.codingblocks.com/s/131501 here is the solution for this ques, please read the solution and fell free to ask in case of any doubt.