Ad
  • Custom User Avatar

    Because the combination x!(n-x)! is symmetric with respect to n/2. Ever x>n/2 amounts to a term that was already looped over.

  • Custom User Avatar

    The idea sounds tempting, unfortunately you would not only need to be a reasonable coder, but a rather brilliant mathematician.

    Numbers that do not end in palindromes after any number of iterations are called Lychrel numbers.
    There are no such verified numbers in base 10. The smallest candidate is 196, which has apparently been iterated around six billion times or so and has not failed yet. Of course a computer can never provide a proof in any finite time by simply iterating the algorithm.

  • Custom User Avatar

    You are right, what's obvious is usually far from it. Incidentally I had to modify my orginal code, because it began iterating with x=1. When I saw the error, I knew immediately what went wrong. All in all not really an issue.

  • Custom User Avatar

    The problem still persists. If one raises an exception, the tests will apparently not catch it. In result the test framework stops with an unhandled excpetion and fails, although raising an exception is the thing to do, according to the description.

  • Custom User Avatar

    I didn't see the discussion you had on the topic already. I'm perfectly aware of the math, but since you made such an effort to wrap a maths problem into a real life example, I would expect the solution to behave realistically as well. For me this implies checkchoose(1,n) = n, because otherwise there is need to come up with "an artistic explaination" of why it's zero.

    But since the problem and solution are mathematically perfectly valid, I will mark the issue as solved and turn it into a suggestion to alter the description to mention this fringe case.

  • Custom User Avatar

    A random test in Python: checkchoose(1,5) should obviously return 5, but the test demands it to be 0.

  • Custom User Avatar

    The typo is still present in the Python version.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Ah, thank you very much! Makes sense. The documentation would be a good place to mention this -- or maybe I just didn't see it.

  • Custom User Avatar

    The test cases in the Python version are broken. They read like:

    cc = ''
    r = maskify(cc)
    test.assert_equals(cc, r)
    

    Output is directly checked against input...

  • Custom User Avatar

    Good! For some reason I had to unpublish and fork anew. Maybe Beta Katas shouldn't be translated, because the system cannot keep track of changes in the original.

  • Custom User Avatar

    I've updated the solution to take an array of integers and matched the description to the JS Kata.

  • Custom User Avatar

    Consider changing the description to indicate that the score for a wrong answer is to be subtracted. This is not immediately clear from the description, because it says that "wrong" may take positive and negative values.