Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public int climbStairs( int n) {
- int[] memo = new int[n+1];
- memo[0] = 1;
- memo[1] = 1;
- for(int i = 2; i<=n; i++){
- memo[i] = memo[i-2] + memo[i-1];
- }
- return memo[n];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement