Question d’entretien chez Amazon

Coding question 2: Finding next largest number with same digits