Counting Problem - Strings What is the number of strings of four decimal digits that contain exactly
one digit repeated twice? (e.g 1198)
My intuition was to first place the digits that aren't repeated and then place the $(10-1)$ remaining digits. Would this be:
$$\binom{10}{2} \times 9$$
Thanks!
 A: There are $10$ ways to choose the repeated digit, and there are $\binom42$ ways to choose which $2$ places in the string it will occupy. There are then $9$ choices of digit for the first unfilled slot, and after you’ve filled it there are $8$ choices of digit for the remaining unfilled slot. Thus, there are
$$10\cdot\binom42\cdot9\cdot8=4320$$
possible strings.
If the repeated digit is allowed to appear more than twice, you must add the $10$ strings in which it appears $4$ times and the
$$10\cdot\binom43\cdot9=360$$
strings in which it appears exactly $3$ times, for a total of $4690$ strings.
The binomial coefficient $\binom{10}2$ plays no part in this: it’s the number of ways to choose $2$ of the $10$ digits and would be of interest only if we were looking at strings in which just two different digits appeared. Assuming that the repeated digit is allowed to appear only twice, we have no such strings. You could, however, analyze the problem by starting with the choice of $3$ digits to appear in the string: this can be made in $\binom{10}3$ ways. Then you can choose one of the $3$ to be doubled, a choice that can be made in $3$ ways. There are then $\binom42$ ways to pick the $2$ slots for the doubled digit, and once they’ve been chosen, there are $2$ ways to insert the remaining $2$ digits into the remaining $2$ slots. This analysis results in the calculation
$$\binom{10}3\cdot3\cdot\binom42\cdot2=4320\;.$$
And the analysis offered by Solid Snake is also correct. This problem is a good illustration of the fact that many counting problems can reasonably be solved in a variety of ways.
A: Assume that the contraint is exactly one digit is repeated exactly twice. 
STEP 1: Choose the number to be repeated: $10$ options
STEP 2: Choose the other two numbers:
$$\binom{9}{2} \ \ \text{  options.}$$
STEP 3:  Calculate all the permutations of this four characters: $4!=24$
This leads to 
$$10\times 24\times \binom{9}{2} \ \ \text{options,}$$
however, you must divide by $2$ since this distinguish between the repeated digits (e.g. $1189$ is being counted twice as $1\bar189$ and $\bar1189$), thus, the final number is:
$$5\times 24\times \binom{9}{2} $$
