Ad
  • Custom User Avatar

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

  • Custom User Avatar

    omg I'm not sure I could have figured that out....
    let me try for a larger number, like 12.

  • Custom User Avatar

    Approved

  • Custom User Avatar

    Friends
    Andrzej was given a task:

    There are n jars containing an infinite number of pills, each jar containing a different type of pill. Of all the pill types, one makes the person glow about 30 minutes after taking that pill. None of the other pill types have any effect.

    His job: determain which jar contains the pills that make the person glow.
    But there is one catch: he only has 35 minutes to figure out which jar it is.(So he cannot take a pill, wait for the results and then take another one, because he will not be able to see the results). Fortunetely, he can take any number of friends he needs with him.
    On completing the task, Andrzej will receive $1,000,000. Being the honest man he is, he will split the winnings with his friends.

    Your job is to write an algorithm that will help Andrzej complete his job.

    Example:
    For n = 2, he will not need any friends, answer is 0, since he can just take a pill from the first jar, and wait for the effects.

    For n = 4, he will only need one friend, answer is 1, since with the four jars, being A B C D, he can take pills from jars A B, and his friend from jars B C
    (If neither of them glow, D is the right pill. If Andrzej glows, it is A, or if his friend glows, it is C. If they both glow, it is B)

    Note: Andrzej is not able to accurately measure time during the task.


    This might be better. I am not so sure about the need of his prize and his honesty, but for the story's sake, it seems fine. As for thinking about the whole thing, I came to a confused thought about why I am solving this for Andrzej, unless I am Andrzej. Could change it around so that the person doing the kata is the one partaking in the competition, or have it that we are working along with Andrzej (the latter could change how the problem is approached, since if we are working with him, n=4 should be 0 since there will be two people already, so no need to bring in a friend.)
    But then, I am probably just rambling on now...

    Was a great Kata none-the-less. I enjoyed it. Had no issue with the current translation (for python)

  • Custom User Avatar

    It only requires basic math knowledge, so seemed pretty concise to me.
    If you have a more intuitive one, you can add it here.

  • Default User Avatar

    but no

  • Default User Avatar

    n - 16 test - 3 How? Java