Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Javascript translation
In my opinion, the derivative of const should be [0], not []! But maybe it's a matter of presenting the results.
The link to "poly add" at the end of description is wrong and should point to this correct address (both links point to poly multiply kata)
Great fun serie of katas.
However, as for kata #1 of this serie, it should be clearly stated what should be the return value of :
[]
or[0]
And :
[2]
or[2, 0]
In both cases, the first answer seems to make more sense to me, as :
It's not specified how trailing zeros in the result should be handled. Is trimming zeros considered incorrect?
To be mathematically rigourous, you should update how you handle the zero polynomial or the polynomial with 0 as the constant term. This polynomial should be represented by [0] not [] because the polynomial needs to have a constant term in order to exist.
I think there is an issue with one of the random tests when len(p1) > len(2) > 0. In this case the test is always expecting a wrong result.
For example, these are the p1, p2 and the wrong expected result:
Test.assert_equals( poly_subtract([84, 37, 41, 12, 83, 11, 14, 67, 10, 37, 77, 45],[52, 61]), [-20, -85, 41, 12, 83, 11, 14, 67, 10, 37, 77, 45])
while the correct expected result should be:
[32, -24, 41, 12, 83, 11, 14, 67, 10, 37, 77, 45]
I think it might be more educational to combine these 4 separate katas into one class, something like this:
http://www.codewars.com/kata/54cf4fc26b85dc27bf000a6b
Also, you can add polynomial integration kata (indefinite and definite).