Easy solution using priority queue with explanation
\nclass Solution {\npublic:\n    long long smallestNumber(long long num) {\n        \n            priority_queue<long long, vector<long long>, greater<long long
```\nclass Solution {\npublic:\n    long long smallestNumber(long long num) {\n        \n            priority_queue<long long, vector<long long>, greater<long long>> minh;\n            while(num) {\n                minh.push(num%10); // adding each digit to priority_queue\n                num/=10;\n            }\n            long long zerocount = 0;\n            while(!minh.empty() && minh.top()==0) { // count the number of zeroes if number is positive incase of negative no need count the zeroes as it will come in last\n                minh.pop();\n                zerocount++;\n            }\n        if(minh.empty()) return 0; // if the number on top was 0.\n            long long ans = minh.top(); // add first smallest other than zero.\n            minh.pop();\n            for(int i=0; i<zerocount; i++) { // add rest of the zeroes\n                ans*=10;\n            }\n            while(!minh.empty()) { // add rest of the numbers in increasing order\n                ans = ans*10+minh.top();\n                minh.pop();\n            }\n            return ans;\n    }\n};\n```
['C', 'Heap (Priority Queue)']