C++ STL || find_first_not_of || Used
\nclass Solution {\npublic:\n   long long smallestNumber(long long num) {\n        string s = to_string(abs(num));\n        if(num >= 0){\n            sort(s.be
```\nclass Solution {\npublic:\n   long long smallestNumber(long long num) {\n        string s = to_string(abs(num));\n        if(num >= 0){\n            sort(s.begin(), s.end());\n        }else{\n            sort(s.begin(), s.end(), greater<char>());\n        }        \n        if(num > 0){\n            int indx = s.find_first_not_of(\'0\');\n            swap(s[0], s[indx]);\n        }\n        \n        long long ans = stol(s);\n        if(num < 0)\n            ans = -ans;\n        return ans;        \n    }  \n};\n```
[]