自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(4)
  • 收藏
  • 关注

原创 7月8号

剑指 Offer 31. 栈的压入、弹出序列用stack来判断是否需要更新indexfunc validateStackSequences(pushed []int, popped []int) bool { stack := make([]int, 0) index := 0 for _, val := range pushed { stack = append(stack, val) for (len(stack) > 0 &am.

2020-07-08 09:39:20 111

原创 二叉树的后序遍历

145. 二叉树的后序遍历每次访问一个节点之前,先判断该节点的右子树是否被访问,如果没有被访问则先处理右子树。func postorderTraversal(root *TreeNode) []int { res := make([]int, 0) if root == nil { return res } stack := make([]*TreeNode, 0) var lastVisited *TreeNode for root

2020-07-06 09:12:57 135

转载 Go Channels

Go Channels// 单向channelfunc main() { naturals := make(chan int) squares := make(chan int) done := make(chan struct{}) go Counter(naturals) go Squarer(naturals, squares) go Printer(squares, done) <-done}func Counter(naturals chan<- int) {

2020-07-05 23:14:51 66

转载 callback function

A “callback” is any function that is called by another function which takes the first function as a parameter. A lot of the time, a “callback” is a function that is called when something happens. That something can be called an “event” in programmer-speak.

2020-07-05 20:18:17 130

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除