C++ | String Conversion ( stol() and to_string() ) | Easiest Approach | Explained
``` \n<--- //PLEASE DO UPVOTE IF YOU DO UNDERSTAND THE APPROACH\n\nclass Solution {\npublic:\n    long long smallestNumber(long long num) {\n      \n        str
``` \n<--- //PLEASE DO UPVOTE IF YOU DO UNDERSTAND THE APPROACH\n\nclass Solution {\npublic:\n    long long smallestNumber(long long num) {\n      \n        string s = to_string(num);     // Covert number to string\n      \n\t    // if number is -ve, reverse sort the string      \n\t\t\n        if(s[0] == \'-\'){               \n\t       sort(s.begin() + 1, s.end() ,greater<char>());  \n         }\n\t\t \n      // for +ve number sort and bring the first non zero number to front  \n\t  \n   \t  else{      \n            sort(s.begin() ,s.end());     \n            for(int i = 0; i < s.length() ; ++i){\n            if(s[i] != \'0\'){\n            swap(s[i] ,s[0]);      \n            break;\n            }\n       }   \n  }\n     \n     long long res = stol(s);      // Convert the string to number again\n    \n     return res;\n    }\n};
['String', 'Sorting', 'C++']