标签:integer write public cli tair return while int turn
class Solution {
public:
/**
* @param n: An integer
* @return: An integer
*/
int climbStairs(int n) {
// write your code here
int a = 1, b = 1, k = 0;
if(n == 1 || n ==0){
return 1;
}
while(--n > 0){
k = a+b;
b = a;
a = k ;
}
return k;
}
};
标签:integer write public cli tair return while int turn
原文地址:http://www.cnblogs.com/aly15109725486/p/6523207.html