MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / exploreStairs

Function exploreStairs

climbing_stairs_70/solution.go:8–23  ·  view source on GitHub ↗
(n int, c int, memo []int)

Source from the content-addressed store, hash-verified

6}
7
8func 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}

Callers 1

climbStairsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected