Beginner Friendly Approach
Steps
If the number is negative then simply for it in descending order as , larger the number , smaller the value for negative numbers i.e -760 < -400.
If the n
# Steps
1. If the **number is negative** then simply for it in **descending order** as , larger the number , smaller the value for negative numbers i.e `-760 < -400`.
2. If the **number is positive** then we can count the number of `0's` and insert them after the **first non-zero number** i.e for `535002` , we can simply sort it to 
    - `002355` then insert `0's` after the first non-zero number i.e `2` which will give us `200355` , the **smallest possible number** after rearrganing. 

---
# C++
```cpp 
class Solution {
public:
    long long smallestNumber(long long num) {
        string s = to_string(num);

        // For Positive Numbers
        if (s[0] != '-') {
        int cnt = 0; 
        for (char a : s) if (a == '0') cnt++;
        int first_nonzero = 0;
        sort(s.begin(), s.end());
        for (int i = 0; i < s.size(); i++) {
            if (s[i] != '0') {
                first_nonzero = i;
                break;
            }
        }
        s.erase(s.begin(), s.begin() + first_nonzero);
        s.insert(s.begin() + 1, cnt, '0');  
        return stoll(s); 
        }

        // For Negative Numbers
        else {
            sort(s.begin() , s.end());
            reverse(s.begin(),s.end());
            return stoll(s) * -1;
        }
        return stoll(s);
    }
};

```
['C++']