Ad
  • Custom User Avatar

    solution must work correct, it mustn't be short
    P.s Sorry, eng not my lang

  • Custom User Avatar

    Great kata of the series to start with.

  • Custom User Avatar

    Finding the right code and make it work out on your own is a lot more rewarding from my perspective and I think not only mine, in this kata and many other ones you get to practice some dynamic programming concepts basically, optimization, algorithm efficiency, which is something that's already there and every coder should at least try to get familiar with, you've only got to do better and more research sometimes to get a deeper general idea.

  • Custom User Avatar
  • Custom User Avatar

    Approved

  • Custom User Avatar
  • Custom User Avatar

    Approved.

  • Custom User Avatar
  • Custom User Avatar

    Thanks. Usually I'd probably have done that. But since I wanted to fix the other issues I mentioned above, I had to rewrite the code, and creating a new translation seemed in order.

    It would be nice if the approval system allowed us to fix simple stuff (like an outdated version) without forking the whole thing. I've often wanted to approve a translation that's been waiting for years, only to be told that there's a minor problem. If I fork the translation and fix the problem, I can't approve it myself, and we'll probably have to wait another half decade until someone else approves "my" translation... :-(

  • Custom User Avatar

    To be exact, you did not have to reject the translation. You could fork the translation, switch it to new version, and publish the fork with the updated version, without rejecting the orignal translation. This way, the author of the original, top level fork keeps their eligibility for reward for creating the translation after the bottom version gets approved. The same works for outdated decriptions.

  • Custom User Avatar

    I'm sorry, I had to reject your translation. It used an outdated Rust version and could not be approved anymore.

    (It's silly and annoying that the Codewars approval system doesn't let us easily fix such minor problems in translations, e.g. outdated descriptions etc.)

  • Custom User Avatar

    New Rust translation. The previous one had an outdated Rust version and could not be approved anymore.

  • Custom User Avatar

    I'd like to approve the translation, but the test duration varies a lot, which means that a solution will pass or fail the tests more or less randomly.

    The tests don't test all inputs from 2 to 43, but only ten randomly selected input values. When I run the tests on my machine, they take between a few seconds and 15 minutes (!!).

    To fix this, I think the solution needs to be much faster. Shouldn't be hard – just use mutable data structures instead of copying, and use a bit set instead of a hash set. Then the tests can test all inputs (in random order), which means that the duration will remain mostly the same for all runs.

    I'll try to modify the solution and the tests. If I can make it work, I'll approve your translation and then edit it.

  • Custom User Avatar

    Yeah, probably should be 4 kyu.

  • Custom User Avatar

    I think there are several issues with this translation:

    • The solution function should be called SquareSumsRow(), as the description says.

      Maybe that name isn't perfect, but it's not terrible either. There's no good reason to change it. And the name GetPermutation() doesn't make sense. That's not what the function does.

    • The full solution should compute the result, not just look it up in a precomputed table.

      I think a kata solution should show users an example of a good solution. A table of results that has been computed by some other code we don't get to see feels almost like cheating.

    • The verifier code should be in the tests, not in preloaded code.

      That's a matter of taste. There are many katas that put such code into the preloaded code, but that often means that users trying to solve a kata are kept in the dark about what's being tested. Sure, keeping that code in the tests leads to code duplication between example tests and full tests, but it helps users understand what's going on, and it lets them adapt the tests to their needs.

  • Loading more items...