Skip to content

Instantly share code, notes, and snippets.

@fmamud
Last active August 29, 2015 14:24
Show Gist options
  • Save fmamud/eac41fb389c490dcd50f to your computer and use it in GitHub Desktop.
Save fmamud/eac41fb389c490dcd50f to your computer and use it in GitHub Desktop.
package forkjoin;
public class FibonacciProblem {
int n;
public FibonacciProblem(int n) {
this.n = n;
}
public long solve() {
return fibonacci(n);
}
private long fibonacci(int n) {
if (n <= 1)
return n;
else
return fibonacci(n - 1) + fibonacci(n - 2);
}
public int getN() {
return n;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment