Nice work. About the only weakness here versus the recursive map version is that this one does not store previous results, so will always take O(n) to return an answer.

```
ArrayList<Integer> map = new ArrayList<Integer>();
public int climbStairs(int n){
if(n == 0 || n == 1 || n == 2){return n;}
if(map.size() >= n) return (map.get(n-1)).intValue();
if(map.size() < 2){
map.add(0,new Integer(1));
map.add(1,new Integer(2));
}
for(int i = map.size(); i < n; i++){
map.add(i,map.get(i-1)+map.get(i-2));
}
return (map.get(n-1)).intValue();
}
```

**EDIT**: As a nod to ehab, here's the complicated math way:

```
static double root5 = Math.sqrt(5);
static double phi = (1+root5)/2;
public int climbStairs(int n) {
return (int)Math.floor( (Math.pow(phi,n+1)/root5) + 0.5 );
}
```

And yes, that's been accepted.