0

Challenge :: Differentiate Polynomials

This challenge is about to differentiate a polynomial. (hope you know how to do it, otherwise you can consult here: http://www.wikihow.com/Differentiate-Polynomials ) input : polynomial string in the form "a*x**n + b*x**(n-1) + ... + c" -all coefficients are integer -coefficients can be positive or negative -the first coefficient can be without leading "+", e.g. ( "2*x .. instead of "+2*x..) -all exponents (powers) are positive integer -polynomial expression is valid (for evaluation) -all "1" are skipped, e.g. 1*x is x, x**1 is x output : the derivative example: function ("x**2+2*x+1") returns "2*x+2" (PS. practice regex or use your own way).

11th Aug 2017, 10:38 AM
yuri
1 Odpowiedź
0
is it too hard? Test cases: "4*x**2+2*x+1" "x+1+x**2" "-1000*x**1024+x-17" "-x+1" "1" "0"
11th Aug 2017, 10:43 AM
yuri