diff --git a/bangdori/Climbing Stairs.js b/bangdori/Climbing Stairs.js new file mode 100644 index 0000000..b12f965 --- /dev/null +++ b/bangdori/Climbing Stairs.js @@ -0,0 +1,15 @@ +/** + * @param {number} n + * @return {number} + */ +var climbStairs = function (n) { + const dp = Array.from(n, () => 0); + dp[0] = 1; + dp[1] = 1; + + for (let i = 2; i <= n; i++) { + dp[i] = dp[i - 1] + dp[i - 2]; + } + + return dp[n]; +};