num. Rearrange its digits to get the smallest possible number and return it.
The sign stays the same, and the result must not have leading zeros (zero itself is written as just 0).num=5070 → 5007
From the digits 5, 0, 7, 0 without a leading zero, the smallest number is 5007.
num=-2093 → -9320
The sign stays negative, and a negative number is smaller the larger its absolute value is: -9320.
num=0 → 0
num=5070
5007
Run checks the first 3 tests in your browser. Submit checks all 123 tests on the server, hidden ones included.