Google | Numbering system that skips every number with a '7' digit
Anonymous User
1353

For any positive integer, write a method that returns what the number would be if every number containing one or more '7' digits was skipped while counting.

So our new counting system is: 1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 18 19...

7 would map to 8, 8 would map to 9, 16 would map to 18, etc.

Halfway through my interview the interviewer dropped the completely different problem I was working on and introduced this one. This was a coding interview, and I heard back from the recruiter that I was panned for not being able to write working code for this in the 22.5 minutes I had remaning in the interview(code, not pseduocode). I've already found a complex solution working on this at home, I just want to see if there's some trick I missed, or if folks agree that this is almost impossible to solve in the ~23 minutes I had left.

Here is the input and output for the first 100 integers. Be sure you can at least handle all this input, it's trickier that it looks at first glance.

Input test cases: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

Output for each test case: 1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 45 46 48 49 50 51 52 53 54 55 56 58 59 60 61 62 63 64 65 66 68 69 80 81 82 83 84 85 86 88 89 90 91 92 93 94 95 96 98 99 100 101 102 103 104 105 106 108 109 110 111 112 113 114 115 116 118 119 120 121


Related problems:

Comments (11)