package com.littleji.leetcode;
import com.littleji.leetcode.utils.BinaryNode;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * Created by Jimmy on 2016/10/25.
 */
public class No70_ClimbingStairs {
    int result;
    public HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
    public int climbStairs(int n) {
        doit(n);
        return result;
    }
    public void doit (int last){
        if (last == 0){
            this.result++;
            return ;
        }
        else if (last <0)
            return;
        else{
            if (map.get(last) == null){
                doit(last-1);
                doit(last-2);
                map.put(last,result);
            }
            else
                result += map.get(last);
            return;
        }
    }
}

@@ -798,10 +798,252 @@
 %7D%0A    %7D%0A
+    int anotherclimbStairs(int n)%0A    %7B%0A        if (n %3C 4) return n;%0A        int a = 2, b = 3, c = 5;%0A        for (int i = 5; i %3C= n; i++)%0A        %7B%0A            a = c;%0A            c = b+c;%0A            b = a;%0A        %7D%0A        return c;%0A    %7D%0A
 %7D%0A

add a new way to solve problem No70