my output: 51324
expected output:21435 why?
Read the NOTE part at the end of the question.
You have to return the lexicographically smallest if multiple exists.
Your answer is correct but not lexicographically smallest. In the question it is mentioned if multiple answers exist then you need to return the lexicographically smallest one. If you are stuck, try reading the hint for the question.