Ad
  • Custom User Avatar

    if p > n-p , you will waste a lot of time.
    so, I think that, you shoule give two solutions depend on whether n-p > p or not.

  • Default User Avatar

    I don't think a simple kata needs a complicated description. The example tests provide enough information to understand what the function should do.

  • Custom User Avatar
  • Default User Avatar

    @aheyman11 Arrogance == Rudeness

  • Default User Avatar

    Even shorter:

    solve equation n choose x = m

  • Custom User Avatar

    I'm not saying that finding the bug is too hard- I agree that that's the point of the exercise. I'm arguing that it's unclear what the function is even supposed to be doing. The author should explain the desired output of the function for the range of possible inputs (perhaps with a little background on Hitchhiker's Guide for fun.)

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

  • Default User Avatar

    The discussion with @sayfidz is not hidden so you should be able to see it. @sayfidz put a post asking kind of the same question as you.
    I reproduce my answer and below his answer.

    It's always difficult to transpose a mathematical problem into a day life one.
    The solution of n choose x = 1 is "zero". From an artistic point of view it means, for me,
    that there will only be a drawing in black and white with no colored paint in the same way
    that you say a "black and white movie" opposed to a "color movie" (though black and white are colors too...).

    Yeah, you're right; I was overthinking it. I went into it thinking of "color" as RGB = (x, y, z) or something,
    so I wasn't expecting 0 to be a valid response. As you described, it's more important to make the
    concept accessible, which your analogy does. I also did a small bit of searching and found that
    whether or not black and white are colors is a "grey" (ha) area. So I agree, no change is needed.

    Did you have to modify your solution to pass the tests? If you follow the equation given in the description you "fall" without problem on the good answer:-)
    Thanks for your feedback but be aware that "obviously" is not always "obvious":-)

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

  • Default User Avatar

    Maybe you read the description a bit too quickly. checkchoose(m, n) is x such as n choose x = m (See equation (1) in the description). Here checkchoose(1, 5) is x such as 5 choose x = 1. The only "obvious" x is then mathematically 0. Don't you agree? See the discussion below with @sayfidz 3 weeks ago for an "artistic" interpretation of this mathematical result.
    If you consider my answer as acceptable, please mark the issue as resolved.

  • Custom User Avatar

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

  • Default User Avatar

    I don't see your post as an issue, the kata works! It's at most a "suggestion".
    What description do you propose?

  • Custom User Avatar

    Hm isn't that kinda the point of this Kata?

    It's just an exercise of going throught the given code and test cases and then figure out what's wrong (aka bug hunting). Not sure if you can change the description without giving away too much of the solution... Maybe he/she could invent a little story or something to go with it?

  • Custom User Avatar

    The description is unnecessarily wordy- get to the point!

  • Custom User Avatar

    The problem description needs heavy clarification. It took me a while to figure out what it was actually asking.