Skip to content
DeepForgeby svx
All problems
MediumCalculusca-357

Product Polynomial Derivative Coefficients

Problem

The derivative of a product of two polynomials is f' g + f g', and polynomial multiplication is coefficient convolution.

Given the coefficient lists of f and g in ascending order, return the coefficients of (f g)' in ascending order.

Hint

Convolve the coefficients first, then differentiate the product.

Test cases

case 1
in: [[1,1],[1,-1]]
expected: [0,-2]
case 2
in: [[2],[1,2,3]]
expected: [4,12]
case 3
in: [[0,0,1],[1,0,0,4]]
expected: [0,2,0,0,20]
Starter codePython
def product_polynomial_derivative_coeffs(f, g):
    # Your code here
    pass

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