sir i wrote the code for this problem and it is also functioning well, giving correct output every time. but when i submit the same code then it shows that 2 test cases are not passing and hence i got 60/100.i do not know what am i doing wrong. please look into my code. here is the code -
Chewbacca and number
@Ishitagambhir maam but it is written in the question that we have to flip every possible bit only if after flipping we get a bit which is smaller than the previous one. i did not get ur reply. for the input 94545 we should get 04444 and it should be printed as 4444 as o as the MSB should not be present in answer.
hi @pushkar24sharma
it is written that there should be NO TRAILING ZEROES
it means that if your number is becoming like 012 or 0012 or anything like that, then you should not flip the digit, it should remain 9 only.
9012 is acceptable
0012 is not
the total number of digits in the number should not change.
1 Like