use SORTING cleaver solution O(n logn) [beats 98.86%]
\n\n\nclass Solution:\n    def smallestNumber(self, num: int) -> int:\n        if num ==0 : return 0\n        res , zero = \'\',\'\'\n\n        for i in str(num
\n![image](https://assets.leetcode.com/users/images/8493dcc0-0038-41d8-bd32-38eb02d061d6_1662977841.0521178.png)\n```\nclass Solution:\n    def smallestNumber(self, num: int) -> int:\n        if num ==0 : return 0\n        res , zero = \'\',\'\'\n\n        for i in str(num):\n            if i != \'-\':\n                if i==\'0\':\n                    zero += i\n                else:\n                    res += i\n                \n        res = \'\'.join(sorted(res))\n        \n        if num < 0:\n            return \'-\'+ res[::-1] + zero\n        elif res and zero:\n            return res[0] + zero + res[1:]\n        else:\n            return res\n```
['Sorting', 'Python3']