SORT AND SWAP || VERY EASY SOLUTION|| 100% FASTER
DO UPVOTE PLS :)) IF U FIND IT USEFUL, I\'HAVE JUST STARTED TO POST.\n\n\'\'\'class Solution {\npublic:\n\n    long long smallestNumber(long long num)\n\t\n    
DO UPVOTE PLS :)) IF U FIND IT USEFUL, I\'HAVE JUST STARTED TO POST.\n\n\'\'\'class Solution {\npublic:\n\n    long long smallestNumber(long long num)\n\t\n    {\n\t\n\t\n       string s=to_string(num); //  i made number as string so that i can check digits easily without any loop\n\t   \n          if(num>0){\n\t\t  \n            sort(s.begin(),s.end());\n            if(s[0]==\'0\'){\n                int i=0;\n                while(s[i]==\'0\'){\n                    i++;\n                }\n                swap(s[0],s[i]);\n            }\n        }\n        else{\n            sort(s.begin()+1,s.end(),greater<char>()); // I did \'\'s.begin()+1" beaacuse we dont  want minus sign to be sorted right we want it at starting\n        }\n        return stoll(s);\n    }\n};\'\'\'\n
['C']