# DIFFICULTY:

1241

Note that all differences B_{i+1} - B_i have the same sign (are all positive, all negative, or all zero). Then, our array B must be nondecreasing or nonincreasing.

So, just sort B, and check if all the conditions hold.

1241

Note that all differences B_{i+1} - B_i have the same sign (are all positive, all negative, or all zero). Then, our array B must be nondecreasing or nonincreasing.

So, just sort B, and check if all the conditions hold.

4 Likes

what will be ans of 9 10 11 12

`"NO"`

, Obviously.

This submission gets AC for this test case even though it shouldnâ€™t.

https://www.codechef.com/viewsolution/64052886

```
1
4
15 90 110 150
```

The answer should be â€śNOâ€ť but it prints â€śYESâ€ť.

Why such weak test cases? Imagine how many wrong submissions got through.

Hey @vantaablackk

Sorry for the problem faced due to the weak test case. I think the problem setter miss this test case in which we have to check the condition for A[1]. That is why your mentioned code pass despite being wrong.

In your mentioned code there is some problem.

`for i in range(2,n-1):`

Here i must start with 1, not 2

`for i in range(1,n-1):`

1 Like