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
< ? php function factorial ( $ f ) { $ fact = 1 ; for ( $ i = 2 ; $ i <= $ f ; $ i ++ ) $ fact *= $ i ; return $ fact ; } function findPermutation ( $ N , $ M ) { $ permutation = factorial ( $ N + $ M - 1 ) / ( factorial ( $ N ) * factorial ( $ M - 1 ) ) ; return $ permutation ; } $ N = 3 ; $ M = 3 ; echo findPermutation ( $ N , $ M ) ; ? >