Skip to content

Instantly share code, notes, and snippets.

@teru01
Created December 14, 2017 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teru01/62f889ae46afb9b54a0703ecc9c923be to your computer and use it in GitHub Desktop.
Save teru01/62f889ae46afb9b54a0703ecc9c923be to your computer and use it in GitHub Desktop.
int fibonacci(int n, int *p){
if(n == 0) {
p[0] = 0;
return p[0];
}else if(n == 1){
p[1] = 1;
return p[1];
}else{
p[n] = fibonacci(n-1, p) + fibonacci(n-2, p);
return p[n];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment