It seems that recursion is used, can you explain the idea?
var A = function(N,M,num){ if( N < M || N <= 0) return 0; num = num || 1; if( M == 0 ) return num; return A(N-1,M-1,N * num); }; //A排列 var C = function(N,M){ return A(N,M) / A(M,M); }; //C组合 ,应该就这样了
Refer to this article http://www.cnblogs.com/kaiye/...
github source code https://github.com/treeandgra...
Refer to this article http://www.cnblogs.com/kaiye/...
github source code https://github.com/treeandgra...