Chewabacca and no

what is wrong in this code it is not passing only one case that is test case 4

Hey @shubhangis248

 if(t==0)
        {
           if(i!=count-1) q=t; //here do this
        }

Otherwise failing for cases like 9999
If this resolves your query then please mark it as resolved :slight_smile:

why we did this can you explain with the help of example?

for 99
ans is 90
But in your case its coming out to be 90 ,why because when t==0 you are not making any change that is whenever there is 9 you just simply ignore and move ahead but we have to convert every 9 to 0 unless its starting 9(leftmost)
So i==count-1 is checking if its leftmost or not ,if its leftmost then we leave it unchanged and for the rest we do q=0;