We have 9000 4 digit numbers.
now we need 4 digit number contain at most 2 different digit which is equal to
total number – all 4 digits different – 3 digits different.
=9000- 9*9*8*7 -9*9*8*6 [3 different digit can place 6 ways that’s why multiply by 6 in 3 different digit]
= 576 (option A)