Please suggest a suitable approach for this problem.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Ok. Ask yourself first how many contain 00. Next, how many contain 11 (it's 17, you work it out). Then consider the number that contain 22, etc. You will get 9+17*9=162. I hope this helps.
In your comment, you said that the given solution was 9 • 9 + 1 • 9 + 8 • 9 = 162. I'll attempt to explain a logic that yields that calculation.
Consider the 3-digit numbers that start with two identical digits. There are 9 choices of the first digit (and inherently the second digit): 11, 22, 33, 44, 55, 66, 77, 88, and 99 (not 00 because the number is in the range 100-999). For each of these, there are 9 choices of the final digit (0-9, except whatever digit was already chosen for the first two). So, there are 9 • 9 such numbers.
Now, suppose that the number ends with two identical digits. There are 10 choices for the last digit (and inherently the second-to-last digit): 00, 11, 22, 33, 44, 55, 66, 77, 88, and 99, but we need to treat 00 separately from the rest. If the number ends with 00, then the first digit can be 1-9, so 9 choices, so 1 • 9. If the number ends with 11-99, there are 8 choices of first digit (1-9 except the digit already chosen), so 9 • 8.
While I have the 8 and 9 transposed in the final term, this is term-by-term the same expression as in the solution you gave.
Number of three digits with only one pair of consecutive digit= 171. Let’s consider abc the three digits number. We need a=b or b=c. We have 9 ways of choosing a;
We have two scenario for b,
b=a, we have only one choice. In this case we have 9 ways of choosing c since because we can choose any number except a.
b not = a, we have 9 ways of choosing b. In this case we have only one way of choosing c; it has to be b, for us to have at least two consecutive digits.
So the number of three digits with only one pair of consecutive digits can be formed two ways, hence it is (9*1*9) + (9*9*1) = 81+81 = 162.