text: Counts paths from a point to reach Origin | utility min ; Function for binomial Coefficient ; Constructing Pascal 's Triangle ; Driver Code
code: function min ( a , b ) { return a < b ? a : b ; } function binomialCoeff ( n , k ) { var C = Array ( k + 1 ) . fill ( 0 ) ; C [ 0 ] = 1 ; for ( i = 1 ; i <= n ; i ++ ) { for ( j = min ( i , k ) ; j > 0 ; j -- ) C [ j ] = C [ j ] + C [ j - 1 ] ; } return C [ k ] ; } var n = 3 , m = 2 ; document . write ( " " + binomialCoeff ( n + m , n ) ) ;