```
def f(self, n):
if self._result.has_key(n):
return self._result[n]
self._result[n-2] = self.f(n-2)
self._result[n-1] = self.f(n-1)
return self._result[n-2] + self._result[n-1]
def climbStairs(self, n):
self._result = dict()
self._result[2] = 2
self._result[1] = 1
self._result[0] = 0
return self.f(n)
```