/*
@Copyright:LintCode
@Author: Monster__li
@Problem: http://www.lintcode.com/problem/climbing-stairs
@Language: Java
@Datetime: 17-03-05 05:12
*/
public class Solution {
/**
* @param n: An integer
* @return: An integer
*/
public int climbStairs(int n) {
//int sumways=0;
//int step_index,i;
//int steps[]={1,2};
int step[]=new int[1024];
step[0]=1;step[1]=1;
//step[2]=2;
for(int step_index=2;step_index<=n;step_index++)
{
step[step_index]=step[step_index-1]+step[step_index-2];
}
/*
class climbtest{
int climb(int steps)
{
if(steps<n)
return climb(++steps);
else return sumways;
}
}
*/
/*
if(n>1)
return climbStairs(n);
else return sumways;
*/
return step[n];
}
}