You can solve this three ways: Recursion with memoization (top-down DP) Iterative with an array (bottom-up DP) Iterative with two variables (space-optimized) The recurrence: dp[i] = dp[i-] + dp[i-] Base cases: dp[] = , dp[] = . Build up from the base cases to dp[n].
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/maang-interview-prep/dynamic-programming/climbing-stairs-solution
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████████████████████████████████████████████████████████████████████████████████████