pls help me with the alternate approach
total - digits that have 2 or 5 in them
Total = numbers between 100 and 999 inclusive = 900.
200-299 and 500-599 will each have 100 numbers which contain 2 or 5.
For remaining each set of 100 count numbers having 2 or 5.
Let's look at 100 - 199, for instance.
Start with 2s:
102, 112, 122, 132, 142, 152, 162, 172, 182, 192 = 10
120 - 129 has 10 numbers but we have already counted 122 above, so for this range we will only count 9.
Total unique numbers with 2s in 100-199 = 19.
For 5s: Just like above we will get 19.
But in these 19, we have 125 and 152 - which are already counted in 2s above, and will be double counted in 5s again.
So unique numbers in 100-199 having 2 or 5 = 19 + 19 - 2 = 36.
We have 100-199, 300-399, 400-499, 600-699, 700-799, 800-899, 900-999 = 7 such sets of 100 numbers.
So total numbers having 2 or 5 = (2 x 100) + (36 x 7) = 200 + 252 = 452
Numbers not having 2 or 5 = 900 - 452 = 448