We are given a positive integer n.
Our task is to find the smallest integer strictly greater than n that uses exactly the same digits as n.
In other words:
n.n.1.2^31 - 1 = 2147483647.Example:
n = 4365
We can rearrange its digits to form:
436543564536456346354653...
We only consider numbers greater than 4365.
The smallest valid number is:
4536
Therefore: