public class Solution { public int Fibonacci(int n) { //斐波那契数列指的是这样一个数列 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 if(n<=1){ return n; } return Fibonacci(n-1) + Fibonacci(n-2); } }
public class Solution { public int Fibonacci(int n) { //斐波那契数列指的是这样一个数列 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233 if(n<=1){ return n; } return Fibonacci(n-1) + Fibonacci(n-2); } }