Amazon interview question

Coding question 2: Finding next largest number with same digits