Count of ways to rearrange N digits and M alphabets keeping all alphabets together | Function to find the factorial of the given number ; Function to count ways to rearrange characters of the string such that all alphabets are adjacent . ; Stores factorial of ( N + 1 ) ; Stores factorial of ; Given a and b ; Function call
function fact ( n ) { var ans = 1 ; for ( var i = 2 ; i <= n ; i ++ ) ans = ans * i ; return ans ; } function findComb ( N , M ) { var x = fact ( N + 1 ) var y = fact ( M ) return ( x * y ) } var N = 2 var M = 2 document . write ( findComb ( N , M ) )