Company: Agoda_8nov
Difficulty: medium
Error Digit Range Problem Description A translator converts the digits of a number from a foreign numbering system into the local one, but it carries a bug: it picks one digit value and renders every occurrence of that digit as some other digit value. Which digit is mistranslated, and what it becomes, is unknown. For example, if the correct value is 11891 and the bug turns every 1 into a 9 , the translator reports 99899 . The 9 that was already there is untouched, and the 8 is untouched. Two rules limit what the translator can produce. The number of digits never changes, and the first digit of the result cannot be 0 . If the mistranslated digit does not occur in the number at all, the result is simply the correct number. The correct number is therefore always one of the possible results. Given the correct value num , work out the largest and the smallest value the translator could have reported, and return their difference. Complete the function findRange , which takes num and returns