思路
简单的递归
code
func fib(N int) int {
if N == 0 {
return 0
}
if N == 1 {
return 1
}
return fib(N-1) + fib(N-2)
}
更多内容请移步我的repo:https://github.com/anakin/golang-leetcode
简单的递归
func fib(N int) int {
if N == 0 {
return 0
}
if N == 1 {
return 1
}
return fib(N-1) + fib(N-2)
}
更多内容请移步我的repo:https://github.com/anakin/golang-leetcode