I have some different approach for Q.no.18
Three digit no. _ 9 _ Let us start with the middle no. 9 ( as it is the largest single digit no.)
Now there are 8 ways to fill in the hundred's place and 10 ways for the units place digit.
So total 8*10=80
Now put 8 in place of 9 we have 7 and 9 ways so total 63
Continuing in this manner we get 80+63+48+35+24+15+8+3= 276
Although this is not proper solution still it may be used for less no.of digits !