Skip to content
DeepForgeby svx
All problems
EasyCalculusca-356

Polynomial Nth Derivative Coefficients

Problem

Differentiating a polynomial repeatedly multiplies coefficient i by the falling factorial i (i-1) ... (i-order+1) and shifts indices down by the order.

Given coefficients in ascending order and the derivative order, return the resulting coefficients; return [] when the order exceeds the degree.

Hint

Repeat the power rule once per order, dropping the constant each round.

Test cases

case 1
in: [[1,2,3],1]
expected: [2,6]
case 2
in: [[1,2,3],2]
expected: [6]
case 3
in: [[5],1]
expected: []
case 4
in: [[0,0,0,2],3]
expected: [12]
Starter codePython
def polynomial_nth_derivative_coeffs(coeffs, order):
    # Your code here
    pass

4 test cases · run your code against them in the editor