Skip to content

Instantly share code, notes, and snippets.

@haydarai
Created April 11, 2016 04:34
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 haydarai/030493cb9c7d8a502daf49bd0b291d87 to your computer and use it in GitHub Desktop.
Save haydarai/030493cb9c7d8a502daf49bd0b291d87 to your computer and use it in GitHub Desktop.
fibonaccip
ArrayList<int> fibonaccip = new ArrayLiatt<int>();
fibonaccip.add(1);
int ip1
for (int i = 0; i < n; i++) {
int ip1;
if ((i - p - 1) > 0) {
ip1 = 0;
} else {
ip1 = i - p - 1;
}
int number = fibonaccip.get(i - 1) + fibonaccip.get(ip1);
fibonaccip.add(number);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment