(n int, c int, memo []int)
| 6 | } |
| 7 | |
| 8 | func exploreStairs(n int, c int, memo []int) int { |
| 9 | if c > n { |
| 10 | return 0 |
| 11 | } |
| 12 | |
| 13 | if c == n { |
| 14 | return 1 |
| 15 | } |
| 16 | |
| 17 | if memo[c] > 0 { |
| 18 | return memo[c] |
| 19 | } |
| 20 | |
| 21 | memo[c] = exploreStairs(n, c+1, memo) + exploreStairs(n, c+2, memo) |
| 22 | return memo[c] |
| 23 | } |