Open pwstrick opened 4 years ago
剑指 Offer 10- II. 青蛙跳台阶问题
/** * @param {number} n * @return {number} */ var sum = []; var numWays = function(n) { if(n == 1 || n == 0) return 1; if(n == 2) return 2; if(sum[n]) return sum[n]; sum[n] = (numWays(n-2) + numWays(n-1)) % 1000000007; return sum[n]; };
剑指 Offer 10- II. 青蛙跳台阶问题