Brute force Solution 
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
```java []
class Solution {
    public long smallestNumber(long num) {
        
        String numa = ""+num;
        String arr[] = numa.split("");
        if(arr.length==1){
            return num;
        }
        if(num<0){
            Arrays.sort(arr,(a,b)->(b+a).compareTo(a+b));

            String digi = String.join("",arr);
            digi = digi.substring(0,digi.length()-1);

            return -Long.parseLong(digi);
        }
        else{
            Arrays.sort(arr,(a,b)->(a+b).compareTo(b+a));

            int index =0;
            while(arr[index].equals("0")){
                index++;
            }
            String ans = ""+arr[index];
            int noOfZero= index-0;

            while(noOfZero!=0){
                ans+=0;
                noOfZero--;
            }
            for(int i=index+1;i<arr.length;i++){
                ans+=arr[i];
            }
            return Long.parseLong(ans);

        }
    
    }
}
```
['Java']