python
class Solution:\n    def smallestNumber(self, num: int) -> int:\n        nstr = list(str(num))\n        if len(nstr)<2: return num \n        ans = []\n        i
class Solution:\n    def smallestNumber(self, num: int) -> int:\n        nstr = list(str(num))\n        if len(nstr)<2: return num \n        ans = []\n        if num<0:   \n            ans.append(nstr[0])\n            ans.extend(sorted(nstr[1:],reverse=True))     \n            print(ans)\n        elif num>0:\n            nstr.sort()\n            # print(nstr)\n            n0 = nstr.count("0")\n            # print(n0)\n\n\n            if n0>0:\n                ans.append(nstr[n0])\n                ans.extend(nstr[:n0])\n                ans.extend(nstr[n0+1:])\n            else:\n                ans.extend(nstr)    \n        else: return num    \n\n        return int(\'\'.join(ans))\n
['Combinatorics', 'Python']