`2 2 8 7 10 9 11 ` - how this is wave form?


#1

Your submission failed for the following input:

A : [ 11, 8, 7, 9, 2, 10, 2 ]

Your function returned the following :

7 2 8 2 10 9 11

The expected returned value :

2 2 8 7 10 9 11

is 2 2 8 is in wave form??


#2

the the wave form is like: a1>= a2 <= a3 >= a4 <= a5…So 2 2 8 is indeed considered Wave form.

for some cases multiple forms are possible. Then we need to give Lexographically smallest. Refer the example given in question.


#3

2>=2,
2<=8,
there is equal to sign also.
and also: first 2 is not compared with 3rd 8,
all are compared with its left and right neighbour only