class Solution {
public int fib(int n) {
if(n < 2){
return n;
}
int f = 0, s = 1;
for(int i = 2; i <= n; i++){
int t = f + s;
f = s;
s = t;
}
return s;
}
}
原文:https://www.cnblogs.com/circle-coder/p/15086132.html