How many 4 digit numbers are there which contain not more than two different digits?
As usual, I will highlight my attempt:
I can have 9 numbers using only 1 digit, e.g. $1111, 2222, \dots 9999$ = 9 digits
Using two digits out of 9 (excluding 0) (selected in $\,^{8}C_{2}$ ways), I can arrange them in $4!$ ways. Furthermore, I can use one digit out of the selected 2 once or thrice (e.g. $2111$ or $2221$) or simply both digits 2 times (e.g. $2288$, $6677$). Hence I get: $\,^{8}C_{2} \times \left(\frac{4!}{2!\times2!} + \frac{4!}{3! \times 1!}\times 2\right) = 392$
Finally, I consider numbers with zeroes. With zero selected as a digit, I have 9 options for other digits. And using the same logic as in 2) I can have either 1 zero ($8880$), 2 zeroes (e.g. $8800$) or 3 zeroes in a number ($7000$). This gives me $9\times \left( \frac{4!}{2!\times2!} + \frac{4!}{3!\times1!} + 1\right) = 99$
the above 3 steps yield a total number of $9+392+99=500$
However, the answer i have with me is $576$.