LeetCode 70. Climbing Stairs
2022.07.18
問題
typescript
typescriptfunction climbStairs(n: number): number { let dp = [] dp.push(1) dp.push(2) for (let i = 3; i <= n; i++) { dp.push(dp[i-2] + dp[i-3]) } return dp[n-1] };
typescriptfunction climbStairs(n: number): number { let dp = [] dp.push(1) dp.push(2) for (let i = 3; i <= n; i++) { dp.push(dp[i-2] + dp[i-3]) } return dp[n-1] };