Counting problem question "How many 3 digit integers are possible, such that none of the digits appear more than twice, and none of the digits are equal to zero?"  At first glance the problem seemed easy enough:  you have 9 possible digits and 3 slots, with no two digits appearing more than twice. I assumed $9 \times 9 \times 8 = 648$ would give the solution. To my surprise, my answer was not correct. The correct answer is 720. The way they solved it was by taking all possibilities $9 \times 9 \times 9 - 9$.  (Here $-9$ expresses the break on the constraint.)  I understand what they did, but my question is why does $9 \times 9 \times 8$ fail to account for missing possibilities? I cannot wrap my head around it, $9 \times 9$ would account for any 2 digits and allowing repetition and you would have 8 more possibilities. Whats wrong with my logic?
 A: Your $9\cdot9\cdot8$ is the number of ways to pick any non-zero first digit, any non-zero second digit, and a non-zero third digit different from the first digit. Thus, it fails to count such allowable numbers as $121$, $848$, and so on. There are $9\cdot8=72$ such numbers: $9$ choices for the first and third digits, and then $8$ choices for the middle digit. And sure enough, $648+72=720$, so we’ve accounted for all of the numbers missed by your original calculation.
A: If the first two digits you pick are different, there is no restriction on the third. So for the third digit there are only 8 possibilities in a few rare cases. Most of the time it's 9 there too.
A: The factor $8$ in your calculation was based on assuming that one of the $9$ digits is unavailable for the last digit.  But that assumption is correct only if the first two digits are the same. If the first two digits are different, then any of the $9$ digits is OK for the last one.
A: The total number of digits from $000$ to $999$ is 1000.
Remove all the "numbers" starting with the digit $0$ e.g. $014$: there are 100 of these.
Also remove all the numbers with only $0$ as either the second of third digit. There are $9 \times 19 = $171 of these. [I suppose in this part I did use inclusion-exclusion].
Finally, remove $111,222,...,888,999.$ There are 9 of these.
These three removals are mutually exclusive (therefore we don't need to worry about inclusion-exclusion), so the answer is $1000 - 100 - 171 - 9 = $720.
