Why 2 1 5 3 4 is not correct ans for [1 , 2 , 3 , 4 , 5]?


#1

Comment body goes here.


#2

The answer should be lexicographically smallest so ans should be 2 1 4 3 5.


#3

Because in problem statement it is given a1>=a2, i.e 1st element should be greater than 2nd in the wave sequence.


#4

The output should be lexicographically smallest and thus the correct answer to [1,2,3,4,5] will be [2,1,4,3,5].


#5

bro lexicographically tum apne innovation k chakker m logic ki gand to mat maro na