题解 | #斐波那契数列#
斐波那契数列
https://www.nowcoder.com/practice/c6c7742f5ba7442aada113136ddea0c3
class Solution { public: int Fibonacci(int n) { int ans[40]; ans[1] = ans[2] = 1; for (int i = 3; i <= n; i++) { ans[i] = ans[i - 1] + ans[i - 2]; } return ans[n]; } };