HackerRank Python Challenge
Given a range of numbers x and y, how many non repeating numbers are there?
For example: range 219, 220, 221, 222, 223
220, 221, 222, 223 are matching numbers because digit 2 appears twice in each number.
219 is a non matching number. There is no repeating digit.
Think before you Code
There are 3 problems. First is taking two numbers and creating a range. Lucky for me there's a function for that range(x, y). The next problem is taking each number in the array and converting it into an array because I need to filter out each digit to find a repeating number. In a the array, if it appears more than once it is a match. Finally the last problem is creating an array of non matching numbers and counting that array to return the result.
There are: 1 non matching numbers
[220, 221, 222, 223]
I can improve my code by breaking the loop when a match is found so a number like 0012334 will not have to check for a repeating digit if one is already found.