Increasing decreasing sequence

i am unable to go about this problem’s solution

what problem are facing ??
which thing your are not able to understand?

how to find soluton of this problem

iterate over array and check if it is greater or smaller than previous element
case1 :if it is greater means sequence is increasing here now for next time it can’t be decreasing

case2: if it is smaller than previous
then it should not increasing before it

if these condition not hold true ans is “false” otherwise “true”

4 test cases are returning wrong ans.please tell what’s the error