Count numbers having N 0 ' s ▁ and ▁ and ▁ M ▁ 1' s with no leading zeros | Function to return the factorial of a number ; Function to return the count of distinct ( N + M ) digit numbers having N 0 ' s ▁ and ▁ and ▁ M ▁ 1' s with no leading zeros ; Driver code
function factorial ( f ) { var fact = 1 ; for ( var i = 2 ; i <= f ; i ++ ) fact *= i ; return fact ; } function findPermutation ( N , M ) { var permutation = factorial ( N + M - 1 ) / ( factorial ( N ) * factorial ( M - 1 ) ) ; return permutation ; } var N = 3 , M = 3 ; document . write ( findPermutation ( N , M ) ) ;