牛客题霸NC65题解
斐波那契数列
https://www.nowcoder.com/practice/c6c7742f5ba7442aada113136ddea0c3?tpId=117&&tqId=34987&rp=1&ru=/ta/job-code-high&qru=/ta/job-code-high/question-ranking
题目
题解
斐波那契数列:
Code
class Solution {
public:
int Fibonacci(int n) {
int f[40]={0,1};
for(int i=2;i<=n;i++) f[i]=f[i-1]+f[i-2];
return f[n];
}
};
