Find next higher number using exact same digits
Problem Given a number X find the number Y which is next higher number than X using the exact same digits as in X.
Example
For example: given 38276 return 38627
Solution
Method 1 - Brute force
The brute-force method is to generate the numbers with all digit permutations and consider all the higher numbers than the given number and return the minimum number from those higher numbers.
[Read More]