Learning Note of Go – Leetcode
Use of Channel package main import “golang.org/x/tour/tree” import “fmt” // Walk walks the tree t sending all values // from the tree to the channel ch. func Walk(t *tree.Tree, ch chan int){ _Walk(t, ch) close(ch) } func _Walk(t *tree.Tree, ch chan int){ if t.Left != nil{ _Walk(t.Left, ch) } ch […]