N digit numbers with digit sum S

Problem Setter: amitkgupta94
Problem Tester: archit.rai

Find out the number of N digit numbers, whose digits on being added equals to a given number S. Note that a valid number starts from digits 1-9 except the number 0 itself. i.e. leading zeroes are not allowed.

Since the answer can be large, output answer modulo 1000000007

****

N = 2, S = 4
Valid numbers are {22, 31, 13, 40}
Hence output 4.

NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving N digit numbers with digit sum S  on Interview Code Editor
Sign Up
to access hints and editorial solutions for N digit numbers with digit sum S
Click here to start solving coding interview questions