Increasing Decreasing Sequence

here is my code for increasing decreasing sequence, but one out of the ten test cases is failing again and again, and I am totally unable to debug this error.

@Akshat1506 Consider the input:
5
5
5
5
5
5

Expected Output:
false

Can you share the corrected code, please.

@Akshat1506 Just introduce an equality, that is <= in line 15 and >= in line 21 and then try to submit.