I am missing only 1 test case, the first one.
This is the link of my code : [ https://ide.codingblocks.com/s/195031 ]
Can you tell the logical error in my code?
@amitqy
u have missed out a condition in if ( x < 10 )
if(x < 10){
if((9 - x%10) == 0){
num = x % 10;
}else{
num = min(9-(x%10),x%10);
}
}
if the number is not 9 at the last place, then your code produced the wrong out eg 123 or 3245
so in this case the answer would be 123 & 3244
but ur code took garbage value
adding the else condition helps u pass all test cases