For integers {1,2,...,9} -
9 ways for 1 (from set B) to choose an element from set A.
The remaining 8 numbers will be automatically get mapped to 0 ( of set B) , so only 1 way.
Total functions = 9 * 1 = 9.
For integer 10 -
As no restriction mentioned , can be mapped to 0 or 1 ( 2 choices )
Total functions = 2 (for int 10) * 9 (ints 1 to 9) = 18