//建議不要用遞歸,有可能時間更長,或者內存過大code
public class Solution {遞歸
public int Fibonacci(int n) { if(n==0||n==1) return n; int i=2,temp1=0,temp2=1,fn=0; while(i<=n){ fn = temp1+temp2; temp1=temp2; temp2=fn; i++; } return fn; }
}內存