Cannot find a wrong testCase!

Was Solving the problem Chef and beautiful digits. Came up with asolution cannot find why it is giving wrong answer? HELP needed !
Problem Link:
https://www.codechef.com/problems/CHDIGER

Code link:
https://www.codechef.com/viewsolution/23924872

@pranjal01shi check this test case
Input-
1
33233 4

output should be- 24444
but your returns- 32334

Hope it helps, :slightly_smiling_face:

1 Like

mine returns wrong , you are correct, but the correct output for the mentioned testcase should be 23344. Correct me if I am wrong !

Yes sorry for the wrong output yes the output should be 23344,

In simple word,i would like to say that first we check out the last digit is greater than that d number then replace that greater number to d after that find the smallest digit of that decimal integer number ,remove all number before that smallest decimal integer digit,and add ā€˜dā€™ on last of the decimal integer number (add that much d number how much you removed number for example if you removed 3 digit number then add triple time d (ddd))
to apply this logic you get the true answer,i hope this will work.