How many digits are in between 500 and 600 which have only one 9 in them?
509,519,529,539,549,559,569,579,589, ==== 9 numbers.
590, 591,592,….598 ===== 9 numbers.
In 599, 9 occurs twice so don't consider.
Answer: 18 numbers.
How many numbers are there between 100 and 1000 which exactly have one of their digits as 7?
Please answer efficiently.