Fix goreport bug

This commit is contained in:
halfrost
2022-09-10 10:38:39 -07:00
parent dff1d84e1e
commit a655d95eea
8 changed files with 30 additions and 29 deletions

View File

@ -111,19 +111,19 @@ func fib5(N int) int {
// 解法七 协程版,但是时间特别慢,不推荐,放在这里只是告诉大家,写 LeetCode 算法题的时候,启动 goroutine 特别慢
func fib6(N int) int {
return <-fibb(N)
return <-fibb(N)
}
func fibb(n int) <- chan int {
result := make(chan int)
go func() {
defer close(result)
if n <= 1 {
result <- n
return
}
result <- <-fibb(n-1) + <-fibb(n-2)
}()
return result
}
func fibb(n int) <-chan int {
result := make(chan int)
go func() {
defer close(result)
if n <= 1 {
result <- n
return
}
result <- <-fibb(n-1) + <-fibb(n-2)
}()
return result
}