I have this two functions
func fib_memo(n int) {
memo := make([]int, n 1)
return fib_2(n, memo)
}
func fib_2(n int, memo []int) int {
result := 0
if &memo[n] != nil {
return memo[n]
}
if n == 1 || n == 2 {
result = 1
} else {
result = fib_2(n-1, memo) fib_2(n-2, memo)
memo[n] = result
}
return result
}
But the first in giving me a compiler error i don't no why please help : no result values expectedcompilerWrongResultCount
CodePudding user response:
func fib_memo(n int) (result int) {
memo := make([]int, n 1)
return fib_2(n, memo)
}