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