class Solution { public: int Fibonacci(int n) { int f=0,g=1; while(n--) { f=f+g; int temp = g; g=f; f = temp; } return f; } };
9这题用递归会溢出
make-big-money 2020-02-25 23:57 原文
class Solution { public: int Fibonacci(int n) { int f=0,g=1; while(n--) { f=f+g; int temp = g; g=f; f = temp; } return f; } };
9这题用递归会溢出