Easy (74)509. 斐波那契数On this page斐波那契数题目 求斐波那契数. 示例输入: 10输出: 5 题解 关于斐波那契数的各种花式玩法, 可参考动态规划. /** * @param {number} N * @return {number} */var fib = function (N) { if (N <= 1) return N let prev = 0 let curr = 1 for (let i = 2; i <= N; i++) { const sum = prev + curr prev = curr curr = sum } return curr