Beginner Friendly Approach..!
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    long long smallestNumber(long long num) {
        string a = to_string(num);
        string temp = "";
        int zero = 0;
        if(num > 0){
            sort(a.begin(),a.end());
        } 
       for(auto i : a){
            if(i != '0'){
                temp += i;
            } else {
                zero++;
            }
        }
        string result = "";
        if(num > 0){
            for(auto i : temp){
                result += i;
                while(zero > 0){
                    result += '0';
                    zero--;
                }
            }
        } else {
            sort(a.begin()+1,a.end(),greater());
            result = a;
        }
        long long answer = stoll(result);
        return answer;
    }
};
```
['String', 'Sorting', 'C++']