Given two decimal numbers U and V if we write down all the numbers from U to V how many zeroes(0) we will write?Where U<=V<=10^9 For example if U = 100 and V = 105 then we have to write 100,101,102,103,104,105 There are total 7 zeroes therefore the result is 7. I was trying to find a pattern but i could not come up with any perfect solution :(
you don't need dp for this.. the number of zeroes between 10n and 10n + 1 - 1 = 9 * n * 10n - 1
Just wrote python script to find this, I'm very bad in number theory :(
But how does it work?Can you please explain a bit?