标签:io for leetcode a 3 public return class
public class Solution {
public int climbStairs(int n) {
if(n==1) return 1;
if(n==2) return 2;
int pre=1;
int cur=2;
for(int i=3;i<=n;i++)
{
int tem=pre;
pre=cur;
cur=pre+tem;
}
return cur;
// else return climbStairs(n-1)+climbStairs(n-2);
}
}
标签:io for leetcode a 3 public return class
原文地址:http://www.cnblogs.com/hansongjiang/p/3871973.html