I spent A LOT of time on your kata, even after I solved it... ;-)
I made a version which can handle coefficients without variables, coefficients greater than 10 and variables with exponents (syntaxes allowed : ** or ^ ; but exponents have to be positives and written without brackets).
It might be interresting to confront it with others answers. Would like to create a harder version of the kata ?
Good kata, just a few spelling and grammatical issues. The title should be "Simplifying multilinear polynomials".
There are also a few grammatical issues in the description that I can point out, if you'd like.
PHP 8.0 should be enabled
One of the python test cases starts with a +, which seems to go against the rules that any leading + on a polynomial will be hidden.
PHP random tests seem to be off as well.
For: -12dy+9yzd-9dyz-13y+8y-1-11yd+15yd+9y
it expects: 4y-8dy-10dyz
The "1" term should not be there according to the description and the test result makes no sense as a result.
I spent A LOT of time on your kata, even after I solved it... ;-)
I made a version which can handle coefficients without variables, coefficients greater than 10 and variables with exponents (syntaxes allowed : ** or ^ ; but exponents have to be positives and written without brackets).
It might be interresting to confront it with others answers. Would like to create a harder version of the kata ?
It could be interesting to link those two (like SteffenVogel_79 did with his encryption problems : https://www.codewars.com/kata/57814d79a56c88e3e0000786 )
Thanks for this problem !
Well, me again...
While checking my code to improve it, I discovered it is actually wrong ! But it passes the tests all the same !
I suggest you implement some tests with coefficients bigger than 10 (in the previous version of my code, I inverted the strings so 31 becomes 13...)
This comment is hidden because it contains spoiler information about the solution
Good kata, just a few spelling and grammatical issues. The title should be "Simplifying multilinear polynomials".
There are also a few grammatical issues in the description that I can point out, if you'd like.
Yep, as your description says that was more difficult than expected.
Have you considered the following scenarios in your tests?
simplify('7-3x+4')
-> 3-3xsimplify('3c4a2b')
-> 24abc