5 1 4 2 3 how can this be wrong


#1

Comment body goes here.


#2

This is not lexicographically correct.
This should be correct ans : 2 1 4 3 5
See the meaning of lexicographically and attempt the problem again.


#3

what about 1 3 2 5 4?


#4

No, 1 3 2 5 4 isn’t correct. Output should start with a higher value than it’s precedent one.


#5

why 2 1 5 3 4 is not correct ans?


#6

because 2 1 4 3 5 is also a possible answer and it is lexicographically smaller than 2 1 5 3 4.
See the meaning of lexicographically and attempt the problem again.