Hi taipei,

i) If there were no restrictions, the number of possible PIN codes would be .

The invalid codes come in 3 forms.

Codes like xxxy: There are 10 ways to choose x and then there are 9 ways to choose y, so there are possibilities.

Codes like yxxx: Similarly, there are possibilities.

Codes like xxxx: There are 10 of these.

So the number of allowable codes is .

Maybe you can work out ii) from this.