Here's how I solved this:
1) No restrictions: $[1, 999]$ = $999$ numbers
2) Violation (no $9$s): there are $9$ digit choices for the first, $9$ for the second, and $9$ for the third because we exclude the number $9$ itself from the range $[0, 10]$ = $729$ such numbers
3) Condition enabled: $999$ – $729$ = $270$.
Something feels off, though. Is this solution correct? Sorry if this seems trivial.
Edit: I suspect I may encounter problems for numbers where the first two digits are $0$s–did I overcount?
Best Answer
You can salvage your approach.
A positive integer less than $1000$ has a unique representation as a $3$-digit number padded with leading zeros, if needed.
To avoid a digit of $9$, you have $9$ choices for each of the $3$ digits, but you don't want all zeros, so the excluded set has count $9^3 - 1 = 728$.
Hence the count you want is $999 - 728 = 271$.