LeetCode 70. Climbing Stairs
2022.07.18

問題

typescript

typescript

function 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]
};