Skip to content

Instantly share code, notes, and snippets.

@jon-acker
Last active September 15, 2019 15:17
Show Gist options
  • Save jon-acker/cb25506d2362edbfc7ad9d9af3551990 to your computer and use it in GitHub Desktop.
Save jon-acker/cb25506d2362edbfc7ad9d9af3551990 to your computer and use it in GitHub Desktop.
Fibbonanci Kata

Fibonanci Sequence Kata

The function takes number of steps and returns the sequence

Returns [0] for 0 Returns [0,1] for 1 Returns [0,1,1] for 2 Returns [0,1,1,2] for 3 Returns [0,1,1,2,3] for 4 Try to develop the algorithm iteratively by writing just enough code to pass each step.

Once you have enough passing tests refactor the code to use recursion.

In cases where intuition is required to use recursion or a well known algorithm, TDD does not necessarily lead to best or most efficient design though it does ensure complete coverage of all the cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment