package leetcode; public class demo_70 { public int climbStairs(int n) { int[] f= new int[n+1]; f[1]=1; try { f[2]=2; } catch (Exception e) { // TODO: handle exception } for(int i=3;i<=n;i++) { f[i]=f[i-1]+f[i-2]; } return f[n]; } public static void main(String[] args) { // TODO Auto-generated method stub demo_70 d70=new demo_70(); System.out.println(d70.climbStairs(4)); } }