fibonacci static method

int fibonacci(
  1. int n
)

求斐波那契数列

Implementation

static int fibonacci(int n) {
  if (n <= 1) return n;
  return fibonacci(n - 1) + fibonacci(n - 2);
}