C++ |Basic approach| By using swap
\nclass Solution {\npublic:\n    long long smallestNumber(long long num) {\n        \n        if(num==0){\n            return 0;\n        }\n      \n        str
```\nclass Solution {\npublic:\n    long long smallestNumber(long long num) {\n        \n        if(num==0){\n            return 0;\n        }\n      \n        string s=to_string(num);\n         \n     if(s[0]==\'-\'){\n           sort(s.begin()+1,s.end(),greater<int>());\n       }\n           else if(s[0]!=\'-\'){\n           sort(s.begin(),s.end());\n                int n=s.size();\n                for(int i=0;i<s.size();i++){\n                    if(s[i]==\'0\' && s[i+1]!=\'0\'){\n                        swap(s[0],s[i+1]);\n                        break;\n                    }\n                    \n                    \n                                  }\n                \n       }\n        return stoll(s);\n    }\n};\n```\nIf you like it then please upvote!
['C']