nleq 39n≤39
4
3
太水了,直接递推就可以
class Solution { public: int Fibonacci(int n) { int now = 0; if(n==1) return 1; if(n==2) return 1; int pre_1 = 1, pre_2 = 1; for(int i=3;i<=n;i++) { now = pre_1 + pre_2; pre_2 = pre_1; pre_1 = now; } return now; } };