![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
CarlosKeFeng
这个作者很懒,什么都没留下…
展开
-
二叉树的层序遍历
原二叉树: 3 / \ 9 20 / \ 15 7要求遍历结果:[ [3], [9,20], [15,7]]代码及注释package mainimport "fmt"func main() { root := buildTree() fmt.Println(levelOrder(root))}type TreeNode struct { Val int Left *TreeNode Right *TreeNode}原创 2021-04-17 11:36:12 · 78 阅读 · 0 评论 -
求一个数的所有因数
求一个数的所有因数func GetFactor(num uint64) []uint64 { res := make([]uint64, 0) for i := 1; i <= int(num); i++ { if int(num)%i == 0 { res = append(res, uint64(i)) } } return res}测试原创 2021-02-20 20:35:47 · 837 阅读 · 0 评论