Frequency Array, Java, beats 99%
Approach:\n We make an array "digits" and store occurence frequency of each digit.\n If the number was negative, we just need to iterate from index 9-0 and add 
**Approach:**\n* We make an array "digits" and store occurence frequency of each digit.\n* If the number was negative, we just need to iterate from index 9-0 and add that digit as many times as it occurred in the original number.\n* If the number was positive, we need to avoid trailing zeroes first.\n* So, we find the smallest non-zero value and set that as our first digit using our findFist() function.\n* Then we can safely add the rest of the digits from index 0-9.\n\n**Code:**\n\n\tpublic long smallestNumber(long num) {\n\t\tint[] digits = new int[10];\n\t\tlong temp = Math.abs(num);\n\t\twhile(temp!=0){\n\t\t\tdigits[(int)(temp%10)]++;\n\t\t\ttemp = temp/10;\n\t\t}\n\n\t\t//--NEGATIVE--\n\t\tif(num<0){\n\t\t\tfor(int i=9;i>-1;i--)\n\t\t\t\ttemp = addDigit(digits, i, temp);\n\t\t\treturn 0-temp;\n\t\t}\n\n\t\t//--POSITIVE--\n\t\ttemp = findFirst(digits);\n\t\tif(temp==0)\n\t\t\treturn 0;\n\t\tdigits[(int)temp]--;\n\t\tfor(int i=0;i<10;i++)\n\t\t\ttemp = addDigit(digits, i, temp);\n\t\treturn temp;\n\t}\n\n\tint findFirst(int[] arr){\n\t\tfor(int i=1;i<10;i++)\n\t\t\tif(arr[i]!=0)\n\t\t\t\treturn i;\n\t\treturn 0;\n\t}\n\tlong addDigit(int[] digit, int i, long temp){\n\t\twhile(digit[i]!=0){\n\t\t\ttemp = temp*10+i;\n\t\t\tdigit[i]--;\n\t\t}\n\t\treturn temp;\n\t}
['Array', 'Java']