Chewbacca and numbers

please explain me this question

hi @amishakumari you will be given a number, you are allowed to β€œinvert” some digits in this number. Inverting a digit means that you can replace the digit t with 9-t so some of the inversion pairs are

1, 8
2, 7
3, 6, and so on

You have to invert some of the digits in the given number such that the minimum possible number is made

@amishakumari for eg for the given number 4545 you can make the numbers like these by inverting digits

4444,
5445,
4454,
5454,
5555,
It is clear that the minimum possible number is 4444

what is the value of β€œt”

@mehul_madaan β€œt” is the digit

not able to understand this question in the case 4545
digit is 4 so t-4=5 now we can replace digit 5 with t
is this what the question is asking.

@mehul_madaan yes you can replace it with 9-t, the question is asking you to make the smallest possible number by such replacing

input 8989

output1010
how?

@mehul_madaan
9-8 = 1
9-9 = 0

so if 9-t is smaller that t then we have to change it otherwise leave it the way it is

@mehul_madaan that is right. YOu have to make the smallest possible number so make the changes accordingly

thanks a lot for your help .
can i ask you doubts about other questions too.

@mehul_madaan you can use the ask doubt section

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

1 Like