斐波那契数列——队列法
斐波那契数列
http://www.nowcoder.com/questionTerminal/c6c7742f5ba7442aada113136ddea0c3
class Solution { public: int Fibonacci(int n) { if(n<=1) return n; queue<int> queue; queue.push(0); queue.push(1); int temp1; for(int i=1;i<n;++i) { temp1=queue.front(); queue.pop(); temp1+=queue.front(); queue.push(temp1); } return temp1; } };