Amazon Interview Question

Coding question 2: Finding next largest number with same digits