Ad
  • Custom User Avatar

    No, it's honestly fine I think. All the test cases are associative towards the right anyway, i.e. a*b*c is treated as a*(b*c). Same for plus.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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:

    1. The pass2 constraints are very lenient. As mentioned also by someone else in the comments, pass2 should also remove unnecessary +0s, *1s, etc. (i.e. pass2({'op': '+', 'a': {'op': 'arg', 'n': 0}, 'b': 0} should return {'op': 'arg', 'n': 0})

    2. 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

  • Custom User Avatar

    oof, I think that should have been mentioned

  • Custom User Avatar

    you know, when I figured out the solution, I went, "ohhh, so that's why it has to be prime!"

    nice kata.

  • Custom User Avatar

    approved by someone

  • Custom User Avatar

    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.

  • Custom User Avatar

    yes, see the fork

  • Custom User Avatar

    ah, that's annoying; must be an off-by-one error i guess.

  • Custom User Avatar

    Fails for e.g. 435602: should return [659, 36, 4, 3]

    Otherwise very efficient

  • Custom User Avatar

    You'll see all solutions when you upload your own.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Hi man. I did it already ) Let me know if you need a help with theory. Cheers.

  • Custom User Avatar

    two years late, but you and I had the exact same issue. there is a way to solve it though; think of how you would solve this on a square grid, and notice what the algorithm behind it actually does to each individual piece.

  • Loading more items...