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.
Really interesting mathematical coding challenge to understand...
done
No, it's honestly fine I think. All the test cases are associative towards the right anyway, i.e.
a*b*cis treated asa*(b*c). Same for plus.It would be great if the random tests could be given an individual heading, or even consecutive numbering. Now every random test has the same name: Input text, Correct answer, and Answer returned.
For point 2, the problem description should be clear which associativity to use, even if both left and right are mathematically correct. If this is not the case, please raise an issue.
after taking a break from codewars for a few months, it feels great to solve a difficult question in only a few hours. So, it's either I've gotten way better or this kata was a little bit easy for 1kyu. It's probably the latter, realistically speaking though- lol.
Anyway, this was a great kata- I've never written a compiler before, and this kata really helped me understand how they work. Some suggestions:
The
pass2constraints are very lenient. As mentioned also by someone else in the comments,pass2should also remove unnecessary+0s,*1s, etc. (i.e.pass2({'op': '+', 'a': {'op': 'arg', 'n': 0}, 'b': 0}should return{'op': 'arg', 'n': 0})Some "different" solutions are the same, algebraically, because operations like adding and multiplying are associative. The test suite should let these solutions pass too. I know, an infinite number of solutions now are possible, but it would be nice to have some leeway.
-goldenratio161
oof, I think that should have been mentioned
you know, when I figured out the solution, I went, "ohhh, so that's why it has to be prime!"
nice kata.
approved by someone
Python:
passing all fixed test cases but no random test cases. Although it is probably because of my terribly-written, bug-riddled code, the random tests are impossible to debug. The strings are way too long, and it would be really helpful if there were some shorter random strings.
yes, see the fork
ah, that's annoying; must be an off-by-one error i guess.
Fails for e.g. 435602: should return [659, 36, 4, 3]
Otherwise very efficient
You'll see all solutions when you upload your own.
haha lol, its just that when seeing "There is no solution to show" pop up, I thought you had already given up on this kata.
Loading more items...