c solution
Code\n\nint cmp(const void*a,const void*b){\n    return *(int*)a-*(int*)b;\n}\n\nlong long smallestNumber(long long num) {\n    if(fabs(num)<10) return num;\n  
# Code\n```\nint cmp(const void*a,const void*b){\n    return *(int*)a-*(int*)b;\n}\n\nlong long smallestNumber(long long num) {\n    if(fabs(num)<10) return num;\n    int *map=calloc(64,sizeof(int));\n    bool flag=num<0?true:false;\n    int idx=0;\n    while(num){\n        map[idx++]=num%10;\n        num/=10;\n    }\n    \n    map = realloc(map, sizeof(int)*idx);\n    qsort(map,idx,sizeof(int),cmp);\n    for(int i=0;i<idx;i++) printf(" %d",map[i]);\n    long long res=0;\n    if(flag){\n        int i=0;\n        while(i<idx){\n            res=res*10+map[i++];\n        }\n        return res;\n    }\n    else{\n        //find non zero element\n        int i=0;\n        while(i<idx && map[i]==0) i++;\n        \n        res=map[i]*pow(10,i);\n        i++;\n        while(i<idx) res=res*10+map[i++];\n        return res;\n    }\n    return -1;\n}\n```
['C']