[小米OJ] 10. 爬楼梯
dp
另: 小米oj上的测试样例是错的 ; )
function solution(line) { if (line == 0) return 0; if (line == 1) return 1; var dp = new Array(line + 1); dp[1] = 1; dp[2] = 2; for (let i = 3; i <= line; i++) { dp[i] = dp[i - 1] + dp[i - 2]; } return dp[line]; }