Increasing Decreasing sequence-code is not working properly for some test cases

Hi
Your logic is not right
5
1
2
3
4
3
Your output is true here, but it should be false.Pls look into your code and try to debug if possible or let me know if I can help
Also pls comment your code or explain your logic here

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.