c++ 3 ms O(nlogn)
If you find this helpfull please upvote\n```\nclass Solution {\npublic:\n    #define ll long long int\n    long long smallestNumber(long long num) {\n        ve
**If you find this helpfull please upvote**\n```\nclass Solution {\npublic:\n    #define ll long long int\n    long long smallestNumber(long long num) {\n        vector<ll> v;\n        if(num == 0) return 0;\n        if(num>=-10 and num<=10) return num;\n        while(num!=0){\n            v.emplace_back(num%10);\n            num/=10;\n        }\n        sort(v.begin(),v.end());\n        int i=1;\n        while(v[0] == 0){\n            swap(v[0],v[i]);\n            i++;\n        }\n        ll ans=0;\n        for(auto it : v){\n            ans=it+ans*10;\n            cout<<it<<endl;\n        }\n        return ans;\n    }\n};
['C', 'C++']