Python3 - Simple - O(n)
Intuition / Approach
Turn num to string so digits can be counted.
If num > 0, zeroes are added after first digit and rest of digits are in ascending order
If nu
# Intuition / Approach
1. Turn num to string so digits can be counted.
2. If num > 0, zeroes are added after first digit and rest of digits are in ascending order
3. If num < 0, zeroes are added at the end. The ordered string in (2) without zeroes is reversed so negative number is minimised.


# Complexity
- Time complexity: O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(n)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def smallestNumber(self, num: int) -> int:
        
        digit_count = Counter(str(abs(num)))
        res = ""

        for i in range(1, 10):
            res += str(i) * digit_count[str(i)]
        
        if num > 0:
            res = res[0] + "0" * digit_count["0"] + res[1:]
        else:
            res = res[::-1]
            res = "-" + res + "0" * digit_count["0"]

        return int(res)
```
['Python3']