text: Permutation Coefficient | A O ( n ) time and O ( 1 ) extra space solution to calculate the Permutation Coefficient ; Compute n * ( n - 1 ) * ( n - 2 ) . ... ( n - k + 1 ) ; Driver code
code: function PermutationCoeff ( n , k ) { let P = 1 ; for ( let i = 0 ; i < k ; i ++ ) P *= ( n - i ) ; return P ; } let n = 10 , k = 2 ; document . write ( " " + n + " " + k + " " + PermutationCoeff ( n , k ) ) ;