6 kyu

Imperfect Fibonacci Rabbits

Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • saudiGuy Avatar

    Python new test framework should be used (Refer this for more detail)

  • balmar Avatar

    The description is confusing. It is not clear what is the expected result and I suspect most of people will spend most of time trying to figure out not how to implement it, but what should they do. I did it by trial and error.

    There should be annotation like: Return the number of ADULT PAIRS of rabbits at the BEGINNING of the mth month.

  • user9644768 Avatar

    Ruby 3.0 should be enabled.

  • appsincaps Avatar

    Random tests in JS use values in exccess of the safe integer. I'm not sure it's a good idea.

  • Darnor Avatar

    Hey, I'm kinda stuck...

    Could you give an full example for imperfectFibonacciRabbits(8, 3, 4) (especially month 4 and 5) ?

    When do the rabbits die? Before or after they multiply?

  • idubrov Avatar
    1. Test does not compile with starter code (imperfectFibonacciRabbits function must be static).
    2. assertEquals accepts expected as first argument (arguments to assertEquals should be swapped).
  • GiacomoSorbi Avatar

    Translation into both JS and Ruby submitted; I am not sure if you created this kata yourself starting from the base one or if it is some sort of classic problem that I didn't knew, but in the latter case, thanks for letting me know about it; in the former, kudos for your creativity :)

    Oh, as usual: I would gladly add the random test cases (and one extra edge case just to round them all up to 50) in Python, just let me know if it is ok with you :)

  • Absurdated Avatar

    This comment has been hidden.

    • ChristianECooper Avatar

      Looks like there was an issue with my solution, please try again, and let me know if your answer still diverges from the given solution.

  • jolaf Avatar

    This comment has been hidden.

    • ChristianECooper Avatar

      Your answer is right!

      The final answer you are expected to send back is the number of rabbits at the start of month 6 not the end of month 6! :)

      This confused me on the first rabbit kata too, I've mad a minor change to the description that hopefully clarifies the issue.

      Issue marked resolved by ChristianECooper 10 years ago
    • jolaf Avatar

      Hmm, ok, I would recommend to replace "n is the number of the month to end the simulation on" with something like "n is the number of month, at the begininning of which the simulation should stop.

    • jolaf Avatar

      This comment has been hidden.

    • ChristianECooper Avatar

      Trying to follow the confusing numbering for the first one has caused this kata to have problems.

      So I have rewritten the kata to follow a more clear numbering convention, i.e. we run to the end of the supplied month. I have also rewritten my solution without all the tweaks to follow the old numbering, aaaaaaand your answer is right. :)

      I'm going to guess there was a bug in my previous solution.

      Try running your solution again and see what happens. :)

    • jolaf Avatar

      Cool, thanks!