Created
October 3, 2017 04:19
-
-
Save prashantgpt91/d29c24a4b832b3369d42a765893c59c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
/** | |
* @param n: An integer | |
* @return: An integer | |
*/ | |
int climbStairs(int n) { | |
// write your code here | |
if(n==1) | |
return 1; | |
else if(n==2) | |
return 2; | |
else | |
return climbStairs(n-1) + climbStairs(n-2); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment