Did not getting the solution

Please tell me the solution of programm ,or please explain the question in a simple manner,because in sample input we can not divide the inputs in ascending or descending order.

@mayurjhode55,
5 4 3 2 1 2 3 4 5, ans=true
5 4 3 4 5 4 3 4 5, ans=false