Domanda di colloquio di Amazon

Coding question 2: Finding next largest number with same digits