Skip to content

Commit

Permalink
Merge pull request #313 from Rabbittee/feature/day39_hello_solution
Browse files Browse the repository at this point in the history
add hello solution
  • Loading branch information
beareatapple authored Aug 26, 2021
2 parents a7b055b + 423e707 commit d270797
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 2021-08/2021-08-26 (day39)/Hello/solution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @param {number} n
* @return {number}
*/
function climbStairs(n, dp = [undefined, 1, 2]) {
dp[n] ||= climbStairs(n - 1, dp) + climbStairs(n - 2, dp);

return dp[n];
}

0 comments on commit d270797

Please sign in to comment.