A different problem


#1

Isn’t this problem same as finding the next greater number with the same digits which can be done in O(nlogn)?