6 kyu

Imperfect Fibonacci Rabbits

Description:

Background

This is an extension of this kata so I suggest you complete that one first.

Imperfect Rabbits

In this kata, our rabbits are sadly imperfect, they only live for a few months, and then they die! As in the previous kata however, our rabbits:

  1. Take one month to mature.
  2. Always birth equal numbers of male and female offspring.
  3. Never have to compete for resources.
  4. Have no predators.

At the start of the first month you start with one pair of immature rabbits.

Kata

In this kata you must implement the method provided to you with arguments n, b, l, where:

  • n is the number of the months to simulate,
  • b is the number of pairs each adult pair gives birth to, and,
  • l is the lifespan in months of a rabbit.

Examples

n = 6, b = 3, l = 6
return 96

n = 8, b = 3, l = 4
return 423
Algorithms

Stats:

CreatedMay 19, 2015
PublishedMay 19, 2015
Warriors Trained280
Total Skips79
Total Code Submissions379
Total Times Completed75
Python Completions48
Ruby Completions15
JavaScript Completions19
Java Completions13
Total Stars11
% of votes with a positive feedback rating96% of 26
Total "Very Satisfied" Votes24
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes0
Total Rank Assessments20
Average Assessed Rank
6 kyu
Highest Assessed Rank
3 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • ChristianECooper Avatar
  • GiacomoSorbi Avatar
  • dfhwze Avatar
  • Just4FunCoder Avatar
Ad